The Singleton Pattern will be implemented in this video. Here you’ll learn in a step by step manner how to update and refactor the code to apply the Singleton Pattern. This video will also provide a real world example while applying principles discussed earlier. An exercise solution file is provided to compare the final results.
- [Voiceover] Okay so let's go ahead and open up…our exercise file that covers singleton…for this particular chapter…and what we're going to go ahead…and do is before we get started,…I want to show you that on the lefthand side of my screen…you see that there's a pane there called Test Explorer.…If you don't see that,…you can go to the top nav bar…and choose Test, Windows…and then you have an option for Test Explorer…to pop that pane up.…The first thing that I'd like to do…is make sure that we look in to our policy class here.…
You'll notice that there's two projects:…a singleton project and a singleton.test project.…So let's go in to our policy class…and quickly skim over what's in there.…There's the class itself…and there's two properties and a method.…One property for ID and one insured.…That's assigned the value of John Roy…and ID is one two three.…The method simply returns the insured name.…Now let's hop on over to our program file…and all we do here is create an instance of the policy class…and then call the get insured name method…
Author
Released
5/31/2016In 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
Duration
Views
Related Courses
-
Introduction
-
Welcome1m 28s
-
-
1. Overview
-
Design patterns explained1m 20s
-
The need for design patterns1m 31s
-
Design pattern categories1m 35s
-
-
2. Factory Method
-
Factory pattern overview1m 36s
-
Code the Factory pattern4m 16s
-
-
3. Abstract Factory
-
4. Singleton Pattern
-
Singleton pattern overview1m 44s
-
Thread safety2m 42s
-
-
5. Decorator Pattern
-
Decorator pattern overview2m 54s
-
Concrete Component code2m 37s
-
Concrete Decorator code2m 42s
-
-
6. Iterator Pattern
-
Aggregate setup2m 7s
-
Iterator setup and execution4m 53s
-
7. Observer Pattern
-
Observer pattern overview2m 23s
-
Concrete Subject code3m 23s
-
-
8. Repository Pattern
-
MVC Project setup8m 14s
-
Create a Generic Repository2m 16s
-
9. Unit of Work Pattern
-
Convert to Unit of Work3m 53s
-
Conclusion
-
Next Steps31s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Code with the Singleton pattern