-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
909 lines (907 loc) · 29.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta property="og:title" content="Design Patterns 101" />
<meta property="og:image" content="https://design-patterns-101.vercel.app/Assets/meta-033-patterns.png" />
<meta
property="og:image:alt"
content="Flip cards of design patterns for software development. Click to visit website."
/>
<meta property="og:description" content="Project by Emmanuel Jose" />
<meta property="og:url" content="https://design-patterns-101.vercel.app/" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary" />
<meta
name="description"
content="Flip cards of design patterns for software development. Click to visit website."
/>
<meta name="theme-color" content="#FFFFFF" />
<meta name="keywords" content="HTML, CSS, design patterns, object oriented programming, software development" />
<meta name="author" content="Emmanuel Jose" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="canonical" href="https://design-patterns-101.vercel.app/" />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="https://use.typekit.net/cxp2oct.css" />
<title>Design Patterns 101</title>
<link rel="icon" type="image/png" href="Assets/emmanuel-jose.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="Assets/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="Assets/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="Assets/favicon-16x16.png" />
<link rel="manifest" href="manifest.webmanifest" />
</head>
<body>
<button onclick="topFunction()" id="myBtn" title="Go to top">▲</button>
<header class="banner" tabIndex="0">
<h1 class="title">Design Patterns 101</h1>
<h2 id="description">The 23 Design Patterns for Object-Oriented Programming by the Gang of Four (GoF)</h2>
<h4 id="expand">
This demo is for educational purposes only. Sources: ©
<a
href="https://refactoring.guru/"
id="header-link"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Refactoring.Guru</a
>. Art by ©
<a href="https://zhart.us/" id="header-link" tabindex="0" target="_blank" rel="noopener noreferrer"
>Dmitry Zhart.</a
>
All Rights Reserved.
</h4>
<a
href="https://github.com/emjose/design-patterns-101/#header"
target="_blank"
rel="noopener noreferrer"
class="github-corner"
aria-label="View source on GitHub"
><svg
width="120"
height="120"
viewBox="0 0 250 250"
style="
fill: var(--github-fill);
color: var(--github-color);
position: absolute;
top: 0;
border: 0;
right: 0;
"
aria-hidden="true"
>
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path
d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
fill="currentColor"
style="transform-origin: 130px 106px"
class="octo-arm"
></path>
<path
d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
fill="currentColor"
class="octo-body"
></path>
</svg>
</a>
</header>
<div class="card-container">
<!-- What are Design Patterns? -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Design Patterns</p>
<p id="card-content">
Design patterns are general solutions to commonly occurring problems in software design.
<br />
<br />
Patterns are <span id="strong">not</span> algorithms; they are high-level solutions with
flexible implementation.
<br />
<br />
<span id="strong">Analogy:</span> Blueprints or templates that are reusable & customizable.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/what-is-pattern"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-01.webp"
alt="Question mark inside a circle. Click for definition of design patterns."
/>
</div>
<!-- Creational -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Creational Patterns</p>
<p id="card-content">
First category of patterns.
<br />
<br />
Creational patterns provide mechanisms to create objects based on a required criterion and in a
controlled way.
<br />
<br />
<span id="strong">5 creational patterns:</span> Abstract Factory, Builder, Factory Method,
Prototype, and Singleton.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/creational-patterns"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-02.webp"
alt="An open hand underneath a gear connected to three circles. Click for definition of creational patterns."
/>
</div>
<!-- Structural -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Structural Patterns</p>
<p id="card-content">
Second category of patterns.
<br />
<br />
Structural patterns address how to assemble classes and objects to form larger structures and
provide new functionality.
<br />
<br />
<span id="strong">7 structural patterns:</span> Adapter, Bridge, Composite, Decorator, Facade,
Flyweight, and Proxy.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/structural-patterns"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-03.webp"
alt="A tree like diagram of rectangular objects. Click for definition of structural patterns."
/>
</div>
<!-- Behavioral -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Behavioral Patterns</p>
<p id="card-content">
Third category of patterns.
<br />
<br />
Behavioral patterns identify and address communication and responsibilities between objects.
<br />
<br />
<span id="strong">11 behavioral patterns:</span>
<span id="mini"
>Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer,
State, Strategy, Template Method, and Visitor.</span
>
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/behavioral-patterns"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-04.webp"
alt="Four puzzle pieces surrounding a gear. Click for definition of behavioral patterns."
/>
</div>
<!-- Creational: Abstract Factory -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Abstract Factory</p>
<p id="card-content">
In object-oriented programming, a <span id="strong">factory</span> is an object that creates
other objects.
<br />
<br />
An <span id="strong">Abstract Factory</span> has abstracted out a theme, and it produces
families of related or dependent objects without specifying their concrete classes.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/abstract-factory"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-05.webp"
alt="Diagrams of rectangles next to a factory. Click for definition of abstract factory."
/>
</div>
<!-- Creational: Builder -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Builder</p>
<p id="card-content">
Builder lets you construct complex objects step by step.
<br />
<br />
The Builder pattern separates the <span id="strong">construction</span> of an object from its
<span id="strong">representation</span>.
<br />
<br />
Builder allows the same construction process to create various representations.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/builder"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-06.webp"
alt="A construction hard hat next to a house divided into three parts. Click for definition of builder."
/>
</div>
<!-- Creational: Factory Method -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Factory Method</p>
<p id="card-content">
Factory Method (also known as Virtual Constructor) is used to replace class constructors.
<br />
<br />
Factory Method defines an interface for creating an object, but based on data or events, it lets
<span id="strong">subclasses</span> decide which class to instantiate.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/factory-method"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-07.webp"
alt="A factory next to a diagram of three rectangles. Click for definition of factory method."
/>
</div>
<!-- Creational: Prototype -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Prototype</p>
<p id="card-content">
Prototype (also known as Clone) allows you to clone existing objects without making your code
dependent on their classes.
<br />
<br />
New objects are created from an existing <span id="strong">prototypical instance</span>, thus
boosting performance and minimizing memory footprints.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/prototype"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-08.webp"
alt="Two robots standing upright. Click for definition of prototype."
/>
</div>
<!-- Creational: Singleton -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Singleton</p>
<p id="card-content">
Singleton restricts a class to only
<span id="strong">one single instance</span>.
<br />
<br />
Singleton provides a global point of access to this instance.
<br />
<br />Singleton is useful when exactly one object is needed to coordinate actions across the
system.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/singleton"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-09.webp"
alt="A tri-level medal podium, with each place occupied by the number 1. Click for definition of singleton."
/>
</div>
<!-- Structural: Adapter -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Adapter</p>
<p id="card-content">
Adapter (also known as Wrapper or Translator) allows classes with incompatible interfaces to
collaborate.
<br />
<br />
Without modifying the source code, the adapter <span id="strong">wraps</span> and converts the
interface of an existing class to match the interface of another class.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/adapter"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-10.webp"
alt="A power adapter flanked by two different plugs. Click for definition of adapter."
/>
</div>
<!-- Structural: Bridge -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Bridge</p>
<p id="card-content">
The Bridge pattern decouples, or splits, an <span id="strong">abstraction</span> from its
<span id="strong">implementation</span>, so that the two can develop independently.
<br />
<br />
Bridge can use encapsulation, aggregation, or inheritance to separate responsibilities into
different classes.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/bridge"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-11.webp"
alt="A suspension bridge tower with cables. Click for definition of bridge."
/>
</div>
<!-- Structural: Composite -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Composite</p>
<p id="card-content">
Composite (also known as Object Tree) creates a composition of objects in a tree structure to
represent <span id="strong">part-whole hierarchies</span>. Each object may be a simple or
composite object.
<br />
<br />
Composite allows you to treat individual objects and compositions uniformly.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/composite"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-12.webp"
alt="A tree diagram of rectangles in the loose shape of a triangle. Click for definition of composite."
/>
</div>
<!-- Structural: Decorator -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Decorator</p>
<p id="card-content">
The Decorator pattern (also known as Wrapper) extends (or decorates) an object’s behavior
dynamically, <span id="strong">without making a new subclass</span>.
<br />
<br />
Multiple decorators can add or override behaviors in an existing method of an object by
"wrapping" around the object.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/decorator"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-13.webp"
alt="A paint roller next to a Matryoshka doll, the Russian nesting doll. Click for definition of decorator."
/>
</div>
<!-- Structural: Facade -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Facade</p>
<p id="card-content">
The Facade pattern provides a <span id="strong">simplified interface</span> to a library, a
framework, or any other complex system.
<br />
<br />
By masking interaction with more complex components in the larger system, the facade improves
<span id="strong">readability</span> and <span id="strong">usability</span> for the client.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/facade"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-14.webp"
alt="A Roman architectural building with 5 columns. Click for definition of facade."
/>
</div>
<!-- Structural: Flyweight -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Flyweight</p>
<p id="card-content">
The Flyweight pattern (also known as Cache) reduces the cost of creating and manipulating a
large number of similar objects.
<br />
<br />
Flyweight minimizes memory usage by
<span id="strong">sharing common parts of state</span> between multiple objects instead of
keeping all of the data in each object.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/flyweight"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-15.webp"
alt="A balance scale with each arm supporting a box, and the left arm is lower. Click for definition of flyweight."
/>
</div>
<!-- Structural: Proxy -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Proxy</p>
<p id="card-content">
The Proxy pattern provides a <span id="strong">placeholder</span> for another object to control
access, reduce cost, and reduce complexity.
<br />
<br />
A proxy controls access to the original object, allowing actions to be performed
<span id="strong">before or after the request</span>
to the original object.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/proxy"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-16.webp"
alt="A diagram of an arrow showing the placement of a box inside a larger rectilinear shape. Click for definition of proxy."
/>
</div>
<!-- Behavioral: Chain of Responsibility -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title-small">Chain of Responsibility</p>
<p id="card-content">
Chain of Responsibility (also known as Chain of Command) lets you pass requests along
<span id="strong">a chain of handlers</span>. Each handler decides to process or to pass the
request to the next handler in the chain.
<br />
<br />
The pattern is essentially <span id="strong">a linear search</span> for an object that can
handle a particular request.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/chain-of-responsibility"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-17.webp"
alt="Chain links underneath an arrow that is bouncing across the tops of five boxes. Click for definition of chain of responsibility. "
/>
</div>
<!-- Behavioral: Command -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Command</p>
<p id="card-content">
The Command pattern (also known as Action or Transaction)
<span id="strong">encapsulates actions as objects</span>
that contain all parameters.
<br />
<br />
This transformation lets you pass requests as method arguments, delay or queue a request’s
execution, and support undoable operations.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/command"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-18.webp"
alt="Four rectangles with icons of a floppy disc, a folder, scissors, and a printer. Click for definition of command."
/>
</div>
<!-- Behavioral: Interpreter -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Interpreter</p>
<p id="card-content">
The Interpreter pattern defines a grammatical representation for a language and provides an
interpreter to process grammar.
<br />
<br />
<span id="strong">Interpreter maps:</span>
<br />
• a domain to a language,
<br />
• the language to a grammar,
<br />
• the grammar to a hierarchical object-oriented design.
</p>
<p id="content-link">
<a
href="https://sourcemaking.com/design_patterns/interpreter"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-19.webp"
alt="An open faced book with a magnifying glass on the right page. Click for definition of interpreter."
/>
</div>
<!-- Behavioral: Iterator -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Iterator</p>
<p id="card-content">
The Iterator pattern lets you <span id="strong">sequentially traverse</span> elements of a
collection or container without exposing its underlying representation (data structures like
lists, stacks, trees, etc.).
<br />
<br />
For traversal to occur, the iterator decouples algorithms from containers.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/iterator"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-20.webp"
alt="A hiker with a backpack, walking above a row of six boxes. Click for definition of iterator."
/>
</div>
<!-- Behavioral: Mediator -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Mediator</p>
<p id="card-content">
The Mediator pattern (also known as Intermediary or Controller)
<span id="strong">reduces chaotic dependencies</span> between objects.
<br />
<br />
The pattern restricts direct interaction between objects and facilitates communication and
collaboration via a mediator object.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/mediator"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-21.webp"
alt="Five rectangles arranged in a cross formation. Arrows connect the center rectangle to the other four rectangles. Click for definition of mediator."
/>
</div>
<!-- Behavioral: Memento -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Memento</p>
<p id="card-content">
The Memento pattern (also known as Snapshot) provides the ability to save and restore an object
to its
<span id="strong">previous state</span> (undo via rollback).
<br />
<br />
The memento object (the unique snapshot of state) is an
<span id="strong">opaque object</span> (the object that no one can or should change).
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/memento"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-22.webp"
alt="A paper document being saved into a floppy disc. Click for definition of memento."
/>
</div>
<!-- Behavioral: Observer -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Observer</p>
<p id="card-content">
The Observer pattern (also known as Event-Subscriber or Listener) offers a
<span id="strong">subscription mechanism</span> to notify objects when events or changes in
state occur.
<br />
<br />
The observer pattern promotes <span id="strong">loose coupling</span> between the subject and
the observers.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/observer"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-23.webp"
alt="Gray binoculars facing towards the viewer. Click for definition of observer."
/>
</div>
<!-- Behavioral: State -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">State</p>
<p id="card-content">
The State design pattern allows an object to <span id="strong">alter its behavior</span> when
its <span id="strong">internal state</span> changes. It appears as if the object changed its
class.
<br />
<br />
State is a cleaner way for an object to change its behavior at runtime without resorting to
conditional statements.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/state"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-24.webp"
alt="A paper document next to a circular diagram of rectangles with clockwise moving arrows. Click for definition of state."
/>
</div>
<!-- Behavioral: Strategy -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Strategy</p>
<p id="card-content">
The Strategy pattern (also known as Policy) lets you define a family of algorithms, place each
into separate classes (strategies), and <span id="strong">make them interchangeable</span>.
<br />
<br />
The pattern enables fast switching between algorithms, meaning algorithms can be selected
on-the-fly at runtime.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/strategy"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-25.webp"
alt="A paper document next to a diagram of three rectangles that contain icons for a hand, sword, and shield."
/>
</div>
<!-- Behavioral: Template Method -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Template Method</p>
<p id="card-content">
The Template Method defines the <span id="strong">skeleton of an algorithm</span> as an abstract
class, but allows <span id="strong">subclasses</span> to provide concrete behavior.
<br />
<br />
The subclasses can redefine certain steps of an algorithm without changing the algorithm's
structure.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/template-method"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-26.webp"
alt="Three rectangles arranged in a triangle formation, connected with lines. Click for definition of template method."
/>
</div>
<!-- Behavioral: Visitor -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title">Visitor</p>
<p id="card-content">
The Visitor pattern is a way of <span id="strong">separating algorithms from objects</span> by
moving the hierarchy of methods into one object.
<br />
<br />
With the creation of a <span id="strong">visitor class</span>, you can add new operations and
functions to existing object structures without modifying the structures.
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/visitor"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-27.webp"
alt="A diagram of a small rectangle being cloned and placed inside the interior of four larger rectangles. Click for definition of visitor."
/>
</div>
<!-- History of Design Patterns -->
<div class="card" tabindex="0">
<div class="front">
<p id="card-title-small">History of Design Patterns</p>
<p id="card-content">
Software design patterns were first described in the 1994 book,
<span id="book-title">Design Patterns: Elements of Reusable Object-Oriented Software</span>.
<br />
<br />
The authors are Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. They are known as
the
<span id="strong">"Gang of Four"</span> (GoF).
</p>
<p id="content-link">
<a
href="https://refactoring.guru/design-patterns/history"
tabindex="0"
target="_blank"
rel="noopener noreferrer"
>Get Details</a
>
</p>
</div>
<img
class="back"
src="Cards/card-28.webp"
alt="An hourglass with sand. Click for history of design patterns."
/>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
<!-- Emmanuel Jose logo and favicon. © Emmanuel Jose. All Rights Reserved. -->