In this video, the Factory method will be reviewed which was applied to the code. You will also get a clear understanding of how it matched the class diagram by comparing how the class diagrams Product, Creator, Concrete Product & Concrete Creator translate in the code for Citi & National credit unions. We'll see how in the end, this patterns creates the correct objects based on specific input.
- [Voiceover] Let's assume two credit unions merge…and now they share an API that pulls account information…from each company that merged.…One call Citi Credit Union and…the other National Credit Union.…What it does is it returns a savings account object…depending on the account number passed in.…We're going to demo this.…So, go ahead and open up from your exercise folder…the solution for factory method.…We're going to step through this one by one.…The first thing that I did is I created an abstract…product that's a class called ISavingsAccount.…
And all I did is add in one property in there for balance.…Following that, I created 2 concrete products.…One called CitiSavingsAcct that inherits…from ISavingsAccount, and within the constructor…I define a value of $5,000 for the balance.…Right below it is a second concrete product…and it's for NationalSavingsAcct and likewise…it also inherits from ISavingsAcct.…
And similarly, within the constructor this time…I defined the balance as $2,000.…Next, I create the creator which is an interface…
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.