Escolar Documentos
Profissional Documentos
Cultura Documentos
Lai Duy Ha
Outline
Five
principles for agile design Working with diagrams Common errors Useful patterns
Single-Responsibility Principle (SRP) The Open/Closed Principle (OCP) The Liskov Substitution Principle (LSP) The Dependency-Inversion Principle (DIP) The Interface Segregation Principle (ISP)
have more than one reason to change. the responsibilities become coupled.
Example:
Use area() operation. computational geometry. never drawing the rectangle on the screen. Use draw() operation. draws the rectangle on the screen.
Graphical App:
Separated responsibilities
example:
IP address against Project Honey Pots IP black list. Another protection: Akismet.
as long as arg is the same. every time you call foo on a Derived object it gives exactly the same results as calling foo on a Base object
High-level modules should not depend on lowlevel modules. Both should depend on abstractions. Abstractions should not depend upon details. Details should depend upon abstractions.
Ownership Inversion
The Furnace Example control the regulator of a furnace. read the current temperature from an I/O channel instruct the furnace to turn on or off by sending commands to a different I/O channel
bank example:
Transfer money between account
Outline
Five
principles for agile design Working with diagrams Common errors Useful patterns
Reference
Martin,