1
00:00:00,440 --> 00:00:01,460
[Autogenerated] the key problem the

2
00:00:01,460 --> 00:00:03,690
adapter pattern seeks to address is

3
00:00:03,690 --> 00:00:06,590
incompatible interfaces. You have some

4
00:00:06,590 --> 00:00:09,270
client code that needs to use one or more

5
00:00:09,270 --> 00:00:11,530
service providers, and the interface the

6
00:00:11,530 --> 00:00:14,160
client is set up to call doesn't match the

7
00:00:14,160 --> 00:00:17,680
one the service provider defines. This

8
00:00:17,680 --> 00:00:19,010
isn't the first time that I've taught a

9
00:00:19,010 --> 00:00:21,300
course on the adapter pattern, and no

10
00:00:21,300 --> 00:00:22,950
coverage of the adapter pattern would be

11
00:00:22,950 --> 00:00:25,540
complete without the required comparison

12
00:00:25,540 --> 00:00:28,010
to Rhea World adapters for electrical

13
00:00:28,010 --> 00:00:31,100
outlets. Electrical outlets are real world

14
00:00:31,100 --> 00:00:33,670
service providers, providing the service

15
00:00:33,670 --> 00:00:36,860
of electrical power in the United States

16
00:00:36,860 --> 00:00:39,090
out. Let's have a specific interface, like

17
00:00:39,090 --> 00:00:41,800
the one shown on the left. Other countries

18
00:00:41,800 --> 00:00:43,810
have their own interfaces and often

19
00:00:43,810 --> 00:00:45,440
provide different mounts of voltage as

20
00:00:45,440 --> 00:00:49,610
well. Appliances typically have a single

21
00:00:49,610 --> 00:00:51,910
plug designed to work with a specific

22
00:00:51,910 --> 00:00:53,840
interface, and they cannot use

23
00:00:53,840 --> 00:00:56,860
incompatible outlets by themselves. For

24
00:00:56,860 --> 00:00:59,730
this scenario, adapters are available to

25
00:00:59,730 --> 00:01:02,440
convert from an appliance designed for a

26
00:01:02,440 --> 00:01:05,120
European outlet to be able to plug into a

27
00:01:05,120 --> 00:01:08,860
U. S. Outlet or vice versa. Because there

28
00:01:08,860 --> 00:01:10,680
are many different interfaces for power

29
00:01:10,680 --> 00:01:12,820
outlets around the world, there are many

30
00:01:12,820 --> 00:01:16,250
different adapters available. Adapters

31
00:01:16,250 --> 00:01:19,340
convert the interface of one class into an

32
00:01:19,340 --> 00:01:22,690
interface a client expects. That's it.

33
00:01:22,690 --> 00:01:25,640
That's their whole reason for existence in

34
00:01:25,640 --> 00:01:28,110
software adapters, or sometimes referred

35
00:01:28,110 --> 00:01:34,000
to as rappers because they wrap an incompatible object in a compatible one.

