Join Jungwoo Ryoo for an in-depth discussion in this video Template method, part of Python: Advanced Design Patterns.
- [Instructor] By definition,…in object oriented programming,…inheritance allows a child class…to override a method defined by it's parent class.…This capability is referred to as polymorphism.…For example, the parent class shape here has a draw method…which can be overwritten by it's child classes…such as triangle, rectangle, and circle.…When I execute the draw method…on the triangle class it will draw a triangle…while the draw method on circle will draw a circle.…
The template method design pattern is behavioral…in nature and provides a stricter version of polymorphism.…It allows or forces only a select group of methods…to be overridden and prevents the rest…of methods belonging to a parent class…from being changed by it's child classes.…By restricting how much it's child class behaviors…can deviate from it's parent class,…the template method pattern defines a skeleton…of operations that will always be present in child classes.…
It is a solution that allows developers…to extract commonalities across similar classes…
- Architectural vs. design patterns
- Why use design patterns?
- Design best practices
- Domain-specific patterns and security patterns
- Gang of Four design patterns
- Command, Mediator, and State
- Template method
Skill Level Advanced
1. Understanding Design Patterns: Review
2. Design Best Practices
3. Gang of Four (GoF) Patterns, Part 1
4. Gang of Four (GoF) Patterns, Part 2
Next steps1m 26s
- 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.