UML for design: Class Diagrams ENGR 110 #

Slides:



Advertisements
Similar presentations
UT-Space Manager. Define Rooms The Define Rooms task is used to manage your room data. 1.On the Process Navigator, click on the Space Inventory & Performance.
Advertisements

Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington UML for design: Class Diagrams.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington UML for design: Class Diagrams.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
Class Diagram & Object Diagram
1 Lecture 2: Elaboration Tasks and Domain Modeling.
6/8/991 Analysis Tuesday 09/14/99 Revised: September 11, 2000 (APM)
Copyright W. Howden1 Lecture 2: Elaboration Tasks and Domain Modeling.
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.
PRJ566: PROJECT PLANNING AND MANAGEMENT Class Diagrams.
Unified Modeling Language
CSC 8310 Programming Languages Meeting 2 September 2/3, 2014.
Chapter 9 Domain Models. Domain Model in UML Class Diagram Notation A “visual dictionary”
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
From Problem Statement to Design
Analyzing the Requirements with Formal Specifications Vienna Development Method Specification Language (VDM-SL) Book: Formal Software Development From.
Assignements. CSC343: Intro. to Databases2 Exercise 1 Superkeys: Candidate keys: Primary key:
Databases : Data Modeling 2007, Fall Pusan National University Ki-Joune Li.
Engineering 5895: Software Design 9/11/01Class Diagrams 1.
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.
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.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
Lecture 1: UML Class Diagram September 12, UML Class Diagrams2 What is a Class Diagram? A class diagram describes the types of objects in the system.
Week III  Recap from Last Week Review Classes Review Domain Model for EU-Bid & EU-Lease Aggregation Example (Reservation) Attribute Properties.
UML Class Diagram. A class diagram shows 1.Classes 2.The relationships between them.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Chapter 16 UML Class Diagrams.
Object-Oriented Analysis and Design Use cases Finding classes Collaboration and Sequence diagrams Associations between classes.
M1G Introduction to Programming 2 2. Creating Classes: Game and Player.
Class Diagram Lecture # 1. Class diagram A Class Diagram is a diagram describing the structure of a system shows the system's classes Attributes operations.
OO DomainModeling With UML Class Diagrams and CRC Cards Chapter 6 Princess Nourah bint Abdulrahman University College of Computer and Information Sciences.
Data Modeling Using the Entity- Relationship (ER) Model
UML for design: Class Diagrams ENGR 110 #
Modeling with UML – Class Diagrams
An informal, team oriented, OO design system
UNIT-IV Designing Classes – Access Layer ‐ Object Storage ‐ Object Interoperability.
Assignements.
Data Modeling Using the Entity- Relationship (ER) Model
WHAT IS A Process Map? Illustration of the sequence of activities, inputs and outputs to the activities, and relationship across multiple functions, or.
Chapter 9 Domain Models.
Databases Chapter 9 Asfia Rahman.
IS6125 Database Analysis and Design Lecture 5: Conceptual Data Modelling 2: ER Modelling and Beyond the Presentation Layer Rob Gleasure
Unified Modeling Language
Chapter 16 UML Class Diagrams.
MIS2502: Data Analytics Relational Data Modeling
Conceptual Modeling.
Class diagram Description
Entity-Relationship Modeling
OO Domain Modeling With UML Class Diagrams and CRC Cards
OO Domain Modeling With UML Class Diagrams and CRC Cards
COURSE REQUEST INSTRUCTIONS
Object Oriented Analysis and Design
Chapter 18: Refining Analysis Relationships
تحليل انظمة و تصميمها الوحدة الخامسة أ.محمد زكي شبير.
UML Class Diagram.
Unified Modelling Language
MIS2502: Data Analytics Relational Data Modeling
SYS466 Domain Classes – Part 1.
IS6145 Database Analysis and Design Lecture 3: Conceptual Data Modelling 2: ER Modelling and Beyond the Presentation Layer Rob Gleasure
Data Tables and Arrays.
ICT Gaming Lesson 3.
MIS2502: Data Analytics Relational Data Modeling
CHAPTER 2 - Database Requirements and ER Modeling
Object Oriented Programming in java
Java Programming Language
Information System Design
DataTypes Nigel Davis
Constants, Variables and Data Types
Presentation transcript:

UML for design: Class Diagrams ENGR 110 #15 2016

Class diagrams More useful for real design Abstract from individual objects to classes of objects. What is the ontology of Class diagrams? Classes: categories of objects all of the same type, with the same behaviour Attributes of the objects in the classes Associations (relationships) between objects in the classes Actions/behaviour of objects in the classes Frog status: boolean lane

