Implementation Model: Mapping Designs to Code

Slides:



Advertisements
Similar presentations
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Advertisements

Object Design Examples with GRASP
Jan 23, Ron McFadyen1 SSD for a samplePOS Use Case Figure 13.1 Input Events invoke a system operation of the same name same idea as in object-oriented.
Sept Ron McFadyen Interaction Diagrams - Chapter 15 Describe/illustrate sequence of message exchanges among objects that are working together.
Oct Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
Oct 22, Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – interfaces,
March Ron McFadyen1 Ch 17: Use Case Realizations with GRASP Patterns Assigning responsibilities to objects to achieve user goals Section 17.4.
Feb R. McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m Function:
Fall 2009AXS-3913 Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
Oct Ron McFadyen1 Ch 17: Use Case Realizations with GRASP Patterns P. 248: “The assignment of responsibilities and design of collaborations.
NJIT 1 Mapping Designs to Code Code example: Hemish Kapadia.
February Ron McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m.
Feb 4, Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – (interfaces,
Feb Ron McFadyen1 Use Case Realizations with GRASP Patterns “The assignment of responsibilities and design of collaborations are very important.
November Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – interfaces,
Object-Oriented Analysis and Design
November Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
Fall 2009ACS-3913 Ron McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Date: 1753 an interpretation.
Feb 4, Ron McFadyen1 founded on principles of good OO design idea was first put forth by Christopher Alexander (1977) in their work concerning.
9/18/011 Software Requirements Analysis and Design (Continued)
Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative Development Part III Elaboration Iteration I – Basic1.
Object-Oriented Design. From Analysis to Design Analysis Artifacts –Essential use cases What are the problem domain processes? –Conceptual Model What.
Chapter 2.1 Iterative, Evolutionary, and Agile. Introduction We will look at Agile Modeling, UML, and iterative and evolutionary development. We will.
GRASP Pattern Zhen Jiang West Chester University
Chapter 18 Object Design Examples with GRASP. Objectives Design use case realizations –A use-case realization describes how a particular use case is realized.
1 Ch 18. Object Design Examples With Grasp Objectives Design use case realizations. Apply GRASP to assign responsibilities to classes. Apply UML to illustrate.
Chapter 7: Object Design Examples with GRASP. Objective Design use case realizations. Apply GRASP to assign responsibilities to classes. Apply UML to.
1 Unified Modelling Language OOA/OOD a summary of the book: Applying UML and Patterns, Craig Larman D. Dranidis October 2000 CITY College.
GRASP: Designing Objects With Responsibilities Chapter 17 Applying UML and Patterns -Craig Larman.
Chapter 18 Object Design Examples with GRASP 1CS6359 Fall 2011 John Cole.
Object Design Examples with GRASP (Ch. 18)
BTS430 Systems Analysis and Design using UML Interaction Diagrams.
Object-Oriented Analysis and Design 1 Mira Balaban & Arnon Sturm Object-Oriented Analysis and Design Session 4: Object-Oriented Software Construction.
1 Lecture 6: Operation Contracts. 2 Overview  What is contract ?  The guidelines for writing contracts for the system operations.  Use Case realizations.
Design Class Diagrams (DCDs)
NJIT UML Class Diagrams Chapter 16 Applying UML and Patterns Craig Larman.
Operation Contracts. Primary way to describe system behavior is with use cases Operation contracts provide more details in terms of state changes to objects.
Fall 2009ACS-3913 Ron McFadyen1 Use Case Realizations with GRASP Patterns “The assignment of responsibilities and design of collaborations are very important.
Chapter 2.2 Iterative, Evolutionary, and Agile A Continuation.
GRASP: Designing Objects With Responsibilities
OO Methodology Elaboration Phase Iteration 1- Part 3.
Design. 2 The Need for Software Blueprints Knowing an object-oriented language and having access to a library is necessary but not sufficient in order.
1 Chapter 9: Operation Contracts Chapter 13 in Applying UML and Patterns Book.
TK2023 Object-Oriented Software Engineering CHAPTER 11 CLASS DIAGRAMS.
Use-Case Model: Adding Detail with Operation Contracts.
1 Design Model Use-Case realizations with GRASP Larman chapter 17.
Oct 3, Ron McFadyen1 GRASP Patterns 1.Expert 2.Creator 3.Controller 4.Low Coupling 5.High Cohesion.
INFO 620Lecture #101 Information Systems Analysis and Design Implementation Concerns, Review INFO 620 Glenn Booker.
1 Object Oriented Analysis and Design System Events & Contracts.
Design Model: Determining Visibility CH-18. Objectives Identify four kinds of visibility. Design to establish visibility. Illustrate kinds of visibility.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
OO Methodology Elaboration Phase Iteration 1- Part 2.
Ch 17: Use Case Realizations with GRASP Patterns
Mapping Designs to Code. It specify how to map the design into object oriented language The UML artifacts created during the design work, the interaction.
Object Design Examples with GRASP
TK2023 Object-Oriented Software Engineering
UML Interaction Diagrams
GRASP: Visibility and Design
Conception OBJET GRASP Patterns
CONTENTS Object-Oriented Modeling Using UML
DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS
Presentation on GRASP Patterns Submitted by
Chapter 10: Visibility Chapter 18 in Applying UML and Patterns Book.
UML & Programming Martin Fowler.
Chapter 11: Class Diagram
CONTENTS Object-Oriented Modeling Using UML
Operation Contracts Ch. 11.
Domain Model: Visualizing Concepts
Chapter 11: Class Diagram
Design Model: Creating Design Class Diagrams
Presentation transcript:

Implementation Model: Mapping Designs to Code Ch. 20

Defining a Class with Methods and Simple Attributes public class SalesLineItem { private int quantity; public SalesLineItem(ProductSpecification spec, int, qty) {...} public Money getSubtotal() {…} … } ProductSpecification description : Text price : Money itemID : ItemID SalesLineItem * Described-by 1 quantity : Integer getSubtotal():Money

Adding Reference Attributes public class SalesLineItem { private int quantity; private ProductSpecification productSpec; // reference attribute … } ProductSpecification description : Text price : Money itemID : ItemID SalesLineItem * Described-by 1 quantity : Integer getSubtotal():Money

Reference Attributes and Role Names public class SalesLineItem { private int quantity; private ProductSpecification productSpec; … } ProductSpecification description : Text price : Money itemID : ItemID SalesLineItem * Described-by 1 quantity : Integer productSpec getSubtotal():Money

Creating Methods from Interaction Diagrams addLineItem(itemID, quantity) 2 : makeLineItem(spec, quantity) :Register 1:spec := getSpecification(itemID) :Sale :ProductCatalog 1.1:spec := find(itemID) 2.2 : add(sli) 2.1 : create(spec, quantity) :ProductSpecification sli:SalesLineItem :SalesLineItem

The Register – addLineItem method The addLineItem collaboration diagram will be used to illustrate the Java definition of the addLineItem method. In which class does addLineItem belong to? The addLineItem message is sent to a Register instance, therefore the addLineItem method is defined in class Register. public void addLineItem(itemID itemID, int quantity); Message 1. A getSpecification message is sent to the productCatalog to retrieve a productSpecification productSpecification spec = catalog.getSpecification(itemID); Message 2: The makeLineItem message is sent to the Sale. sale.makeLineItem(spec, quantity);

A Skeletal definition of Register Class public class Register { private productCatalog catalog; private Sale sale; public Register (ProductCatalog pc) {…} public void endSale(); public void addLineItem (ItemID itemID, int quantity); public void makeNewSale() {…} public void makePayment (Money cashTendered) {…} } ProductCatalog getSpecification() 1 Looks-in 1 Sale becomeComplete() makeLineItem() makePayment() getTotal() Date : Date isComplete : Boolean time : Time Register Captures 1 1 endSale() addLineItem() makeNewSale() makePayment()

Container/Collection Classes in Code Sale Date : Date isComplete : Boolean time : Time SalesLineItem Contains quantity : Integer 1 1 .. * getSubtotal():Money becomeComplete() makeLineItem() makePayment() getTotal() A container class is necessary to maintain attribute visibility to all the SalesLineItem instances. Vector is an example of a dynamic data structure. public class Sale { . . . private Vector lineItems; }