Conquering Complex and Changing Systems Object-Oriented Software Engineering Art for Chapter 7, Object Design.

Slides:



Advertisements
Similar presentations
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML, Part 4 UML 2 Metamodel.
Advertisements

Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 7, Object Design.
Chapter 7 – Object-Oriented Design
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 7, Object Design.
7.0 OBJECT DESIGN 7.0 Introduction During system analysis – we determine and describe application objects During system design – we describe the subsystems,
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 9, Object Design: Specifying Interfaces.
Object Design: Specifying Interfaces Chapter 9. 2 Object Design  Object design is the process of adding details to the requirements analysis and making.
Mapping Activities Done By: Sara Al-Khulaifi 11/12/2005.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 7, Object Design.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 5: Analysis, Object Modeling.
Conquering Complex and Changing Systems Object-Oriented Software Engineering TJSS System Design Lecture 12 Päivi Ovaska.
Systems Analysis and Design in a Changing World, Fourth Edition
Conquering Complex and Changing Systems Object-Oriented Software Engineering TJSS: Defining persistent data stores, example Päivi Ovaska.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 5: Restaurant.
Chapter 9: Object Design: Specifying Interfaces
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 5, Analysis: Dynamic Modeling.
Software Testing and Quality Assurance
Conquering Complex and Changing Systems Object-Oriented Software Engineering Art for Chapter 5, Analysis.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 8, Object Design: Reuse and Patterns.
Chapter 8, Object Design Introduction to Design Patterns
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Art for Chapter 9, Testing.
Chapter 7, Object Design.
Component and Deployment Diagrams
Implementation Goals: “map” design to clean, efficient code Document any design changes found to be useful Produce code that is correct, modular, understandable,
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 7, Object Design.
1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 1 Object Design  Object design  Detail requirements.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
1 Chapter 5 Implementing UML Specification (Part I) Object-Oriented Technology From Diagram to Code with Visual Paradigm for UML Curtis H.K. Tsang, Clarence.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 1 Introduction to Software Engineering CEN 4010.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Art for Chapter 11, Project Management.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 9, Object Design: Specifying Interfaces.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Art for Chapter 12, Software Life Cycle.
Writing JavaDocs Mimi Opkins CECS 274 Copyright (c) Pearson All rights reserved.
Using UML, Patterns, and Java Object-Oriented Software Engineering Art for Chapter 8, Object Design: Reusing Pattern Solutions.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 4, Requirements Elicitation.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 1 Object Modeling.
111 Protocols CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 8) Meyer, B., Applying design by contract,
Utilities (Part 2) Implementing static features 1.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML: Review Session (Optional)
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML: Review Session (Optional)
Systems Analysis and Design in a Changing World, 3rd Edition
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 9, Object Design: Specifying Interfaces.
The Static Analysis Model Class Diagrams Prof. Hany H. Ammar, CSEE, WVU, and Dept. of Computer Science, Faculty of Computers and Information, Cairo University.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 9, Object Design: Specifying Interfaces.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 1 Few comments about midterm I graded very lightly.
Lecture 18: Object-Oriented Design
Using UML, Patterns, and Java Object-Oriented Software Engineering More on UML Note: Slides are adapted by Linda Sherrell from the Software Engineering.
Using UML, Patterns, and Java Object-Oriented Software Engineering Art for Chapter 1, Introduction to Software Engineering.
Systems Analysis and Design in a Changing World, Fourth Edition
1  lecture slides online
1 Technical & Business Writing (ENG-715) Muhammad Bilal Bashir UIIT, Rawalpindi.
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
Chapter 16: UML Class Diagrams
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
March 1, 2004CS WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004.
Chapter 3: Introducing the UML
CEN th Lecture Advance Software Engineering (CEN-5011) Instructor: Masoud Sadjadi Object Design: Specifying.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Chapter 20 Ordered.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
Oct. 16, 2003CS WPI1 CS 509 Design of Software Systems Lecture #7 Thursday, Oct. 16, 2003.
7 Systems Analysis – ITEC 3155 The Object Oriented Approach – Use Cases.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
Why is Design so Difficult? Analysis: Focuses on the application domain Design: Focuses on the solution domain –The solution domain is changing very rapidly.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 9, Object Design: Specifying Interfaces.
Introduction to Unified Modeling Language (UML)
Chapter 9, Object Design: Specifying Interfaces
Presentation transcript:

