Week 4 MondayTuesdayWednesdayThursdayFriday Composition Reading III due Group meetings Phil Kimmey on using rover.com SDS++ due Midterm review –

Slides:



Advertisements
Similar presentations
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
Advertisements

1 OBJECT-ORIENTED CONCEPTS. 2 What is an object?  An object is a software entity that mirrors the real world in some way.  A software object in OOP.
Visibility Larman, Chapter 19 (with ideas from George Blank of NJIT) CSE432 Object Oriented Software Engineering.
Object-Oriented Design Patterns Composite Singleton State Observer … Autumn 2012UCN Technology: IT/Computer Science1.
Unified Modeling Language
Classes and Object- Oriented... tMyn1 Classes and Object-Oriented Programming The essence of object-oriented programming is that you write programs in.
Chapter 6: Using Design Patterns
Families of Software Systems Notkin: 3 of 3 lectures on change.
Patterns Lecture 2. Singleton Ensure a class only has one instance, and provide a global point of access to it.
Design Patterns CS is not simply about programming
Introduction to Design Patterns (1). “ In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software.
March R McFadyen1 GoF (Gang of Four): Gamma, Johnson, Helm & Vlissides Book: Design Patterns: Elements of Reusable Object-Oriented Software.
Data Abstraction and Object- Oriented Programming CS351 – Programming Paradigms.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
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.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Introduction SWE 619. Why Is Building Good Software Hard? Large software systems enormously complex  Millions of “moving parts” People expect software.
Design Patterns.
Chapter 3 Introduction to Collections – Stacks Modified
Design Dan Fleck CS 421 George Mason University. What is the design phase? Analysis phase describes what the system should do Analysis has provided a.
Introduction to Design Patterns (1). Definition: “ In software engineering, a design pattern is a general reusable solution to a commonly occurring problem.
Introductory Software Engineering with a Focus on Dependency Management Christine Hofmeister.
CS 350 – Software Design The Object Paradigm – Chapter 1 If you were tasked to write code to access a description of shapes that were stored in a database.
CSSE 374: Introduction to Gang of Four Design Patterns
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
DaveAndAl.net Do Application Design Patterns Make Sense in ASP.NET? Alex Homer You may like to write these down now...
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.
CSE 331 SOFTWARE DESIGN & IMPLEMENTATION MIDTERM REVIEW Autumn 2011.
Week 3-4 MondayTuesdayWednesdayThursdayFriday Design Reading II due Group meetings SRS due DesignUMLDesign Progress report due Lecture TBA Reading III.
Chapter 2 Introducing Interfaces Summary prepared by Kirk Scott.
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 6: Using Design Patterns.
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
Design Patterns Gang Qian Department of Computer Science University of Central Oklahoma.
 What is Modeling What is Modeling  Why do we Model Why do we Model  Models in OMT Models in OMT  Principles of Modeling Principles of Modeling 
Singleton and Basic UML CS340100, NTHU Yoshi. What is UML Unified Modeling Language A standardized general-purpose modeling language in the field of software.
Design Principle & Patterns by A.Surasit Samaisut Copyrights : All Rights Reserved.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Introduction to Software Architecture.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
The Singleton Pattern SE-2811 Dr. Mark L. Hornick 1.
Design Pattern. Definition: A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
Software Design Patterns Curtsy: Fahad Hassan (TxLabs)
Advanced Object-Oriented Design Patterns and Architectures Part One COEN396A John Xiao
Final Review. From ArrayLists to Arrays The ArrayList : used to organize a list of objects –It is a class in the Java API –the ArrayList class uses an.
Design Reuse Earlier we have covered the re-usable Architectural Styles as design patterns for High-Level Design. At mid-level and low-level, design patterns.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 6: Using Design Patterns.
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
Session 3 How to Approach the UML Written by Thomas A. Pender Published by Wiley Publishing, Inc. October 5, 2011 Presented by Kang-Pyo Lee.
Design Patterns in Context ©SoftMoore ConsultingSlide 1.
Advanced Object-oriented Design Patterns Creational Design Patterns.
The Singleton Pattern (Creational)
Overview of Creational Patterns ©SoftMoore ConsultingSlide 1.
From Use Cases to Implementation 1. Structural and Behavioral Aspects of Collaborations  Two aspects of Collaborations Structural – specifies the static.
From Use Cases to Implementation 1. Mapping Requirements Directly to Design and Code  For many, if not most, of our requirements it is relatively easy.
1 Lecture Material Design Patterns Visitor Client-Server Factory Singleton.
The Object-Oriented Thought Process Chapter 15
GoF Patterns (GoF) popo.
MPCS – Advanced java Programming
Advanced Programming Behnam Hatami Fall 2017.
Software Engineering Lecture 7 - Design Patterns
Object Oriented Design Patterns - Creational Patterns
CSE403 Software Engineering Autumn 2000 Design (Overview)
Design Patterns Imran Rashid CTO at ManiWeber Technologies.
UML  UML stands for Unified Modeling Language. It is a standard which is mainly used for creating object- oriented, meaningful documentation models for.
Presentation transcript:

Week 4 MondayTuesdayWednesdayThursdayFriday Composition Reading III due Group meetings Phil Kimmey on using rover.com SDS++ due Midterm review – content, format Progress report due CSE403 ● Software engineering ● sp12

