ANU COMP2110 Software Design in 2004 Lecture 15Slide 1 COMP2110 in 2004 Software Design Lecture 15: Software design patterns (2) 1What are design patterns?

Slides:



Advertisements
Similar presentations
ANU COMP2110 Software Design in 2003 Lecture 16Slide 1 Lecture 16: Introduction to design patterns 1What are they? 2Where do they come from? 3Why study.
Advertisements

Design Patterns CMPS Design Patterns Consider previous solutions to problems similar to any new problem ▫ must have some characteristics in common.
Design Patterns Yes, they are important Robert Cotton April 23, 2009.
Fundamentals of Software Development 1Slide 1 Gang of Four The beginnings… The original “patterns” idea was from architecture – there are repeatable patterns.
(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.
Dept. of Computer Engineering, Amirkabir University of Tech. 1 Design Patterns Dr. Noorhosseini Introduction.
Design Patterns CS is not simply about programming
Design Patterns Daniel McClain. Background What are they?  Way of recording solutions to recurring design problems History  “A Pattern Language: Towns,
Introduction to Design Patterns (1). “ In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software.
Design Patterns. What are design patterns? A general reusable solution to a commonly occurring problem. A description or template for how to solve a problem.
Ralph Johnson - University of Illinois1 Patterns: What They Are, and How to Write Them Ralph Johnson University of Illinois at Urbana-Champaign
CISC 879 : Software Support for Multicore Architectures John Cavazos Dept of Computer & Information Sciences University of Delaware
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Design Patterns.
(c) 2010 University of California, Irvine – André van der Hoek1June 29, 2015 – 08:55:05 Informatics 122 Software Design II Lecture 8 André van der Hoek.
Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 Design Patterns: someone has already.
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
1 PH Chapter 1 (pp. 1-10) GoF Composite Pattern (pp ) PH Ch 2 through Fundamentals (pp ) Presentation by Julie Betlach 5/28/2009.
Design Patterns Alan Shalloway, James Trott, Design Patterns Explained, Addison-Wesley, Gamma, Helm, Johnson, Vlissides, Design Patterns, Elements.
Design Patterns Trends and Case Study John Hurst June 2005.
Chapter 7 GRASP patterns Dr Seham Mostefai CAP 252.
Introduction to Design Patterns (1). Definition: “ In software engineering, a design pattern is a general reusable solution to a commonly occurring problem.
Comp2110 Software Design lecture 13Detailed Design (1)  detailed design contrasted with high level design  introducing the Observer Design Pattern 
CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 A proposition behind design patterns is that quality of software systems can be.
Chapter Five An Introduction to Design Patterns Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information.
January 12, Introduction to Design Patterns Tim Burke References: –Gamma, Erich, et. al. (AKA, The Gang of Four). Design Patterns: Elements of Reusable.
Creational Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Patterns in programming 1. What are patterns? “A design pattern is a general, reusable solution to a commonly occurring problem in software. A design.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 27. Review UML dynamic view – State Diagrams.
CS 325: Software Engineering February 12, 2015 Applying Responsibility-Assignment Patterns Design Patterns Situation-Specific Patterns Responsibility-Assignment.
A Reference Model for Event Patterns Christian Silberbauer
Patterns and Reuse. Patterns Reuse of Analysis and Design.
Object-Oriented Design Principles and Patterns. © 2005, James R. Vallino2 How Do You Design? What principles guide you when you create a design? What.
Design Patterns Introduction What is a Design Pattern? Why were they developed? Why should we use them? How important are they?
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
CSE 403 Lecture 14 Design Patterns. Today’s educational objective Understand the basics of design patterns Be able to distinguish them from design approaches.
How Would You Solve This? l Suppose that you want to have one and only one instance of a class – Can you think of ever only wanting one instance of a class?
Design Patterns Introduction General and reusable solutions to common problems in software design SoftUni Team Software University
1 Design Patterns Object-Oriented Design. 2 Design Patterns 4Reuse of design knowledge and experience 4Common in many engineering disciplines 4Avoids.
Design Patterns: Elements of Reusable Object- Orientated Software Gamma, Helm, Johnson, Vlissides Presented By: David Williams.
Design Patterns. 1 Paradigm4 Concepts 9 Principles23 Patterns.
CS251 – Software Engineering Lectures 18: Intro to DP Slides by Rick Mercer, Christian Ratliff, Oscar Nierstrasz and others 1 و ابتغ فيما آتاك الله الدار.
Patterns Composite Pattern. Patterns All designers use patterns. Patterns in solutions come from patterns in problems. "A pattern is a solution to a problem.
Design Patterns in Context ©SoftMoore ConsultingSlide 1.
Duke CPS Programming Heuristics l Identify the aspects of your application that vary and separate them from what stays the same ä Take what varies.
1 Good Object-Oriented Design Dr. Radu Marinescu Lecture 4 Introduction to Design Patterns.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Design Patterns: MORE Examples
COMP2110 Software Design in lecture 14 Patterns(1) /Detailed Design
The Object-Oriented Thought Process Chapter 15
MPCS – Advanced java Programming
Introduction to Design Patterns
Design Patterns Introduction
Design Patterns.
CMPE 135: Object-Oriented Analysis and Design October 24 Class Meeting
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
08/15/09 Design Patterns James Brucker.
Informatics 122 Software Design II
Beta Release Retrospective
Pattern-Oriented Cluster: Comp 630/650/655
Pattern-Oriented Cluster: Comp 630/650/655
CSE 403 Software Design.
DESIGNING YOUR SYSTEM.
CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 A proposition behind design patterns is that quality of software systems can be.
DESIGN PATTERNS : Introduction
CS 350 – Software Design Principles and Strategies – Chapter 14
Pattern-Oriented Cluster: Comp 630/650/655
CMPE 135 Object-Oriented Analysis and Design March 21 Class Meeting
Design Patterns Imran Rashid CTO at ManiWeber Technologies.
Informatics 122 Software Design II
Presentation transcript:

ANU COMP2110 Software Design in 2004 Lecture 15Slide 1 COMP2110 in 2004 Software Design Lecture 15: Software design patterns (2) 1What are design patterns? 2Where do they come from? 3Why study them? 4What are they again? 5More thoughts: Abstraction Don’t reinvent the wheel Consequences

ANU COMP2110 Software Design in 2004 Lecture 15Slide 2 What are design patterns? First, some examples of what they are not: adjustable templates like dress patterns as in “pattern matching”, like regexps repeated motifs like in art or music, e.g. Islamic decorative art harpsichord cadenza from the 5th Brandenburg concerto jazz riffs

ANU COMP2110 Software Design in 2004 Lecture 15Slide 3 So what are design patterns? Examples of reusable, excellent object-oriented software design, together with the context in which each one applies the problem it tries to solve the forces at work the consequences of adopting it hints for implementation

ANU COMP2110 Software Design in 2004 Lecture 15Slide 4 What is the origin of design patterns? Started in architecture with the work of Christopher Alexander and his group at Berkeley. He asked: What makes great buildings great and awful buildings awful? When great buildings can be so different, what do they have in common? He looked very hard for examples and principles, working at a very subtle level Looked at different ways to solve the same problem Came up with a whole system for design

ANU COMP2110 Software Design in 2004 Lecture 15Slide 5 What does this have to do with software? In the early 90’ssome software people read Alexander’s work and saw a parallel The same problems occur again and again and can be solved the same way These examples of partial designs can be reused at the level of ideas, not of code Gamma, Helm, Johnson & Vlissides wrote the “Gang of Four” book An explosion of interest and activity since then

ANU COMP2110 Software Design in 2004 Lecture 15Slide 6 Why study design patterns? To learn some examples of great design that you can use To create a common vocabulary for talking about design To help you think about design at a higher level of abstraction To learn from them, so that you can apply the same principles to create great designs of your own

ANU COMP2110 Software Design in 2004 Lecture 15Slide 7 What is a design pattern again? A solution to a problem in a context Example: The Observer pattern Context: Many objects, of varying number and different types, depend on another object and need to stay synchronised with it. Problem: How to manage that without having to change all the code every time a new type of observer comes along. Solution: See previous lecture, textbook, GoF book

ANU COMP2110 Software Design in 2004 Lecture 15Slide 8 Clock display using observer pattern main driver loop: loop t = system.clock_time() for all zc in clocks do zcv.update_timer(t) this.suspend(interval) end loop update_timer(time t) is zoned_time =t+zone_offset for all cd in displays do cd.redisplay() end update_timer analogue redisplay() is dt = master.get_time h_angle = 360*hours(dt)/12 etc. etc.

ANU COMP2110 Software Design in 2004 Lecture 15Slide 9 More thoughts: Abstraction Abstraction is about choosing what details to leave out Just keep the important ones To understand and apply design patterns well, you have to learn to do this How hard or easy this is for you depends on your personality type

ANU COMP2110 Software Design in 2004 Lecture 15Slide 10 More thoughts: Don’t reinvent the wheel Name: Wheel Intent: Transport heavy loads long distances Problem: They’re hard to carry, but it’s really important to move stuff like food around Solution: Build vehicles with wheels, and smooth roads for them to run on Consequences: Greatly increased capacity and speed. Need roads. Control of roads = power... Implementation: Another time... Alternatives: Carry it, drag it, use a boat or barge

ANU COMP2110 Software Design in 2004 Lecture 15Slide 11 More thoughts: Consequences Need to think in terms of cause and effect There is no absolute good and bad, only choices and their consequences In software we measure quality against requirements (and meta-requirements like extendability and reusability that often aren’t written down) When you make design decisions, look at the practical consequences Using a pattern isn’t always a good decision!

ANU COMP2110 Software Design in 2004 Lecture 15Slide 12 More thoughts: Principles Prefer composition over inheritance Find what varies and encapsulate it Improve modifiability