Stoop 430-design patternsintro

890 views
805 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
890
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
29
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Stoop 430-design patternsintro

  1. 1. An Introduction to Design Patterns
  2. 2. Goal <ul><li>What are patterns? </li></ul><ul><li>Why? </li></ul><ul><li>Patterns are not god on earth </li></ul><ul><li>Example </li></ul>
  3. 3. Design Patterns <ul><li>Design patterns are recurrent solutions to design problems </li></ul><ul><li>They are names </li></ul><ul><ul><li>Composite, Visitor, Observer... </li></ul></ul><ul><li>There are pros and cons </li></ul>
  4. 4. <ul><li>Christoffer Alexander </li></ul><ul><ul><li>“The Timeless Way of Building”, Christoffer Alexander, Oxford University Press, 1979, ISBN 0195024028 </li></ul></ul><ul><li>More advanced than what is used in computer science </li></ul><ul><ul><li>only the simple parts got used. </li></ul></ul><ul><ul><li>pattern languages were skipped. </li></ul></ul>From Architecture
  5. 5. Why Patterns? <ul><li>Elegant solutions that a novice would not think of </li></ul><ul><li>Generic </li></ul><ul><ul><li>Independent on specific system type, language </li></ul></ul><ul><li>Well-proven </li></ul><ul><ul><li>Successfully tested in several systems </li></ul></ul><ul><li>Simple </li></ul><ul><ul><li>Combine them for more complex solutions </li></ul></ul><ul><li>There are really stupid patterns (supersuper) in some books so watch out!!! </li></ul>
  6. 6. <ul><li>Reusable solutions to common problems </li></ul><ul><li>based on experiences from real systems </li></ul><ul><li>Names of abstractions above class and object level </li></ul><ul><li>a common vocabulary for developers </li></ul><ul><li>Handling of functional and non-functional aspects </li></ul><ul><ul><li>separating interfaces/implementation, loose coupling between parts, … </li></ul></ul><ul><li>A basis for frameworks and toolkits </li></ul><ul><li>basic constructs to improve reuse </li></ul><ul><li>Education and training support </li></ul>Patterns provide...
  7. 7. <ul><li>Pattern name </li></ul><ul><li>Increase of design vocabulary </li></ul><ul><li>Problem description </li></ul><ul><li>When to apply it, in what context to use it </li></ul><ul><li>Solution description (generic !) </li></ul><ul><li>The elements that make up the design, their relationships, responsibilities, and collaborations </li></ul><ul><li>Consequences </li></ul><ul><li>Results and trade-offs of applying the pattern </li></ul>Elements in a Pattern
  8. 8. Example <ul><li>The composite pattern... </li></ul><ul><li>Open the other file :) </li></ul>
  9. 9. Patterns...
  10. 10. <ul><li>Creational Patterns </li></ul><ul><ul><li>Instantiation and configuration of classes and objects </li></ul></ul><ul><li>Structural Patterns </li></ul><ul><ul><li>Usage of classes and objects in larger structures, separation of interfaces and implementation </li></ul></ul><ul><li>Behavioral Patterns </li></ul><ul><ul><li>Algorithms and division of responsibility </li></ul></ul><ul><li>Concurrency </li></ul><ul><li>Distribution </li></ul><ul><li>Security </li></ul>Categories of Design Patterns
  11. 11. Some Creational Patterns <ul><li>Abstract factory </li></ul><ul><li>Builder </li></ul><ul><li>Factory Method </li></ul><ul><li>Prototype </li></ul><ul><li>Singleton </li></ul>
  12. 12. Some Structural Patterns <ul><li>Adapter </li></ul><ul><li>Bridge </li></ul><ul><li>Composite </li></ul><ul><li>Decorator </li></ul><ul><li>Façade </li></ul><ul><li>Flyweight </li></ul><ul><li>Proxy </li></ul>
  13. 13. Some Behavioral Patterns <ul><li>Chain of responsibility </li></ul><ul><li>Command </li></ul><ul><li>Interpreter </li></ul><ul><li>Iterator </li></ul><ul><li>Mediator </li></ul><ul><li>Memento </li></ul><ul><li>Observer </li></ul><ul><li>State </li></ul><ul><li>Strategy </li></ul><ul><li>Template Method </li></ul><ul><li>Visitor </li></ul>
  14. 14. Alert!!! Design Patterns are invading <ul><li>Design Patterns may be a real plague ! </li></ul><ul><li>Do not apply them when you do not need them </li></ul><ul><li>Design Patterns make the software more complex </li></ul><ul><ul><li>More classes </li></ul></ul><ul><ul><li>More indirections, more messages </li></ul></ul><ul><li>Try to understand when NOT applying them! </li></ul>
  15. 15. About Pattern Implementation <ul><li>This is POSSIBLE implementation not a definitive one </li></ul><ul><li>Do not confuse structure and intent!!! </li></ul><ul><li>Patterns are about INTENT and TRADEOFFS </li></ul>
  16. 16. Source
  17. 17. Wrap-up <ul><li>Patterns are names </li></ul><ul><li>Patterns are about tradeoffs </li></ul><ul><li>Know when not to apply them </li></ul>

×