CSSE 374: Design Class Diagrams. Shawn Bohner Office: Moench Room F212 Phone: (812)

Similar documents
COMP 354: INTRODUCTION TO SOFTWARE ENGINEERING

CSSE 374: GRASP ing at the First Five Patterns Principles. Shawn Bohner Office: Moench Room F212 Phone: (812)

CSSE 374: Logical Architecture. Shawn Bohner Office: Moench Room F212 Phone: (812)

CSSE 374: UML Activity Diagrams. Shawn Bohner Office: Moench Room F212 Phone: (812)

CSSE 374: More Object Design with Gang of Four Design Patterns

Designing for Visibility & Mapping to Code CSSE 574: Session 4, Part 3

We are at System Operation Contracts

OO Design2. Design Artifacts

Software Modeling & Analysis

Model-Driven Architecture/ Development

COMP 6471 Software Design Methodologies

SOFTWARE DESIGN COSC 4353 / Dr. Raj Singh

Unified Modeling Language (UML) Class Diagram

What is a Model? Copyright hebley & Associates

CTIS 359 Principles of Software Engineering SOFTWARE DESIGN OO(A)D

COMP 6471 Software Design Methodologies

Fundamental Concepts

2009 Shawn A. Bohner. Shawn Bohner Office: Moench Room F212 Phone: (812)

Mapping Designs to Code

Domain Modeling. CSSE 574: Week 1, Part 3. Steve Chenoweth Phone: Office (812) Cell (937)

Modeling with UML. (1) Use Case Diagram. (2) Class Diagram. (3) Interaction Diagram. (4) State Diagram

Applying UML & Patterns (3 rd ed.) Chapter 15

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

Interaction Modelling: Use Cases

Constantinos Constantinides Computer Science and Software Engineering Concordia University Montreal, Canada

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

CSSE 490 Model-Based Software Engineering: Domain Specific Language Introduction

CSE 403: Software Engineering, Spring courses.cs.washington.edu/courses/cse403/15sp/ UML Class Diagrams. Emina Torlak

Software Service Engineering

CSSE 490 Model-Based Software Engineering: Software Factories

UML class diagrams. Nigel Goddard. School of Informatics University of Edinburgh

2009 Shawn A. Bohner. Shawn Bohner Office: Moench Room F212 Phone: (812)

Chapter 3: Object Oriented Design

CSSE 374: Even More Object Design with Gang of Four Design Patterns

CSSE 490 Model-Based Software Engineering: Introduction to MetaModels

Logical Architecture & Design Preliminaries

Unified Modeling Language (UML)

UML REFERENCE SHEETS. 2013, 2014 Michael Marking; all rights reserved, including moral rights. Web site:

Goal: build an object-oriented model of the realworld system (or imaginary world) Slicing the soup: OOA vs. OOD

Class Diagrams in Analysis

