The Decorator Pattern that has been applied to an existing program to add features to cars is discussed in two videos which this is the first of. This video covers the code written to build the component, concrete component and decorator. In this scenario, it's explained how the class 'car' represents the component, the class size (compactCar/ fullSizeCar) represents the concrete component and how the class 'CarDecorator' represents the decorator.
- [Voiceover] I'm going to continue with the car example…so let's open up the solution for decorator…from your exercise folder…and I'll step through this code.…Now on the righthand side of the Solution Explorer,…you see that I created a folder…for each of the key classes…I showed in our class diagram.…Component, concrete component,…decorator and concrete decorator…and if we were to flip back to our class diagram,…we have component, concrete component,…decorator, and our two concrete decorators.…
Let's first go to the component folder…and open up car.…The component from the class diagram…is the car which here is an abstract class…that has two abstract method signatures and a property.…Property being description, the two abstract methods…being get description and get car price.…Very straight forward.…Now let's navigate to the concrete component folder…and open up compact car.…This is our concrete implementation of the component.…
I created two files like these.…One for compact car…and one for full size car…which is very similar to the code here.…
In this course, developer and technologist Reynald Adolphe explains the purpose and effective use of eight design patterns, including six Gang of Four design patterns and two .NET patterns. Gang of Four patterns fall under three categories: structural, creational, and behavioral. Reynald helps you learn about select patterns from each category. He describes each pattern and demonstrates how programmers can leverage them in real-world applications.
- Factory Method
- Abstract Factory
- Singleton pattern
- Decorator pattern
- Iterator pattern
- Observer pattern
- Repository pattern
- Unit of Work pattern
Skill Level Intermediate
2. Factory Method
3. Abstract Factory
4. Singleton Pattern
5. Decorator Pattern
6. Iterator Pattern
7. Observer Pattern
8. Repository Pattern
9. Unit of Work Pattern
Convert to Unit of Work3m 53s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.