Class Diagrams Describe the categories of the objects, rather than the objects themselves: Notes Associations can have additional information on them Behaviour specifies the actions that can be done on the objects direction: string position: integer colour: Color speed: float Car class name, attributes incl associations behaviour Frog status: boolean lane lane Lane

Designing Class Diagrams How do you work out what classes there should be? No mechanical algorithm: it is a design issue Starting point: the nouns/noun phrases in the specification eg, the initial text description, the use cases, etc. note: this is not enough: Some nouns don’t need to be classes Some classes aren’t explicitly mentioned in the specification.

Group Project sign-up system System should allow students to sign up for group projects for their courses. Each course will have one or more group projects. Each project will have a task, a lab place, a maximum size, and a leader. A course administrator needs to be able to set up the projects for their course. Students should be able to specify the projects that they would like to do, and a preference order. When sufficient students have entered their preferences, the system should show which projects students are likely to be assigned to, along with the likelihood. The course administrator can “commit” to an allocation, at which point, the system will permanently allocate signed up students to projects. Students should be able to withdraw from projects, and enter new preferences, but they won’t be actually assigned until the next time the administrator “commits”. Administrators should be able to get lists of students in each project of their course.

What are the objects and classes? Classes, attributes, associations: Course Project Student Administrators Lab rooms

More on Associations What does an association mean: Objects of one class need to know about objects of the other class label describes the relationship task: string day: string maxSize: integer Project Course Code: string projPerSt: integer projects lab enrolled-in Student ID: integer LabRoom location: string projects

More on Associations: Multiple May have multiple associations between two classes if there are different relationships. task: string day: string maxSize: integer Project Course Code: string projPerSt: integer projects lab preferences enrolled-in Student ID: integer assigned_to LabRoom location: string leader

More on Associations: roles How do we read the label? just the name of relationship: (typically left to right, can add a ▶ or ◀ to clarify) roles of classes at each end of the association: describe what role the other objects play in this object Role on far end of association will turn into field name in the code! task: string day: string maxSize: integer Project Course Code: string projPerSt: integer projects▶ task: string day: string maxSize: integer Project Course Code: string projPerSt: integer course projects

More on Associations: navigability Do both classes need to know about the other? bidirectional: unidirectional: the Project needs to know which room; the room doesn’t need to know which projects are in it; Note: roles are not necessary here task: string day: string maxSize: integer Project Course Code: string projPerSt: integer course labstreams task: string day: string maxSize: integer Project LabRoom location: string room

More on Associations: multiplicity How many objects involved: specify the range of the number of objects on each end: eg: 1..1, 0..1, 0..5, 1..5, 1..*, 0..* task: string day: string maxSize: integer Project Course Code: string projPerSt: integer streams course projects 1 0..* Each project must have exactly 1 course that it belongs to A course may have any number of projects, and may have none Course Code: string projPerSt: integer Student ID: integer students course 0..8 *

More on Associations: multiplicity How many objects involved: direction position colour speed Car Frog status Lane frog lane lane cars 0..1 1 1 3 preferences ▶ task: string day: string maxSize: integer Project Student ID: integer ◀ leader assigned-to ▶

More on Associations: multiplicity A set of items may be ordered direction position colour speed Car Frog status Lane frog lane lane cars 0..1 1 1 3 preferences ▶ task: string day: string maxSize: integer Project * {ordered} * Student ID: integer ◀ leader * 0..1 0..10 assigned-to ▶ *

Summary so far Class diagrams show Classes name properties attributes (name : type) associations behaviour Associations between classes name (and/or role descriptions of each end) describes the relationship between objects of the two classes navigability which object “knows about” the other (bidirectional or unidirectional ) multiplicity ( min : max ) how many other objects one object can be related to eg: 1 * 0:1 1:* 0:n n:m set or ordered list? {ordered} task: string day: string maxSize: integer Project Course code: string streams course projects 1 0..*

Class Behaviour 3rd component of a class: specifies the actions that can be performed on objects of the class ie, the methods Specify name of action, parameters and types, return type Don’t specify actions for getting and setting properties task: string day: string maxSize: integer Project remainingCapacity() : integer assign(students: List<Student>) getDay() : string setDay(day:string) : getMaxSize() : integer Course code: string administrator: string numberOfProjects(): integer getCandidateAssigs(): Map <Project, List<Student>> commit() streams course projects 1 0..*