S T R U C T U R A L M O D E L I N G ( M O D E L I N G A S Y S T E M ' S L O G I C A L S T R U C T U R E U S I N G C L A S S E S A N D C L A S S D I A

CSSE 490 Model-Based Software Engineering: Introduction to Domain Engineering

Object-Oriented Software Engineering Practical Software Development using UML and Java

2009 Shawn A. Bohner. Shawn Bohner Office: Moench Room F212 Phone: (812)

UML Sequence Diagrams for Process Views

For 100% Result Oriented IGNOU Coaching and Project Training Call CPD TM : ,

Lesson 11. W.C.Udwela Department of Mathematics & Computer Science

Introduction - SENG 330. Object-Oriented Analysis and Design

NOTES ON OBJECT-ORIENTED MODELING AND DESIGN

Introduction to Software Engineering. 5. Modeling Objects and Classes

Unified Modeling Language I.

Chapter 10. Object-Oriented Analysis and Modeling Using the UML. McGraw-Hill/Irwin

Principles of Software Construction: Objects, Design and Concurrency. Just enough UML. toad

Engineering Design w/embedded Systems

OBJECT ORIENTED DESIGN with the Unified Process. Use Case Realization

CSC9T4: Object Modelling, principles of OO design and implementation

Chapter 5: Structural Modeling

CSSE 490 Model-Based Software Engineering: Cougaar Model-Driven Architecture Example

SEEM4570 System Design and Implementation Lecture 11 UML

CSSE 490 Model-Based Software Engineering: Domain Engineering

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

CS 370 REVIEW: UML Diagrams D R. M I C H A E L J. R E A L E F A L L

Class diagrams and architectural design

ACS-3913 Ron McFadyen 1. UML Notation for Class diagrams Object diagrams

Object Orientated Analysis and Design. Benjamin Kenwright

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 5: Modelling with Classes

Advanced Class Diagrams and Intro to Interaction Modeling

LABORATORY 1 REVISION

Domain Modeling: Associations and Attributes

CSSE 490 Model-Based Software Engineering: More MBSD. Shawn Bohner Office: Moench Room F212 Phone: (812)

System Sequence Diagrams. Based on Craig Larman, Chapter 10 and Anuradha Dharani s notes

Objectives. Explain the purpose and objectives of objectoriented. Develop design class diagrams

UML Fundamental. OutLine. NetFusion Tech. Co., Ltd. Jack Lee. Use-case diagram Class diagram Sequence diagram

Notation Part 1. Object Orientated Analysis and Design. Benjamin Kenwright

UML & OO FUNDAMENTALS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 3 08/30/2011

CS 1302 Chapter 9 (Review) Object & Classes

UML diagrams. Software artifacts include: SRS, SDS, test cases, source code, technical/user manual, software architecture, etc.

Sequence Diagram. A UML diagram used to show how objects interact. Example:

Software Life-Cycle Models

Design and UML Class Diagrams

user.book Page 45 Friday, April 8, :05 AM Part 2 BASIC STRUCTURAL MODELING

CSCI 253. Outline. Rationale. George Blankenship 1. Object Oriented Design: UML. George Blankenship

Database Systems. A Practical Approach to Design, Implementation, and Management. Database Systems. Thomas Connolly Carolyn Begg

Chapter 10 Object-Oriented Design Principles

Some Software Engineering Techniques (Class Diagrams and Pair Programming)

UML. By Somenath Mukhopadhyay.

Principles of Software Construction: Objects, Design, and Concurrency

What is a Class Diagram? A diagram that shows a set of classes, interfaces, and collaborations and their relationships

What is a Class Diagram? Class Diagram. Why do we need Class Diagram? Class - Notation. Class - Semantic 04/11/51

Question Sheet There are a number of criticisms to UML. List a number of these criticisms.

Topics. Overview- The UML Functional Model. Structural Model. Behavioral Models. Use Case Diagram (essential and system)

Assigning Responsibilities (Patterns of Responsibility Assignment Principles: GRASP)

Basic Structural Modeling. Copyright Joey Paquet,

Lecture 8: Use Case -Driven Design. Where UML fits in

12 Tutorial on UML. TIMe TIMe Electronic Textbook

Lecture 17: (Architecture V)

Today s Topic. Lecture 5. What is UML? Why Use UML. UML Diagrams. Introduction to UML. What is UML Why use UML? UML Diagrams

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 7 Data Modeling with Entity Relationship Diagrams

Lecture 33 April 4, Unied Modelling Language. ECE155: Engineering Design with Embedded Systems Winter Patrick Lam version 1

Motivation State Machines

Transcription:

CSSE 374: Design Class Diagrams Shawn Bohner Office: Moench Room F22 Phone: (82) 877-8685 Email: bohner@rose-hulman.edu

General solutions get you a 50% tip

Plan for the Day Pre-break course evaluations Design Class Diagrams Design exercise that should help with Homework #3

Help Me Help You Pre-break course evaluation on ANGEL Please take 0 minutes or so to help me improve the course

UML Class Diagrams

Design Class Diagrams (DCD) /2 Creation of DCDs builds on prior: Domain Model (+detail to class definitions) Interaction diagrams (identifies class methods) Creation of DCDs and interaction diagrams are usually created in parallel Q

Design Class Diagrams (DCD) 2/2 DCDs illustrates the specifications for software classes and interfaces including: Classes, associations, and attributes Interfaces, with their operations and constants Methods Attribute type information Navigability Dependencies

3 common compartments. classifier name 2. attributes 3. operations an interface shown with a keyword «interface» Runnable run() SuperclassFoo or SuperClassFoo { abstract } - classorstaticattribute : Int + publicattribute : String - privateattribute assumedprivateattribute isinitializedattribute : Bool = true acollection : VeggieBurger [ * ] attributemaylegallybenull : String [0..] finalconstantattribute : Int = 5 { readonly } /derivedattribute + classorstaticmethod() + publicmethod() assumedpublicmethod() - privatemethod() # protectedmethod() ~ packagevisiblemethod() «constructor» SuperclassFoo( Long ) methodwithparms(parm : String, parm2 : Float) methodreturnssomething() : VeggieBurger methodthrowsexception() {exception IOException} abstractmethod() abstractmethod2() { abstract } // alternate finalmethod() { leaf } // no override in subclass synchronizedmethod() { guarded } officially in UML, the top format is used to distinguish the package name from the class name unofficially, the second alternative is common Common UML dependency java.awt::font Class or java.awt.font Notation plain : Int = 0 { readonly } bold : Int = { readonly } name : String style : Int = 0 getfont(name : String) : Font getname() : String Fruit interface implementation and subclassing run() SubclassFoo - ellipsis means there may be elements, but not shown - a blank compartment officially means unknown but as a convention will be used to mean no members association with multiplicities order PurchaseOrder

Recipe for a Design Class Diagram ) Identify all the classes participating in the software solution by analyzing the interaction diagrams 2) Draw them in a class diagram 3) Duplicate the attributes from the associated concepts in the conceptual model 4) Add method names by analyzing the interaction diagrams 5) Add type information to the attributes and methods 6) Add the associations necessary to support the required attribute visibility 7) Add navigability arrows to the associations to indicate the direction of attribute visibility 8) Add dependency relationship lines to indicate nonattribute visibility

