Join Jungwoo Ryoo for an in-depth discussion in this video Strategy, part of Python: Design Patterns.
- The Strategy pattern offers a family of…interchangeable algorithms to a client.…The problem we often see is that there is a need…for dynamically changing the behavior of an object.…So we offer our Strategy class with its default behavior.…When there is a need, we provide another variation…of the Strategy class by dynamically replacing…its default method with a new one.…
Python allows adding methods dynamically…by importing the types module.…
Author
Released
7/16/2015- Understanding design patterns
- Best design practices: consistency, completeness, and correctness
- Working with creational patterns
- Working with structural patterns
- Working with behavioral patterns
Skill Level Intermediate
Duration
Views
Q: In the strategy pattern example, why does the code keep executing the default function rather than the alternate?
A: The programming demonstration skips the step of defining what the strategy pattern should be when an alternate function name is provided
as an argument as shown below.
Related Courses
-
Programming Foundations: Design Patterns
with Elisabeth Robson2h 19m Intermediate -
Code Clinic: Python
with Barron Stone2h 23m Intermediate -
PHP: Design Patterns
with Keith Casey1h 9m Intermediate
-
Introduction
-
Welcome34s
-
-
1. Understanding Design Patterns
-
What is a design pattern?2m 18s
-
Types of design patterns1m 47s
-
-
2. Creational Patterns
-
Factory48s
-
Factory example6m 44s
-
Abstract factory1m 24s
-
Abstract factory example5m 23s
-
Singleton57s
-
Singleton example5m 32s
-
Builder1m 44s
-
Builder example4m 34s
-
Prototype58s
-
Prototype example6m 2s
-
-
3. Structural Patterns
-
Decorator51s
-
Decorator example4m 23s
-
Proxy1m 7s
-
Proxy example5m 19s
-
Adapter37s
-
Adapter example5m 54s
-
Composite1m 14s
-
Composite example4m 56s
-
Bridge1m 12s
-
Bridge example4m 46s
-
-
4. Behavioral Patterns
-
Observer1m 1s
-
Observer example7m 27s
-
Visitor48s
-
Visitor example6m 59s
-
Iterator1m 9s
-
Iterator example4m 10s
-
Strategy37s
-
Strategy example6m 1s
-
-
5. Design Best Practices
-
Consistency2m 18s
-
Other qualities2m 42s
-
-
Conclusion
-
Next steps28s
-
- 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: Strategy