Chapter 11: Class Diagram

Slides:



Advertisements
Similar presentations
Object Design Examples with GRASP
Advertisements

UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
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.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
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.
Sharif University of Technology1 Design and Use-case Realization Software Engineering Laboratory Fall 2006.
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.
PRJ566: PROJECT PLANNING AND MANAGEMENT Class Diagrams.
Designing with Interaction and Design Class Diagrams Chapters 15 & 16 Applying UML and Patterns Craig Larman With some ideas from students in George Blank’s.
Object-Oriented Analysis and Design
Objectives Design Class Diagrams Issues in system design Generalization Review UML papers.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 1 Introduction to Object-Oriented Programming and.
Chapter 7: Object Design Examples with GRASP. Objective Design use case realizations. Apply GRASP to assign responsibilities to classes. Apply UML to.
Lab 04.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
1 Lecture 6: Operation Contracts. 2 Overview  What is contract ?  The guidelines for writing contracts for the system operations.  Use Case realizations.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
Design Class Diagrams (DCDs)
Chapter 16 Applying UML and Patterns Craig Larman
Class diagram Used for describing structure and behaviour in the use cases Provide a conceptual model of the system in terms of entities and their relationships.
NJIT UML Class Diagrams Chapter 16 Applying UML and Patterns Craig Larman.
SYS466: Analysis and Design Using OO Models Domain Class Diagram.
BCS 2143 Object Oriented Design Using UML. Objectives Objects Interactions Finding Classes Relationship Between Classes Attribute and Operation Class.
Object-Oriented Analysis and Design CHAPTERS 9, 31: DOMAIN MODELS 1.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
OO Methodology Elaboration Phase Iteration 1- Part 3.
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.
BTS430 Systems Analysis and Design using UML Design Class Diagrams (ref=chapter 16 of Applying UML and Patterns)
Oct 3, Ron McFadyen1 GRASP Patterns 1.Expert 2.Creator 3.Controller 4.Low Coupling 5.High Cohesion.
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.
1 Chapter 13: Class Diagram Chapter 19 in Applying UML and Patterns Book.
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-Class Diagrams. UML-Class Diagrams Order placement problem A Company has two types of customers, corporate customers and personal customers. All.
Chapter 9 Domain Models.
OBJECT ORIENTED CONCEPT
Domain Model: Visualizing concepts
GRASP: Visibility and Design
Conception OBJET GRASP Patterns
Chapter 6: Structured Vs. Object Oriented Analysis and Design.
Chapter 5: Object Oriented Analysis and Design
OO Domain Modeling With UML Class Diagrams and CRC Cards
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
OO Domain Modeling With UML Class Diagrams and CRC Cards
Introduction to UML Introduction to UML Shiyuan Jin September,23,2002
UML Class Diagrams: Basic Concepts
Domain Class Diagram Chapter 4 Part 2 pp
Chapter 10: Visibility Chapter 18 in Applying UML and Patterns Book.
Software Engineering Lecture #11.
UML Class Diagram.
Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book
Chapter 11: Class Diagram
Sample Test Questions Please identify the use cases of the system that cover all the behaviors described in the system specification. Please identify.
Chapter 22 Object-Oriented Systems Analysis and Design and UML
Chapter 16 UML Class Diagrams
Object Oriented System Design Class Diagrams
Implementation Model: Mapping Designs to Code
Operation Contracts Ch. 11.
Domain Model: Visualizing Concepts
Design Model: Creating Design Class Diagrams
Presentation transcript:

Chapter 11: Class Diagram Chapter 19 in Applying UML and Patterns Book.

Overview What is Class Diagram? The different between Domain Model and Design Model. How to build UML Class Diagram (Class, Attribute, Relationship).

What is Class Diagram ? A class diagram shows the existence of classes and their relationships in the logical view of a system. UML modeling elements in class diagrams: Classes and their structure and behavior. Association, aggregation, dependency, and inheritance relationships. Multiplicity and navigation indicators. Role names.

Dependency Dependency Dependency means “One class uses the other” A dependency relationship indicates that a change in one class may effect the dependent class, but not necessarily the reverse. A dependency relationship is often used to show that a method has object of a class as arguments. Basic Class Dependent Class Depends on

Composition Composition expresses a relationship among instances of related classes. It is a specific kind of Whole-Part relationship. Class W Class P1 Class P2 Part Classes Automobile Engine Transmission

Aggregation Aggregation: expresses a relationship among instances of related classes. It is a specific kind of Container-Containee relationship. Container Class Class C Bag AGGREGATION Class E1 Class E2 Apples Milk Containee Classes

Aggregation vs. Composition Composition is really a strong form of aggregation components have only one owner components cannot exist independent of their owner components live or die with their owner e.g. Each car has an engine that can not be shared with other cars. Aggregations may form "part of" the aggregate, but may not be essential to it. They may also exist independent of the aggregate. e.g. Apples may exist independent of the bag.

Generalization hierarchy

Generalization hierarchy with added detail

Domain Model (Conceptual Model) vs Domain Model (Conceptual Model) vs. Design Model Classes (Class Diagram) (Conceptual Model) (Class Diagram)

Example Design Class Diagrams (DCD)

Creating NextGen POS DCD Identify all the classes participating in the software solution. Do this by analyzing the interaction diagrams. Draw them in a class diagram. Duplicate (i.e. copy) the attributes from the associated concepts in the Domain Model.

Steps: Design to Code Main goal is to define Design Class Diagram with Attributes and Methods Defining Concepts Adding Reference Attributes, attributes. Creating methods from interaction diagrams: Find & Add methods. Add type information to the attributes and methods Add navigability and associations. Collection classes in code.

Creating NextGen POS DCD Add method names for each class by analyzing the interaction diagrams.

Creating Methods from Sequence Diagrams 15 Creating Methods from Sequence Diagrams :Register :ProductCatalogue Sale :SalesLineItem :ProductSpec Constructor 1. Spec=getSpecification(itemID) 1.1 Spec=Find(itemID) 2. makeLineItem(spec,quantity) 2.1 sli= Create(spec,quantity) 2.1.1 Sub=getSubTotal(itemID) 2.2 Add(sli)

Creating NextGen POS DCD Add type information to the attributes and methods.

Question: Register – addLineItem Method The addLineItem sequence diagram will be used to illustrate the Java definition of the addLineItem method. Which class addLineItem should 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);

Register - addLineItem Method Public void addlineitem(itemid itemid, int quantity) { productSpecification spec = catalog.getSpecification(itemID); sale.makeLineItem(spec, quantity); } Public productSpecification getSpecification(itemID){ spec := find(itemID); Return spec; } Public void makeLineItem (productSpecification spec, int quantity){ sli= create(spec, quantity); //new in java add(sli);

Skeletal definition of Register Class

Collection Classes in Code

Adding Navigability & Dependency Relationships