Class Diagrams Do Double Duty Domain Model conceptual perspective Register Captures Multiplicity only at target end Sale time iscomplete : Boolean /total Navigability arrow Register Sale Design Model DCD; software perspective endsale() enteritem() makepayment() currentsale time iscomplete : Boolean /total makelineitem() Role name only at target end Call them Domain Models when used for analysis at the conceptual level No association name Call them Design Class Diagrams when used for design Q2

Attribute Text vs. Association Line Notation using the attribute text notation to indicate Register has a reference to one Sale instance Register currentsale : Sale Sale Avoid Role name is attribute name OBSERVE: this style visually emphasizes the connection between these classes Register currentsale Sale Preferred using the association notation to indicate Register has a reference to one Sale instance thorough and unambiguous, but some people dislike the possible redundancy Register currentsale : Sale currentsale Sale Avoid Q3

Guideline Good Practice: Example Q4

Showing Collection Attributes Multiplicities Preferred, less visual clutter Constraints Q5

Operations Syntax: visibility name(paramname:type, ) : returntype {properties} + getplayer(name:string) : Player {exception IOException}" Also use syntax of implementation language public Player getplayer(string name) throws IOException" Operation vs. operation contract vs. method

Cartoon of the Day http://www.brickfetish.com/toys/duck.html

Keywords Categorize Model Elements Keyword Meaning Example Usage «actor» «interface» classifier is an actor classifier is an interface shows that classifier is an actor without getting all xkcd «interface»" MouseListener {abstract} can t be instantiated follows classifier or operation {ordered} {leaf} set of objects has defined order can t be extended or overridden follows role name on target end of association follows classifier or operation

Generalization In Domain Model: Says that the set of all NumberCards is a subset of the set of all Cards In DCD: Says that, and that NumberCard inherits from Card

Dependencies Dependency lines are dashed Attribute association lines are solid Use dependency lines when a more specific line type doesn t apply. Can label dependency arrows: e.g. «call», «create» Q6

Interfaces in UML socket line notation Window Timer Window uses the Timer interface it has a required interface dependency line notation Window2 has a dependency on the Timer interface when it collaborates with a Clock2 object «interface» Timer gettime() Clock2 gettime() Timer Window2 Clock Clock implements and provides the Timer interface Clock3 gettime() gettime() lollipop notation indicates Clock3 implements and provides the Timer interface to clients Timer is a provided interface Timer Window3 socket line notation Window3 has a dependency on the Timer interface when it collaborates with a Clock3 object Q7

Composition More powerful than an attribute arrow Describes whole-part relationship Implies Instance of part belongs to only one composite at a time Part always belongs to a composite Composite creates/deletes parts Association name in composition is always implicitly some has-part relation. So, it s common to omit association or role name with compositions Q8

Interaction Diagrams and Class Diagrams Interaction diagrams show dynamic behavior Class diagrams show static behavior Tips: Draw concurrently Use two adjacent whiteboards, one for static and one for dynamic Sketch communication diagrams, document using sequence diagrams

Exercise on Sequence Diagrams Break up into your project teams Given the following: Domain Model and a Sequence Diagram Draw Design Class Diagram showing a Customer and the classes in a Rental package and a Video package for BrickBusters Video Store. Try to minimize dependencies. Q9

Store Address Phone# Customer name address phone# Video ID Transaction date Payment /amount: Money type authorization Initiates Recordsrental-of Pays-for Transacts Rents-from, Buys-from Stocks Selects * * * *..* 0..* Makes- Authorizes..* Rental duedate ReturnDate ReturnTime VideoDescription title subjectcategory VideoSupplier address name newvideos Basket Shelf location stock Membership ID startdate PricingPolicy perdayrentalcharge perdaylatecharge Obtains Maintains * Determines- rental-charge * Contains * * Stores- video-on Defines * Provides * * Describes Contains 0..* Provides 0..* Holds- videos-in

An SD Solution for Rent Video Example :Customer rentvideos :Video :Video Description Loop [more items] findvideotorent(id,duration) videotitle, availability getvideoinfo(id,duration) videotitle, desc, availabilty selectvideotorent(id) selectedvideos(video List) Checkout totalwithtaxes updateavailability(id,duration)

Homework and Milestone Reminders Read Chapter 7 on Responsibility Driven Design Homework 3 BBVS Logical Architecture and Preliminary Design Due by 5:00pm on Tuesday, January 4 th, 20 Milestone 3 Junior Project SSDs, OCs, and Logical Architecture Due by :59pm on Friday, January 7th, 200 5% extra credit on Milestone 3 and Homework3 if you finish by :59pm, Friday before break!

A CD Solution for Rent Video Example rentvideos :Customer : FindVideoToRent(ID,duration) 2: selectvideotorent(id) 3: Checkout.3: videotitle, availability 3.: selectedvideos(video List) 3.2: totalwithtaxes :Video.: getvideoinfo(id,duration).2: videotitle, desc, availabilty 2.: updateavailability(id,duration) :Video Description