Software DEsign

Lab 05
Exercise 04
Interface Segregation
What is the ISP?
Different clients might use different subsets of an interface. This introduces coupling between the clients. Solution: Smaller interfaces customized for the clients.
How does it relate to LSP?
Both principles concentrate on the client view.
(Often unwanted methods in large interfaces are implemented with exceptions, this clearly violates LSP)
Isn't this the same as SRP?
It is similar. Both result in more and smaller interfaces.
But SRP focuses on dimensions of change, while ISP focuses on the client view.
Dependency Inversion P.
High-level modules should not depend on low-level modules. Both should depend on abstractions.

A highlevel module declares the interfaces for the lower level services it needs.
This allows swapping out lower levels.
Dependency Inversion P.
What if we want to use an existing utility library?

=> Adapter pattern
DEsign Patterns
Design Patterns
What are Design Patterns?
Which Design Patterns have you seen in the lecture?
Which Design Patterns have you seen outside the lecture?
Small exercise
- What are possible parameters? What does change, what should be reused?
- Improve the code, possibly using both Template Method and Strategy.
- When do you want to use Template Method, when Strategy? What is the difference between the two?
Templ. MEth.
Inheritance
Static
...
Strategy
Forwarding
Dynamic
...
sedesign04
By b-studios
sedesign04
- 300