Today Orthogonality in design: when, if ever, can we use multiple good design ideas simultaneously? Ex: generic collections in Java –Abstraction over the details of the collection (array, list, hashtable, etc.) –Separate abstraction over the values – that is, the type of the elements This kind of orthogonality is very powerful CSE403 Sp122

Layering in one slide Used in part for program families, systems that have “so much in common that it pays to study their common aspects before looking at the aspects that differentiate them” [Parnas 1979] –For example, Microsoft operating systems, a number of the Mozilla systems, … Another kind of dependence useful for families –A module A uses a module B if the correctness of A depends on the presence of a correct version of B A non-hierarchical uses relation makes it difficult to produce useful subsets of a system CSE403 Sp123 ipAddr := cache(hostName); if wrong(ipAddr,hostName) ipAddr := lookup(hostName) endif uses and invokes dependences often but do not always coincide Invocation without use: name service with cached hints Use without invocation: examples?

ADTs and layering interact? Information hiding modules (say, ADTs in this case) and layers are distinct concepts How and where do they overlap in a system? Are they orthogonal? 4 What kinds of secrets (potential changes)? What kinds of families? Extra credit Layers ADTs

Composition: Michael Jackson Jackson observes that we sometimes overvalue the notion of hierarchical decomposition –The world itself does not have strict typing and inheritance hierarchies He argues that the CMYK printing is a better analogy for software composition at many levels CSE403 Sp125

Design patterns What are they? Why are they? CSE403 Sp126 Following slides from 331 au11 It’ll probably be a whirlwind

What is a design pattern?  A standard solution to a common programming problem  a design or implementation structure that achieves a particular purpose  a high-level programming idiom  A technique for making code more flexible  reduce coupling among program components  Shorthand for describing program design  a description of connections among program components (static structure)  the shape of a heap snapshot or object model (dynamic structure)

Why design patterns? UW CSE331 Autumn 2011  Advanced programming languages like Java provide lots of powerful constructs – subtyping, interfaces, rich types and libraries, etc.  By the nature of programming languages, they can’t make everything easy to solve  To the first order, design patterns are intended to overcome common problems that arise in even advanced object-oriented programming languages  They increase your vocabulary and your intellectual toolset

No programming language is, or ever will be, perfect. Extra-language solutions (tools, design patterns, etc.) are needed as well. Perlis: “When someone says ‘I want a programming language in which I need only say what I wish done,’ give him a lollipop.” From a colleague UW CSE331 Autumn 2011  FML. Today I got to write (in Java): import java.util.Set; import com.google.common.base.Function; import com.google.common.collect.DiscreteDomains; import com.google.common.collect.Iterables; import com.google.common.collect.Ranges; final int x =...; Set indices = Ranges.closed(0, size).asSet(DiscreteDomains.integers()); Iterable coords = Iterables.transform(indices, new Function (){ public Coord apply (Integer y) { return new Coord(x, y); } } ); when I wanted to write (in Scala): val x =...; val coords = 0 to size map(Coord(x, _))

Whence design patterns? UW CSE331 Autumn 2011  The Gang of Four (GoF)  – Gamma, Helm, Johnson, Vlissides   Each an aggressive and thoughtful programmer  Empiricists, not theoreticians  Found they shared a number of “tricks” and decided to codify them – a key rule was that nothing could become a pattern unless they could identify at least three real examples My first experience with patterns at Dagstuhl  with Helms and Vlissides 

P atterns vs. patterns UW CSE331 Autumn 2011  The phrase “pattern” has been wildly overused since the GoF patterns have been introduced  “pattern” has become a synonym for “[somebody says] X is a good way to write programs.”  And “anti-pattern” has become a synonym for “[somebody says] Y is a bad way to write programs.”  A graduate student recently studied so-called “security patterns” and found that very few of them were really GoF-style patterns  GoF-style patterns have richness, history, language- independence, documentation and thus (most likely) far more staying power

An example of a GoF pattern UW CSE331 Autumn 2011  Given a class C, what if you want to guarantee that there is precisely one instance of C in your program? And you want that instance globally available?  First, why might you want this?  Second, how might you achieve this?

Possible reasons for Singleton UW CSE331 Autumn 2011  One RandomNumber generator  One Restaurant, one ShoppingCart  One KeyboardReader, etc…  Make it easier to ensure some key invariants  Make it easier to control when that single instance is created – can be important for large objects  …

Several solutions UW CSE331 Autumn 2011 public class Singleton { private static final Singleton instance = new Singleton(); // Private constructor prevents // instantiation from other classes private Singleton() { } public static Singleton getInstance() { return instance; } } public class Singleton { private static Singleton _instance; private Singleton() { } public static synchronized Singleton getInstance() { if (null == _instance) { _instance = new Singleton(); } return _instance; } } Eager allocation of instance Lazy allocation of instance And there are more (in EJ, for instance)

Abstract Factory Pattern wikipedia stackoverflow …and who knows where?! CSE403 Sp1215

Points to make Lots of different kinds of dependences Composition of different design/abstraction mechanisms can be extraordinarily powerful –So increasing your understanding of powerful mechanisms and patterns will surely help simplify your design over time –This in turn may well increase some form of conceptual integrity CSE403 Sp1216

CSE403 ● Software engineering ● sp12 Week 3-4 MondayTuesdayWednesdayThursdayFriday Composition Reading III due Group meetings Phil Kimmey on using rover.com SDS++ due Midterm review – content, format Progress report due