UML Class Diagram. A class diagram shows 1.Classes 2.The relationships between them.

Slides:



Advertisements
Similar presentations
UML (cont.) “The Unified Modeling Language User Guide” by G. Booch, J. Rumbaugh and I. Jacobson ● Classes ● Relationships ● Class diagrams ● Examples.
Advertisements

OOP: Inheritance By: Lamiaa Said.
Stereotypes Stereotypes provide the capability to create a new kind of modeling element. –They can be used to classify or mark modeling elements. –A type.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
UML – Class Diagrams.
Inheritance. Extending Classes It’s possible to create a class by using another as a starting point  i.e. Start with the original class then add methods,
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
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 
1 Fall 2007ACS-1903 Chapter 6: Classes Classes and Objects Instance Fields and Methods Constructors Overloading of Methods and Constructors Scope of Instance.
UML a crash course Alex Lo Brian Kiefer. Overview Classes Class Relationships Interfaces Objects States Worksheet.
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
1 Object-Oriented Modeling Using UML CS 3331 Fall 2009.
The Unified Modeling Language (UML) Class Diagrams.
CS 2511 Fall UML Diagram Types  2 Main Types Structure Diagrams ○ Class Diagrams ○ Component Diagrams ○ Object Diagrams Behavior Diagrams ○
ZEIT2301 Design of Information Systems Structural Design: Class Diagrams School of Engineering and Information Technology Dr Kathryn Merrick.
OBJECT ORIENTED PROGRAMMING LECTURE 12 Instructor: Rashi Garg Coordinator: Gaurav Saxena.
Software Construction Lecture 5 Class Diagrams. Agenda 2  Topics:  Examples of class diagrams  Navigation, visibility, named associations, and multiplicity.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
1 Object-Oriented Software Engineering CS Interfaces Interfaces are contracts Contracts between software groups Defines how software interacts with.
Training: INSPIRE Basics EC JRC 1/15 UML class diagram: example INSPIRE UML class diagram for administrative units.
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
UML Review – class diagrams SE 2030 Dr. Rob Hasker 1 Based on slides written by Dr. Mark L. Hornick Used with permission.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
Databases : Data Modeling 2007, Fall Pusan National University Ki-Joune Li.
® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 03. Classes,
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.
UML Class Diagrams 1 These lecture slides are copyright (C) Marty Stepp, They may not be rehosted, sold, or modified without expressed permission.
UML The Unified Modeling Language A Practical Introduction Al-Ayham Saleh Aleppo University
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.
Peyman Dodangeh Sharif University of Technology Fall 2014.
Class Diagram Classes are the most important building block of any object-oriented system. A class is a description of a set of objects that share the.
Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
Class and Sequence diagrams UML notation SE-2030 Dr. Mark L. Hornick 1.
Design Model Lecture p6 T120B pavasario sem.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
CSE 403, Spring 2008, Alverson Using UML to express Software Architecture.
CSE 403, Spring 2007, Alverson Using UML to express Software Architecture.
Lecture 8-2 : Class Diagrams. Class Representation Class Name Attribute1 Attribute2 … Operation1 Operation2 … responsibility.
Modeling the Static Structure: Relationships ©SoftMoore ConsultingSlide 1.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
UML Class Diagram notation Indicating relationships between classes SE-2030 Dr. Mark L. Hornick 1.
Class diagrams Terézia Mézešová.
Object Modeling THETOPPERSWAY.COM. Object Modelling Technique(OMT)  Building a model of an application domain and then adding implementation.
ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #2 1.
Terms and Rules II Professor Evan Korth New York University (All rights reserved)
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.
TK2023 Object-Oriented Software Engineering CHAPTER 11 CLASS DIAGRAMS.
Class Diagrams Revisited. Parameterized Classes Parameterized Classes - are used to represent relationships between templates.
Interfaces & Abstract Classes (For CS III AP) March 2014.
Software Modelling Class Diagram. Class Diagrams The main building block in object oriented modeling They are used both for general conceptual modeling.
UML Review – class diagrams SE-2030 Dr. Mark L. Hornick 1.
COP 3330 Notes 4/13. Today’s Topics UML Class Diagrams.
Unified Modeling Language (UML)
UML Class & Object Diagram II
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
UML Unified Modelling Language
Object Oriented Analysis and Design
Seminar 3 UML Class Diagram.
Software Engineering Lecture #11.
UML Class Diagram.
Unified Modelling Language
Software Engineering System Modeling Extra examples Dr.Doaa Sami
Class Diagrams Class diagram is basically a graphical representation of the static view of the system and represents different aspects of the application.
Class Diagram.
Object Oriented System Design Class Diagrams
Information System Design
The generalization of class
Presentation transcript:

UML Class Diagram

A class diagram shows 1.Classes 2.The relationships between them

Classes  Class name  Class attributes (state)  Class methods (operations)  Visibility o + means public o # means protected o − means private o ~ means package Course name: String number: Integer addStudent()

Class Details  Abstract class: name in italics  Member properties: o static o abstract o CONSTANT  Specify type of attributes  Specify signature and return value of methods addStudent( s : Student ) : void

Inheritance Shape -color: Color +setColor(c: Color): void +getArea(): double Circle -radius: double +setRadius(r: double): void +getRadius(): double +getArea(): double Think “tree” not “arrow” override

Interfaces «interface» Drawable +draw(): void Circle -radius: double +setRadius(r: double): void +getRadius(): double +draw(): void implement Note dashed line

Associations When one class knows about another class and may call methods of that class’s objects  General association  Aggregation  Composition  dependency

Association  Specify that classes know each other  Can be named (typically verbs) CourseProfessor teaches

Multiplicity Specify the numerical relationship  1 – exactly one  0..1 – zero or one  0..* (or just *) – any number or none  1..* – one or more  3..8 – three to eight CourseProfessor 10..* teaches

Association  Classes can have role names (nouns)  Typically represent attribute name in other class CourseProfessor teacher Class Course { teacher: Professor; … } Class Professor { myCourse: Course; … }

Association  Associations can be reflexive  In this case role names are required Professor mentor mentee

Navigability  The course knows the textbook(s) used  The textbook does not know course(s) which use it  Alternative interpretation: navigability from textbook to course is unspecified o To prohibit access use TextBookCourse

Association Class A class that represents the association CourseStudent 0..* Enrolment grade: integer

Aggregation  One class contains an aggregate of objects from the other class  But aggregated objects are still independent  Implies container attribute ProfessorDepartment

Composition  A stronger form of aggregation  One class contains objects from the other class  These objects have no existence without the containing object CourseProgram 1

AggregationComposition Relationshiphas-awhole-parts Container typereferencesobjects Lifecycleelements are independent elements are created with container and die with container Elementscan be in multiple aggregations can be in only one composition

Dependency  One class uses another o Local in method o Argument to method o Creation of objects (e.g. factory)  But it is not an attribute (field)  Usually many; show only important ones CA method(arg : B) B «creates»

Derived Attributes  An attribute whose value is derived from other attributes  Does not have a setter Course name: String /enrolment: Integer addStudent() Student

Constraints and Notes Provide additional information Course capacity: integer /enrolment: integer addStudent() Student {enrolment  capacity} Only nice ones

Object Diagrams  Similar to class diagrams  Show object instances rather than classes  Reflect relationships at runtime  No reflexive associations o ListNode class: next is reflexive o ListNode object: next is reference to another object UML Class Diagrams