Design Patterns Lecture
To Read
- Section 9.4 of A First Course in Object Oriented Development, but not the pattern Template Method.
Recording, Part 1
Design Pattern Lecture, Part 1
Content, Part 1
00:00 Introduction to design patterns
05:40 The Observer pattern
09:53 The coursebook example of Observer
11:39 Why Observer is needed in the coursebook example
15:17 Observer implementation in the coursebook example
36:06 Comments on the Observer pattern
Recording, Part 2
Design Pattern Lecture, Part 2 Links to an external site.
Content, Part 2
00:00 The Strategy pattern
02:31 The coursebook example of Strategy
05:53 Strategy implementation in the coursebook example The loop at line 80 in CarRegistry should have been removed when the strategy pattern was implemented, but was instead left. This is corrected in the git repository below.
17:48 Comments on the Strategy pattern
20:43 The Factory pattern
21:42 The coursebook example of Factory
24:53 Factory implementation in the coursebook example
30:20 Comments on the Factory pattern
33:07 The Singleton pattern
37:45 Singleton implementation in the coursebook example
Recording, Part 3
Design Pattern Lecture, Part 3
Links to an external site.
At about 12:30 a package private constructor is created, but it's by mistake given public accessibility instead of package private. Also, PromotingMatch shall return null on line 80 if no matching car is found. The call to PerfectMatch which was previously there is now done by the composite. Both these mistakes are corrected in the git repository below.
Content, Part 3
00:00 The Composite pattern
00:23 The coursebook example of Composite
02:09 More on the Composite pattern
07:53 Composite implementation in the coursebook example
19:20 Comments on the Composite pattern
Solutions to Exercises
Here's a git repository with the code that was written during the lecture, https://github.com/KTH-IV1350/oodbook-examples-des-pat.git Links to an external site.