Download presentation
Presentation is loading. Please wait.
Published byRoss Houston Modified over 6 years ago
1
Object Oriented Design Patterns - Behavioral Patterns
IMPORTANT NOTICE TO STUDENTS: These slides are NOT to be used as a replacement for student notes. These slides are sometimes vague and incomplete on purpose to spark class discussions. Object Oriented Design Patterns - Behavioral Patterns CS 360 Lecture 7
2
Have you ever written code and got the feeling you’ve solved that problem before?
Chances are you probably have! Write down your solution and refer to it when needed. This is the idea of a design pattern. Design Pattern: The re-usable form of a software solution. Optimized using good programming practices.
3
Design Pattern Categories
Design Patterns Creational Ways to create objects Behavioral How objects interact with each other Structural How classes and objects are structured
4
Design Pattern Categories
5
Behavioral Design Patterns
Goal of Behavioral Design Patterns: Identify common communication patterns between objects. How responsibilities are split between objects. More about communication than structure.
6
Behavioral Design Patterns – Template Method
Intent Define the skeleton of an algorithm in an operation, deferring some responsibilities to subclasses. lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure. Consequences Fundamental technique for code reuse. Move all common class attributes as high in the class hierarchy as possible.
7
Behavioral Design Patterns – Template Method
8
Behavioral Design Patterns - Iterator
Intent Allows accessing of elements of a collection in a sequential manner without exposing its internal structure. Consequences Supports variations in the traversal of aggregate objects. Simplify the aggregate’s (list, set, collection) interface. New aggregate traversal operations can be defined.
9
Behavioral Design Patterns - Observer
Intent Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. Consequences Supports loose coupling between objects that interact with each other. Can be added/removed at any point. Can add complexity/lead to performance issues if not implemented correctly.
10
Behavioral Design Patterns - Observer
11
Project Group Activity
Search online content for Behavioral Design Patterns implemented using languages for your project. Template Method Iterator Observer
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.