CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 A proposition behind design patterns is that quality of software systems can be.

Slides:



Advertisements
Similar presentations
CS 350 – Software Design The Bridge Pattern – Chapter 10 Most powerful pattern so far. Gang of Four Definition: Decouple an abstraction from its implementation.
Advertisements

©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
COMPSCI 105 S Principles of Computer Science 12 Abstract Data Type.
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.
Data Model driven applications using CASE Data Models as the nucleus of software development in a Computer Aided Software Engineering environment.
The Bridge Pattern.. Intent Decouple an abstraction from its implementation so that the two can vary independently Also known as: Handle/Body.
Introduction To System Analysis and Design
Object-Oriented Metrics. Characteristics of OO ● Localization ● Encapsulation ● Information hiding ● Inheritence ● Object abstraction.
Observer Pattern Fall 2005 OOPD John Anthony. What is a Pattern? “Each pattern describes a problem which occurs over and over again in our environment,
Chapter 3 Data Abstraction: The Walls. © 2005 Pearson Addison-Wesley. All rights reserved3-2 Abstract Data Types Modularity –Keeps the complexity of a.
The Architecture Design Process
Design Patterns CS is not simply about programming
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Chapter 1 Software Development. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 1-2 Chapter Objectives Discuss the goals of software development.
Introduction to Design Patterns (1). “ In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Object-Orientated Design Unit 3: Objects and Classes Jin Sa.
Chapter 22 Object-Oriented Design
Design Patterns Ref : Chapter 15 Bennett et al. useful groups of collaborating classes that provide a solution to commonly occuring problems. provide.
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
Chapter 9 Architecture Alignment. 9 – Architecture Alignment 9.1 Introduction 9.2 The GRAAL Alignment Framework  System Aspects  The Aggregation.
The chapter will address the following questions:
Design Patterns Discussion of pages: xi-11 Sections: Preface, Forward, Chapter
DAAD project “Joint Course on OOP using Java” Design Patterns in the course ‘OOP in Java’ - first experiences Ana Madevska Bogdanova Institute of informatics.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented Design.
Chapter 6 System Engineering - Computer-based system - System engineering process - “Business process” engineering - Product engineering (Source: Pressman,
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
SOFTWARE ENGINEERING BIT-8 APRIL, 16,2008 Introduction to UML.
Design patterns. What is a design pattern? Christopher Alexander: «The pattern describes a problem which again and again occurs in the work, as well as.
Comp2110 Software Design lecture 13Detailed Design (1)  detailed design contrasted with high level design  introducing the Observer Design Pattern 
Session 11 The Class Diagram: Aggregation and Generalization Written by Thomas A. Pender Published by Wiley Publishing, Inc. October 12, 2011 Presented.
Chapter Five An Introduction to Design Patterns Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
“A labor of love” (Multicast Pattern) Chapter 4 (pages or ) Chris Gordon.
Understanding User Requirements. Documenting Use Cases 2 At this stage of the exploration, the participants should be thinking of essential use cases.
Architecture GRASP Realization of use cases in interaction diagrams Design class diagram Design ( how )
ANU COMP2110 Software Design in 2004 Lecture 15Slide 1 COMP2110 in 2004 Software Design Lecture 15: Software design patterns (2) 1What are design patterns?
Patterns and Reuse. Patterns Reuse of Analysis and Design.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
GRASP: Designing Objects with Responsibilities
CS 4850: Senior Project Fall 2014 Object-Oriented Design.
Chapter 17 – Object- Oriented Design. Chapter Goals To learn about the software life cycle To learn about the software life cycle To learn how to discover.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Requirement Engineering Virtusa Training Group 2004 Trainer: Ojitha Kumanayaka Duration : 1 hour.
CS 350 – Software Design Expanding Our Horizons – Chapter 8 The traditional view of objects is that they are data with methods. Sometimes objects could.
More Design Patterns From: Shalloway & Trott, Design Patterns Explained, 2 nd ed.
Design Patterns Introduction
1 Chapter 5:Design Patterns. 2 What are design pattern?  Schematic description of design solution to recurring problems in software design and,  Reusable.
CIS 4910 Information Systems Development Project Project Documentation.
The Last Lecture CS 5010 Program Design Paradigms "Bootcamp" Lesson © Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial.
CSIS 4850: CS Senior Project – Spring 2009 CSIS 4850: Senior Project Spring 2009 Object-Oriented Design.
Chapter Ten The Bridge Pattern Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
CS 350 – Software Design The Adapter Pattern – Chapter 7 Gang of Four Definition: Convert the interface of a class into another interface that the client.
CS 350 – Software Design The Facade Pattern – Chapter 6 Many design patterns are catalogued in the “Gang of Four” text. I find their definitions not to.
Data Abstraction: The Walls
COMP2110 Software Design in lecture 14 Patterns(1) /Detailed Design
Object-Oriented Software Engineering Using UML, Patterns, and Java,
Data Abstraction: The Walls
CMPE 135: Object-Oriented Analysis and Design October 24 Class Meeting
For University Use Only
CS 350 – Software Design The Facade Pattern – Chapter 6
Object-Oriented Design
Beta Release Retrospective
Patterns.
Object oriented analysis and design
CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 A proposition behind design patterns is that quality of software systems can be.
CS 350 – Software Design Principles and Strategies – Chapter 14
Lecture taken from “Design Patterns Explained” by Addison Wesley
CMPE 135 Object-Oriented Analysis and Design March 21 Class Meeting
HFOOAD Chapter 5 Interlude
Presentation transcript:

CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 A proposition behind design patterns is that quality of software systems can be measured objectively. What is present in a good quality design that is not present in a poor quality design? What is present in a poor quality design that is not present in a good quality design? Think about architecture. What makes a good architectural design? Is it subjective or objective? Christopher Alexander studied architecture and noted that there are commonalities in all good designs. Two structures can even be of the same type, both be of high quality, but both serve different purposes, i.e. a porch.

CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 Alexander realized you had to look at comparing structures with the same purpose. i.e. problem of demarking an entryway: Structures look different, but solve the same problem. This lead to the concept of a pattern.

CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 Alexander described a pattern by indicating four items: The name of the pattern The name of the pattern The purpose of the pattern The purpose of the pattern How we could accomplish this How we could accomplish this The constraints and forces we have to consider to accomplish it The constraints and forces we have to consider to accomplish it He also noted: Patterns exist for almost any design problem Patterns exist for almost any design problem Patterns may be combined to solve complex patterns Patterns may be combined to solve complex patterns

CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 What do architectural patterns have to do with software design? Ask yourself two questions: Do problems exist in software that occur over and over again that could be solved in somewhat the same manner? Do problems exist in software that occur over and over again that could be solved in somewhat the same manner? Is it possible to design software in terms of patterns, creating specific solutions based on these patterns? Is it possible to design software in terms of patterns, creating specific solutions based on these patterns? It should be obvious that the answer is yes. I know even before I studied design patterns, it was always easier to build an app from an existing one. Once I figured out things like data connectivity and the details of a development environment, I saw that many programs had to do the same thing. i.e., log in, validate the user, connect to a data source. Almost every program I wrote started the same way. Sounds like a pattern to me.

CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 When we study software design patterns, we will describe them using the following structure: Name: All patterns will have a unique name that identifies them. Intent: The purpose of the pattern. Problem: The problem that the pattern is trying to solve. Solution: How the pattern provides a solution to the problem in the context in which it shows up. Participants and collaborators: The entities involved in the pattern. Consequences: The consequences of using the pattern. Implementation: How the pattern is implemented. Generic Structure: A standard diagram that shows a typical structure for the pattern By using patterns we will be able to reuse our solutions and establish a common terminology.

CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 Here’s a great example of how to discuss a problem at a higher level of abstraction. Imagine two carpenters discuss how to build a drawer for a cabinet. Imagine you are one of them. How would you relay the information about how to build the joint for the drawer? You could describe it as: Well I think we should make the joint by cutting straight up and down into the wood and the cut back up 45 degrees… then going straight back down, and the back the other way 45 degrees, and then going straight back down … Do you know what this is describing? Some of you might know it as a dove tail joint. If that were said right at the beginning, it would have been a lot clearer. This is a perfect example of diving right into the details and not discussing it at the proper level.

CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 Is that the right joint to use thou? Described that way you might never ask. A better start is to ask should be use a dovetail joint or a miter joint? Miter joint

CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 Which joint is better? Depends on the goal. A Miter: Is simpler Is simpler Is Lightweight Is Lightweight Is inconspicuous Is inconspicuous A dovetail is: More complex More complex Stronger and resistant to temperature and humidity Stronger and resistant to temperature and humidity more aesthetically pleasing more aesthetically pleasing independent of a fastening system independent of a fastening system So the question should have been worded differently. Should we use a joint that is expensive to make but is both beautiful and durable, or should we just make a quick and dirty joint that will last as least until the check clears?

CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 Patterns help us communicate better. They help us see the forest and the trees. They improve the modifiability and maintainability of code. Think back to the CAD example. It’s not that the first solution was hard to implement. The pain came when you had to modify it and add another CAD system. Good Rules for OOD are: Deign to Interfaces Deign to Interfaces Favor aggregation over inheritance Favor aggregation over inheritance Find what varies and encapsulate it Find what varies and encapsulate it We will revisit these three rules over and over again. I am especially fond of the last one.

CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 When we study software design patterns, we will describe them using the following structure: Name: All patterns will have a unique name that identifies them. Intent: The purpose of the pattern. Problem: The problem that the pattern is trying to solve. Solution: How the pattern provides a solution to the problem in the context in which it shows up. Participants and collaborators: The entities involved in the pattern. Consequences: The consequences of using the pattern. Implementation: How the pattern is implemented. Generic Structure: A standard diagram that shows a typical structure for the pattern