Presentation is loading. Please wait.

Presentation is loading. Please wait.

(c) 2009 University of California, Irvine – André van der Hoek1June 13, 2015 – 21:42:16 Informatics 122 Software Design II Lecture 8 André van der Hoek.

Similar presentations


Presentation on theme: "(c) 2009 University of California, Irvine – André van der Hoek1June 13, 2015 – 21:42:16 Informatics 122 Software Design II Lecture 8 André van der Hoek."— Presentation transcript:

1 (c) 2009 University of California, Irvine – André van der Hoek1June 13, 2015 – 21:42:16 Informatics 122 Software Design II Lecture 8 André van der Hoek Duplication of course material for any commercial purpose without the explicit written permission of the professor is prohibited.

2 (c) 2009 University of California, Irvine – André van der Hoek2June 13, 2015 – 21:42:16 Today’s Lecture Design patterns

3 (c) 2009 University of California, Irvine – André van der Hoek3June 13, 2015 – 21:42:16 Fundamental Principles Apply rigor Separate concerns –modularize –abstract Anticipate change Generalize Work incrementally

4 (c) 2009 University of California, Irvine – André van der Hoek4June 13, 2015 – 21:42:16 A Checklist on Overall Design Strive for grouping related functionality (high cohesion) Strive for ungrouping semi-related functionality (high cohesion) Strive for reducing interdependency (low coupling)

5 (c) 2009 University of California, Irvine – André van der Hoek5June 13, 2015 – 21:42:16 A Checklist on Class Design Cohesion Completeness Convenience Clarity Consistency

6 (c) 2009 University of California, Irvine – André van der Hoek6June 13, 2015 – 21:42:16 A Checklist on Principles and Strategies Principles –keep it simple, stupid! (KISS) –information hiding –acyclic dependencies –… Strategies –program to the interface –refactor –apply software patterns –use aspects –…

7 (c) 2009 University of California, Irvine – André van der Hoek7June 13, 2015 – 21:42:16 A Checklist on Principles and Strategies Principles –keep it simple, stupid! (KISS) –information hiding –acyclic dependencies –… Strategies –program to the interface –refactor –apply software patterns –use aspects –…

8 (c) 2009 University of California, Irvine – André van der Hoek8June 13, 2015 – 21:42:16 Design Patterns “Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice” [Alexander, Ishikawa, Silverstein 1977] Pattern –name –problem –solution –consequences

9 (c) 2009 University of California, Irvine – André van der Hoek9June 13, 2015 – 21:42:16 Software Design Patterns “Descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context” [Gamma, Helm, Johnson, Vlissides 1995] Pattern –name and classification –intent –also known as –motivation –applicability –structure –participants –collaborations –consequences –implementation –sample code –known uses –related patterns

10 (c) 2009 University of California, Irvine – André van der Hoek10June 13, 2015 – 21:42:16 Patterns Are Designed to Avoid Redesign Creating an object by specifying a class explicitly Dependence on specific operations Dependence on hardware and software platform Dependence on object representations or implementations Algorithmic dependencies Tight coupling Extending functionality by subclassing Inability to alter classes conveniently

11 (c) 2009 University of California, Irvine – André van der Hoek11June 13, 2015 – 21:42:16 Patterns Apply Two Design Principles Program to an interface, not an implementation –interface should be separately defined, using abstract classes Favor object composition over inheritance

12 (c) 2009 University of California, Irvine – André van der Hoek12June 13, 2015 – 21:42:16 Original Catalogue of Patterns Purpose CreationalStructuralBehavioral ScopeClassAbstract MethodAdapter (class)Interpreter Template Method ObjectAbstract Factory Builder Prototype Singleton Adapter (object) Bridge Composite Decorator Façade Flyweight Proxy Chain of Responsibility Command Iterator Mediator Memento Observer State Strategy Visitor

13 (c) 2009 University of California, Irvine – André van der Hoek13June 13, 2015 – 21:42:16 Abstract Method (Creational, Class)

14 (c) 2009 University of California, Irvine – André van der Hoek14June 13, 2015 – 21:42:16 Abstract Factory (Creational, Object)

15 (c) 2009 University of California, Irvine – André van der Hoek15June 13, 2015 – 21:42:16 Builder (Creational, Object)

16 (c) 2009 University of California, Irvine – André van der Hoek16June 13, 2015 – 21:42:16 Adaptor (Structural, Object)

17 (c) 2009 University of California, Irvine – André van der Hoek17June 13, 2015 – 21:42:16 Composite (Structural, Object)

18 (c) 2009 University of California, Irvine – André van der Hoek18June 13, 2015 – 21:42:16 Decorator (Structural, Object)

19 (c) 2009 University of California, Irvine – André van der Hoek19June 13, 2015 – 21:42:16 Proxy (Structural, Object)

20 (c) 2009 University of California, Irvine – André van der Hoek20June 13, 2015 – 21:42:16 Command (Behavioral, Object)

21 (c) 2009 University of California, Irvine – André van der Hoek21June 13, 2015 – 21:42:16 Observer (Behavioral, Object)

22 (c) 2009 University of California, Irvine – André van der Hoek22June 13, 2015 – 21:42:16 State (Behavioral, Object)

23 (c) 2009 University of California, Irvine – André van der Hoek23June 13, 2015 – 21:42:16 Visitor (Behavioral, Object)

24 (c) 2009 University of California, Irvine – André van der Hoek24June 13, 2015 – 21:42:16 More… Patterns –http://en.wikipedia.org/wiki/Software_pattern –http://c2.com/ppr/ Interaction design patterns –http://en.wikipedia.org/wiki/Interaction_design_pattern Anti-Patterns –http://en.wikipedia.org/wiki/Anti-pattern#Programming_anti-patterns Refactoring –http://en.wikipedia.org/wiki/Refactoring And numerous, numerous, numerous books


Download ppt "(c) 2009 University of California, Irvine – André van der Hoek1June 13, 2015 – 21:42:16 Informatics 122 Software Design II Lecture 8 André van der Hoek."

Similar presentations


Ads by Google