0% found this document useful (0 votes)
50 views25 pages

Agile - Design

This document outlines five principles for agile design: the single responsibility principle, the open/closed principle, the Liskov substitution principle, the dependency inversion principle, and the interface segregation principle. It provides examples to illustrate each principle, such as separating computational and graphical responsibilities to uphold the single responsibility principle. The document also mentions working with diagrams, common errors, and useful patterns but does not provide details on these topics.

Uploaded by

Manish Shrestha
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views25 pages

Agile - Design

This document outlines five principles for agile design: the single responsibility principle, the open/closed principle, the Liskov substitution principle, the dependency inversion principle, and the interface segregation principle. It provides examples to illustrate each principle, such as separating computational and graphical responsibilities to uphold the single responsibility principle. The document also mentions working with diagrams, common errors, and useful patterns but does not provide details on these topics.

Uploaded by

Manish Shrestha
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Agile design

Lai Duy Ha

Outline
Five

principles for agile design Working with diagrams Common errors Useful patterns

Five principles for agile design


The

Single-Responsibility Principle (SRP) The Open/Closed Principle (OCP) The Liskov Substitution Principle (LSP) The Dependency-Inversion Principle (DIP) The Interface Segregation Principle (ISP)

The Single-Responsibility Principle (SRP)


A

class should have only one reason to change.

The Single-Responsibility Principle (SRP)


Each

responsibility is an axis of change. If a class has more than one responsibility.


have more than one reason to change. the responsibilities become coupled.

Example:

The Single-Responsibility Principle (SRP)

Computational Geometry App:


Use area() operation. computational geometry. never drawing the rectangle on the screen. Use draw() operation. draws the rectangle on the screen.

Graphical App:

The Single-Responsibility Principle (SRP)

Separated responsibilities

The Open/Closed Principle (OCP)


Software

entities (classes, modules, functions, etc.) should be:


open for extension but closed for modification.

The Open/Closed Principle (OCP)

The Open/Closed Principle (OCP)


Real

example:

Validate comment is spam or not Lots of strategy & service


visitors

IP address against Project Honey Pots IP black list. Another protection: Akismet.

The Open/Closed Principle (OCP)

The Liskov Substitution Principle (LSP)


Subtypes

must be substitutable for their base types.

The Liskov Substitution Principle (LSP)

Satisfies LSP if:


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

A Good Example of Liskov Substitution Principle

The Liskov Substitution Principle (LSP)

The Dependency-Inversion Principle (DIP)

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.

The Dependency-Inversion Principle (DIP)

Ownership Inversion

The Dependency-Inversion Principle (DIP)

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

The Dependency-Inversion Principle (DIP)

The Dependency-Inversion Principle (DIP)


A

bank example:
Transfer money between account

transfer money from a bank account to pay bills???

The Dependency-Inversion Principle (DIP)

The Interface Segregation Principle (ISP)


Clients

should not be forced to depend on methods they do not use.

The Interface Segregation Principle (ISP)

breaking the interface

The Interface Segregation Principle (ISP)

breaking the interface

Outline
Five

principles for agile design Working with diagrams Common errors Useful patterns

Reference
Martin,

R. (2006). Agile principles, patterns, and practices in C#. Prentice-Hall PTR.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy