CS 340 UML Class Diagrams. A model is an abstraction of a system, specifying the modeled system from a certain viewpoint and at a certain level of abstraction.

Slides:



Advertisements
Similar presentations
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Advertisements

UML Class and Sequence Diagrams Violet Slides adapted from Marty Stepp, CSE 403, Winter 2012 CSE 403 Spring 2012 Anton Osobov.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
UML – Class Diagrams.
Chapter 14 (Web): Object-Oriented Data Modeling
What is UML? A modeling language standardized by the OMG (Object Management Group), and widely used in OO analysis and design A modeling language is a.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
Unified Modeling Language (UML)
IMSE 11 - UML Class Diagrams
Kari R. Schougaard, PhD Stud. Værktøjer og Teknikker, 2006 UNIVERSITY OF AARHUS Department of Computer Science Unified Modeling Language Visual language.
7M822 UML Class Diagrams advanced concepts 15 September 2008.
Chapter 2: Entity-Relationship Model (Continued)
Class Number – CS 304 Class Name - DBMS Instructor – Sanjay Madria Instructor – Sanjay Madria Lesson Title – ER Model.
PRJ566: PROJECT PLANNING AND MANAGEMENT Class Diagrams.
Unified Modeling Language
The Unified Modeling Language (UML) Class Diagrams.
Object-Oriented Analysis and Design
COMS W4156: Advanced Software Engineering
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
1 Data Modeling : ER Model Lecture Why We Model  We build models of complex systems because we cannot comprehend any such system in its entirety.
CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
1 UML Basic Training. UML Basic training2 Agenda  Definitions: requirements, design  Basics of Unified Modeling Language 1.4  SysML.
CHAPTER 13 (ONLINE): OBJECT-ORIENTED DATA MODELING © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
UML – Universal Modeling Language IT 210 Introduction to Modeling.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 15: Object-Oriented Data Modeling Modern Database Management 9 h Edition Jeffrey A.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 15 System Modeling with the UML.
Unit 1 INTRODUCTION TO MODELING AND CLASS MODEL Ref : L7-UML.PDF.
CHAPTER 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
1 Class Diagrams: Advanced Concepts. 2 Overview Class diagrams are the most commonly used diagrams in UML. Class diagrams are the most commonly used diagrams.
Modeling system requirements. Purpose of Models Models help an analyst clarify and refine a design. Models help simplify the complexity of information.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
UML Class Diagram Trisha Cummings. What we will be covering What is a Class Diagram? Essential Elements of a UML Class Diagram UML Packages Logical Distribution.
Design Jon Walker. More UML ● What is UML again?
Week III  Recap from Last Week Review Classes Review Domain Model for EU-Bid & EU-Lease Aggregation Example (Reservation) Attribute Properties.
Object-Oriented Data Modeling
Design Model Lecture p6 T120B pavasario sem.
Object Oriented Analysis: Associations. 2 Object Oriented Modeling BUAD/American University Class Relationships u Classes have relationships between each.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Entity Relationship Modeling
Object Oriented Analysis and Design Class and Object Diagrams.
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
The Unified Modeling Language (UML)
Lecture 9-1 : Intro. to UML (Unified Modeling Language)
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
Chapter 3: Introducing the UML
CSCI 3428: Software Engineering Tami Meredith UML Unified Modeling Language.
CHAPTER 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) Modern Database Management 11 th Edition Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
Unified Modeling Language (UML)
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
Chapter 11 Inheritance © 2008 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. Marilyn Bohl/Maria Rynn Tools for Structured and Object-Oriented.
UML. Model An abstract representation of a system. Types of model 1.Use case model 2.Domain model 3.Analysis object model 4.Implementation model 5.Test.
WELCOME TO OUR PRESENTATION UNIFIED MODELING LANGUAGE (UML)
UML Class Diagrams David Millard
UML (Unified Modeling Language)
CS 350 – Software Design UML – The Unified Modeling Language – Chapter 2 The Unified Modeling Language is a visual language used to create models of programs.
Modeling with UML – Class Diagrams
Unified Modeling Language (UML)
Unified Modeling Language
UML Unified Modelling Language
Software Engineering Lecture #11.
Software Construction Lecture 2
Business Analysis More on Classes Chris Russell O2.41
Object Oriented System Design Class Diagrams
From Class Diagram to Contract Diagram
Presentation transcript:

CS 340 UML Class Diagrams

A model is an abstraction of a system, specifying the modeled system from a certain viewpoint and at a certain level of abstraction

Complexity and Modeling Modeling is a well-accepted engineering technique for dealing with complexity Models let us focus on one view of the system while ignoring irrelevant details (a simplification of reality) –Example: Plumbers only care about plumbing, so we give them plumbing diagrams; electricians only care about electrical work, so we give them electrical diagrams, etc. Models can be created at different levels of abstraction –10,000 ft. view vs. 10 ft. view –High-level: sketch of the building's exterior for the customer –Low-level: detailed electrical plan for the electrician

Software Modeling Why do we create models of software systems? Models help us visualize and understand the system we're building Models are used to document the design of the system and communicate it to others Models serve as a guide during system construction

UML Unified Modeling Language History Models –Data –Behavior –Interaction –Packaging

Levels of Models Conceptual Model – Problem Understanding Specification/Requirement Document – Solutions High-Level Design Model –Systems, Packages, Classes –Interactions, Interfaces Low-Level Design Model –Class Conceptual Model –May be better done with Class documentation such as Javadoc Implementation –Should be done in code not UML

UML Models Structural/Data –Class Diagram –Object Diagram Behavior –Use Case Diagram –State Diagram –Activity Diagram Interaction –Communication Diagram –Sequence Diagram Physical Diagram –Component Diagram –Deployment Diagrams

Classes At the Conceptual Level A Class – typically named with a common noun. At the conceptual level the class is a set of objects with common properties. Mother

Classes At the Design Level A Class – typically named with a common noun. At the design level a Class is a Type. Visibility constraints (optional) : + (public), - (private), # (protected), / (derived), _ (static), ~ (package). We may add cardinality constraints to an attribute. In this case it means that a Mother has 1 or more names. If the cardinality constraint is omitted it is assumed to be the cardinality constraint “1”. For some situations we may omit the Method Section or the Attribute Section. Mother - name : Name [1.. *] - age : int + print() + equals(Object) Attribute Section Method Section

Objects An Object – notice the name is underlined. While some find Objects useful in the Class diagram others do not. Clara

Associations An association can be thought of as a declarative sentence. The name in the association is optional but suggested. Typical association constraints are 1, 0..1, *, 1..*, n..m. UML 1.0 supported a notation for an arbitrary set of non-negative integers (e.g. 2:4, 6,12 meaning the set {2,3,4,6,12} Most associations are binary. ChildMother 1* has

Associations Continued Roles –Although this example has 2 roles, there may be only 1, or most often 0 roles on an association. –Roles can be viewed as Specializations While not all versions of UML support the same annotations, you may find some when reading UML diagrams. Male Female 1 1 is married to Husband Wife Mother Child 1..* 1 has {ordered}

Directed Associations Should only be used as a design construct –Means that we can access an Address via a Person, but, given an Address we can’t determine the Person associated with it. –If the association constraint on the opposite side of the navigability arrow is a 1, then this is equivalent to –Notice the cardinality constraint to the right of the attribute. Person Address 1..*1 has Person address : Address [1..*]

Aggregation/Composition Aggregation –Can be read as Person is subpart of a Company –Can be transitive but acyclic. –Some people prefer to just use associations. –Can use “comb” representation of there are different types of subparts. Composition –Can be read as “A Car is composed of 1 or more Car Parts”. –A much stronger form of Aggregation. Some suggest it implies a Car Part cannot exist unless it is part of a car. –Notice there is no association constraint next to the black diamond because it is always 1. Company Person 1..* 0..* Employee Car Car Part 1..*

Generalization/Specialization –For conceptual modeling every Faculty Member, Staff Member, and Student is a BYU Person. “Is A” Semantics. That is, subset semantics. In this case the set, Student, is a subset of the set BYU Person. –At the Design level it represents “subtype” or “inheritance” semantics. –A generalization/specialization often has a single specialization. –Though not standard UML, I may include the following annotations: {union}, {disjoint}, and {partition}. BYU Person Faculty Member Staff Member Student

General Constraints/Notes General Constraints –{A Father must be a male Person} –I often omit the braces. –Can be expressed formally in OCL, a type of first- order logic. Notes –I use text such as NOTE: A Note or Note: Information A Note Family History

Dependency Used in design models. Especially good for representing dependencies that aren’t obvious, such as assumptions. There is no notation for indicating why Person depends on Address. I use notes to add the information. Person Address

Association Class Useful when thinking of an association as an object. Could use an n-ary relation. Husband Wife 1..* married Marriage Information date : Date temple: Temple

N-ary Associations In UML the association constraints are binary functional dependencies. They tried to extend that idea to n-ary associations. It didn’t work well. Here the 4 association constraints mean –For a given Husband, Wife, and Temple in the association there are 1 or more Dates. –For a given Husband, Wife, and Date in the association there is 1 and only 1 Temple. –For a given Husband, Date and Temple in the association there is 1 and only 1 Wife. –For a given Wife, Date, and Temple in the association there is 1 and only 1 Husband. Because this is awkward it is not used as much as it could be. If we interpret the constraints as participation constraints (see ORM, and OSA) then the semantics are much easier to understand. Husband Wife 1 1 Date Temple 1..* A Husband married a Wife on a given Date at a particular Temple 1

Class Diagram Example

Source: Booch et. al., The UML User Guide