1
00:00:00,930 --> 00:00:03,130
Before we end the course, let's take a

2
00:00:03,130 --> 00:00:05,260
more in depth look at the real world

3
00:00:05,260 --> 00:00:07,320
scenarios and implications of the

4
00:00:07,320 --> 00:00:10,230
prototype pattern itself. First off, like

5
00:00:10,230 --> 00:00:12,740
all design patterns, implementing every

6
00:00:12,740 --> 00:00:15,410
object in your project as a prototype is

7
00:00:15,410 --> 00:00:17,350
not the way to go and can even be

8
00:00:17,350 --> 00:00:19,990
overkill. The key is to seek out the

9
00:00:19,990 --> 00:00:21,940
places where it really makes sense to use

10
00:00:21,940 --> 00:00:25,190
it and use it correctly. Common scenarios

11
00:00:25,190 --> 00:00:27,630
are going to include when classes to

12
00:00:27,630 --> 00:00:30,260
instantiate our specified runtime,

13
00:00:30,260 --> 00:00:32,760
avoiding a class hierarchy of factories

14
00:00:32,760 --> 00:00:34,440
that mirrors the class hierarchy of your

15
00:00:34,440 --> 00:00:36,800
products. And when class instances can

16
00:00:36,800 --> 00:00:39,530
only have a small, finite combination of

17
00:00:39,530 --> 00:00:42,180
state. If you are familiar with other

18
00:00:42,180 --> 00:00:44,600
creational patterns, specifically builder

19
00:00:44,600 --> 00:00:46,670
and abstract factory, you've probably

20
00:00:46,670 --> 00:00:48,460
noticed that they share several

21
00:00:48,460 --> 00:00:51,610
implications with prototype. First

22
00:00:51,610 --> 00:00:54,120
concrete prototype classes are hidden from

23
00:00:54,120 --> 00:00:56,330
the client. Second, as we've already

24
00:00:56,330 --> 00:00:58,760
noted, products can be added or removed a

25
00:00:58,760 --> 00:01:01,250
run time by the client. Thirdly, using

26
00:01:01,250 --> 00:01:04,320
cloned objects with varying configurations

27
00:01:04,320 --> 00:01:05,810
means your system is going to be more

28
00:01:05,810 --> 00:01:07,580
dynamic through this kind of object

29
00:01:07,580 --> 00:01:09,850
composition, and your class hierarchy is

30
00:01:09,850 --> 00:01:12,240
going to be cleaner and more efficient.

31
00:01:12,240 --> 00:01:14,900
Lastly, prototype objects can be used as

32
00:01:14,900 --> 00:01:17,450
parts in a larger object creation design,

33
00:01:17,450 --> 00:01:19,980
which can also increase the modularity of

34
00:01:19,980 --> 00:01:23,000
your code. In summary, we've learned how

35
00:01:23,000 --> 00:01:25,540
to create an abstract prototype class that

36
00:01:25,540 --> 00:01:28,130
enforces a cloning blueprint on adopting

37
00:01:28,130 --> 00:01:30,620
classes. How to distinguish an implement,

38
00:01:30,620 --> 00:01:33,410
shallow and deep cloning. How to set up a

39
00:01:33,410 --> 00:01:35,500
prototype manager for storing and

40
00:01:35,500 --> 00:01:37,360
retrieving prototype objects more

41
00:01:37,360 --> 00:01:40,040
efficiently. And finally, how to identify

42
00:01:40,040 --> 00:01:42,160
and work with the prototype pattern in

43
00:01:42,160 --> 00:01:44,820
real world scenarios. If you've enjoyed

44
00:01:44,820 --> 00:01:47,050
the course, please leave a rating. And if

45
00:01:47,050 --> 00:01:48,590
you have any questions or just want to

46
00:01:48,590 --> 00:01:54,000
connect, feel free to drop me a line. As always, happy coding.