Conquering Complex and Changing Systems Object-Oriented Software Engineering Art for Chapter 7, Object Design

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 2 Figure 7-1. Object design closes the gap between application objects identified during requirements and off-the-shelf components selected during system design (stylized UML class diagram). Problem Machine System design gap Object design gap Requirements gap System Application objects Solution objects Custom objects Off-the-shelf components

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 3 Figure 7-2. Activities of object design (UML activity diagram).

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 4 Figure 7-3. Declarations for the Hashtable class (UML class model and Java excerpts). Hashtable +put(key:Object,entry:Object) +get(key:Object):Object +remove(key:Object) +containsKey(key:Object):boolean +size():int -numElements:int class Hashtable { private int numElements; /* Constructors omitted */ public void put (Object key, Object entry) {…}; public Object get(Object key) {…}; public void remove(Object key) {…}; public boolean containsKey(Object key) {…}; public int size() {…}; /* Other methods omitted */ }

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 5 Figure 7-4. Method declarations for the Hashtable class annotated with preconditions, postconditions, and invariants (Java, constraints in the iContract syntax [iContract]). class Hashtable { /* The number of elements in the Hashtable is nonnegative at all times. numElements >= 0 */ private int numElements; /* The put operation assumes that the specified key is not used. * After the put operation is completed, the specified key can be used * to recover the entry with the get(key) operation: !containsKey(key) containsKey(key) get(key) == entry */ public void put (Object key, Object entry) {…}; /* The get operation assumes that the specified key corresponds to an * entry in the Hashtable. containsKey(key) */ public Object get(Object key) {…}; /* The remove operation assumes that the specified key exists in the * Hashtable. containsKey(key) !containsKey(key) */ public void remove(Object key) {…}; /* Other methods omitted */ }

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 6 Figure 7-5. Examples of invariants, preconditions, and postconditions in OCL (UML class diagram). > self.numElements >= 0 HashTable put(key,entry:Object) get(key):Object remove(key:Object) containsKey(key:Object):boolean size():int numElements:int > !containsKey(key) > get(key) == entry > containsKey(key) > !containsKey(key) > containsKey(key)

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 7 Figure 7-6. Map with political boundaries and emission sources (JEWEL, mock-up). Session Layer fader New

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 8 Figure 7-7. Object model for the GIS of JEWEL (UML class diagram). ** ** ** ** ** * * PoliticalLayer WaterLayer RoadLayer HighwaySecondaryRoad RiverLake StateCounty PolyLine Polygon Layer label

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 9 Figure 7-9. Subsystem description for the GIS of JEWEL. JEWEL GIS Purpose store and maintain the geographical information for JEWEL Service creation and deletion of geographical elements (roads, rivers, lakes, and boundaries) organization of elements into layers zooming (selection of points given a level of detail) clipping (selection of points given a bounding box)

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 10 Figure Subsystem decomposition of JEWEL (UML class diagram). Displays geographical and emissions data to the user. Manages simulations and results. Engine for emission simulations. Maintains persistent data, including GIS and emissions data. Manages GIS information for Visualization and EmissionsModeling.

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 11 Figure A sequence diagram for the zoomIn() operation (UML sequence diagram). This sequence diagram leads to the identification of a new class, LayerElement. Because we are focusing on the GIS, we treat the Visualization subsystem as a single object. :EndUser zoomIn(x,y) computeBoundingBox(x,y) *getOutline(r,d) points :Layer:Visualization:LayerElement Newly identified class

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 12 Figure Adding operations to the object model of the JEWEL GIS to realize zooming and clipping (UML class diagram).

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 13 Figure A naive point selection algorithm for the GIS. The left column represents a road crossing and two neighboring counties. The right column shows that road crossings and neighboring counties may be displayed incorrectly when points are not selected carefully. High detailLow detail Two crossing roads Two neighboring counties

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 14 Figure Additional attributes and methods for the Point class to support intelligent point selection and zooming (UML class diagram).

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 15 Figure Adding type information to the object model of the GIS (UML class diagram). Only selected classes shown for brevity. Layer LayerElement +label:String Point +Point(x, y:double) +includeInLevel(level:double) +excludeFromLevel(level:double) +LayerElement(polyline:PolyLine) +getOutline(bbox:Rectangle2D, detail:double):Enumeration +Layer(label:String) detail:double):Enumeration +getOutline(bbox:Rectangle2D, * points * elements -x, y:double -notInDetailLevels:Set -inDetailLevels:Set PolyLine +label:String +PolyLine() +getPoints():Enumeration 1 1 * 1 polyline

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 16 Figure Examples of preconditions and exceptions for the Layer class of the JEWEL GIS.

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 17 Figure JFC components for the JEWEL Visualization subsystem (UML object diagram). Associations denote the containment hierarchy used for ordering the painting of components. We use stereotypes to distinguish JEWEL classes from classes provided by JFC.

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 18 Figure Declaration for drawPolyline() and drawPolygon() operations [JFC, 1999]. // from java.awt package class Graphics { //... void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) {…}; void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) {…}; }

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 19 Figure An example of dynamic site with WebObjects (UML component diagram).

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 20 Figure WebObject’s State Management Classes. The HTTP protocol is inherently stateless. The State Management Classes allow to maintain information between individual requests.

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 21 Figure Realization of a unidirectional, one-to-one association (UML class diagram; arrow denotes the transformation of the object model).

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 22 Figure Realization of a bidirectional one-to-one association (UML class diagram and Java excerpts; arrow denotes the transformation of the object design model).

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 23 Figure 7-22 (continued from previous slide). Realization of a bidirectional one-to-one association (UML class diagram and Java excerpts; arrow denotes the transformation of the object design model). class MapArea extends JPanel { private ZoomInAction zoomIn; /* Other methods omitted */ void setZoomInAction (action:ZoomInAction) { if (zoomIn != action) { zoomIn = action; zoomIn.setTargetMap(this); } class ZoomInAction extends AbstractAction { private MapArea targetMap; /* Other methods omitted */ void setTargetMap(map:MapArea) { if (targetMap != map) { targetMap = map; targetMap.setZoomInAction(this); }

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 24 Figure Realization of a bidirectional, one-to-many association (UML class diagram; arrow denotes the transformation of the object design model).

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 25 Figure Realization of a bidirectional, many-to-many association (UML class diagram; arrow denotes the transformation of the object design model).

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 26 Figure Transformation of an association class into an object and two binary associations (UML class diagram; arrow denotes the transformation of the object design model). Once the model contains only binary associations, each association is realized by using reference attributes and collections of references.

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 27 Figure Realization of a bidirectional qualified association (UML class diagram; arrow denotes the transformation of the object design model). Scenario -runs:Hashtable +elements() +addRun(simname,sr:SimulationRun) +removeRun(simname,sr:SimulationRun) SimulationRun -scenarios:Vector +elements() +addScenario(s:Scenario) +removeScenario(s:Scenario) simname 0..1 * Object design model before transformation Object design model after transformation Scenario SimulationRun

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 28 Figure An example of code reuse with inheritance (UML class diagram).

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 29 Figure AbstractFactory design pattern (UML class diagram, dependencies represent > relationships). This design pattern uses inheritance to support different look and feels (e.g., Motif and Macintosh). If a new specialization is added, the client does not need to be changed.

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 30 Figure An example of implementation inheritance. The left column depicts a questionable implementation of MySet using implementation inheritance. The right column depicts an improved implementation using delegation. (UML class diagram and Java).

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 31 Figure 7-29 (continued from previous slide). An example of implementation inheritance. The left column depicts a questionable implementation of MySet using implementation inheritance. The right column depicts an improved implementation using delegation. (UML class diagram and Java). /* Implementation of MySet using inheritance */ class MySet extends Hashtable { /* Constructor omitted */ MySet() { } void insert(Object element) { if (this.get(element) == null){ this.put(element, this); } boolean contains(Object element){ return (this.get(element)!=null); } /* Other methods omitted */ } /* Implementation of MySet using delegation */ class MySet { Hashtable table; MySet() { table = Hashtable(); } void insert(Object element) { if (table.get(element)==null){ table.put(element,this); } boolean contains(Object element) { return (table.get(element) != null); } /* Other methods omitted */ }

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 32 Figure Alternative representations of a unique identifier for a Person (UML class diagrams).

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 33 Figure Delaying expensive computations using a Proxy pattern (UML class diagram).

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 34 Figure Embedded ODD approach. Class stubs are generated from the object design model. The object design model is then documented as tagged comments in the source code. The initial object design model is abandoned and the ODD is generated from the source code instead using a tool such as Javadoc (UML activity diagram, continued on next slide). RAD Document analysis Analysis Analysis model Object design Initial object design model System design Design goals Subsystem decomposition

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 35 Figure 7-32 (continued from previous slide). Embedded ODD approach. Class stubs are generated from the object design model. The object design model is then documented as tagged comments in the source code. The initial object design model is abandoned and the ODD is generated from the source code instead using a tool such as Javadoc (UML activity diagram). Object design Initial object design model Generate class stubs Initial class stubs ODD Document object design Implementation Commented code

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 36 Figure Interface description of the Layer class using Javadoc tagged comments (Java excerpts). /* The class Layer is a container of LayerElements, each representing a * polygon or a polyline. For example, JEWEL typically has a road layer, a * water layer, a political layer, and an emissions layer. John Smith 0.1 LayerElement Point */ class Layer { /* Member variables, constructors, and other methods omitted */ Enumeration elements() {…}; /* The getOutline operation returns an enumeration of points representing * the layer elements at a specified detail level. The operation only * returns points contained within the rectangle bbox. box The clipping rectangle in universal coordinates detail Detail level (big numbers mean more detail) A enumeration of points in universal coordinates. ZeroDetail ZeroBoundingBox detail > 0.0 and bbox.width > 0.0 and bbox.height > 0.0 forall LayerElement le in this.elements() | * forall Point p in le.points() | * result.contains(p) */ Enumeration getOutline(Rectangle2D bbox, double detail) {…}; /* Other methods omitted */ }

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 37 Figure DetailTable is a global object tracking which Points have been included or excluded from a specified detailLevel. This is an alternative to the inDetailLevels and notInDetailLevels sets depicted in Figure 7-14.