Class Diagram & Object Diagram

Slides:



Advertisements
Similar presentations
7M822 UML Class Diagrams 7 October 2010.
Advertisements

UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
7M701 1 Activity Diagram. 7M701 2 Example 7M701 3 Activity Diagram: what is it? Describes activities and flows of data or decisions between activities.
2008/03/25 Unified Modeling Lanauage 1 Introduction to Unified Modeling Language (UML) – Part One Ku-Yaw Chang Assistant Professor.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
Slide 1 Systems Analysis & Design CS183 Spring Semester 2008 Dr. Jonathan Y. Clark Course Website:
Slide 1 Chapter 7 Structural Modeling. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
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 
Use Case Modelling.
7M822 UML Activity Diagrams 6 October 2008.
IMSE 11 - UML Class Diagrams
ADMS-BIS Bouwkundige Informatiesystemen ADMS 2006 UML part 2 Jan Dijkstra - 23 oktober 2006.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 Class and Object Diagrams PRACTICAL OBJECT-ORIENTED DESIGN WITH.
7M822 UML Class Diagrams advanced concepts 15 September 2008.
7M822 UML Class Diagrams advanced concepts 14 October 2010.
7M822 UML Interaction Diagrams 25 November 2010.
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
7M822 UML Sequence Diagrams 5 October 2009.
UML Class Diagrams: Basic Concepts. Objects –The purpose of class modeling is to describe objects. –An object is a concept, abstraction or thing that.
Unified Modeling Language
Object-Oriented Analysis and Design
UML Unified Modeling Language. What is UML? Unified Modeling Language (UML) is a standardized, general-purpose modeling language in the field of software.
1 A Student Guide to Object- Orientated Systems Chapter 4 Objects and Classes: the basic concepts.
OBJECT AND CLASES: THE BASIC CONCEPTS Pertemuan 8 Matakuliah: Konsep object-oriented Tahun: 2009.
CSCI-383 Object-Oriented Programming & Design Lecture 9.
UML Diagrams: Class Diagrams The Static Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
R McFadyen Chapter 7 Conceptual Data Modeling.
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
Databases : Data Modeling 2007, Fall Pusan National University Ki-Joune Li.
CSC480 Software Engineering Lecture 11 September 30, 2002.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 03. Classes,
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.
The Static Analysis Model Class Diagrams Prof. Hany H. Ammar, CSEE, WVU, and Dept. of Computer Science, Faculty of Computers and Information, Cairo University.
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.
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.
Class Diagram. Classes Software Design (UML) Class Name attributes operations A class is a description of a set of objects that share the same attributes,
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.
Week III  Recap from Last Week Review Classes Review Domain Model for EU-Bid & EU-Lease Aggregation Example (Reservation) Attribute Properties.
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.
 Week08.  Review Schedule Weeks 8-14  This week o Review last class o Introduce Class Diagrams o ICE-03 Sheridan SYST Engineering Quality Systems.
CSCI-383 Object-Oriented Programming & Design Lecture 10.
Class Diagram Chapter 21 Applying UML and Patterns Craig Larman.
1 Introduction to Classes. 2 Terms and Concepts A class is... –The most important building block of any object- oriented system. –A description of a set.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
- U nified M odeling L anguage. GO TO USER ROLES PAGE Many Stakeholders, many views  Architecture may be many things to many different stakeholders 
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
UML (Unified Modeling Language)
Chapter 3: Introducing the UML
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.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
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.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
25/2/16. Software Design (UML) ClassName attributes operations A class is a description of a set of objects that share the same attributes, Operations.
UML Diagrams: Class Diagrams The Static Analysis Model
Class Diagrams.
Abstract descriptions of systems whose requirements are being analysed
UML Class Diagrams: Basic Concepts
Object Oriented Analysis and Design
UML Class Diagram.
Understand and Use Object Oriented Methods
Copyright 2007 Oxford Consulting, Ltd
Object Oriented System Design Class Diagrams
Presentation transcript:

Class Diagram & Object Diagram

UML Class Diagrams The class diagram provides a static structure of all the classes that exist within the system. Classes are arranged in hierarchies sharing common structure and behaviour and are associated with other classes. Class diagrams are used in: Analysis To build a conceptual domain model with semantic associations between concepts Design Structural model of a design in terms of class interfaces Implementation Source code documentation, exposing the implementation

Class diagram A class diagram describes the type of objects in a system and the static relationships between them. Static relations: Associations Subtypes Static structure: Attributes Operations

Class A class is a set of objects that share the same properties.     Name

Class A class is a set of objects that share the same properties. A class has a name.     Order

Class - attributes The class captures the abstraction of properties in the set of objects.   Name Attributes

Class - attributes An attribute of a class is identified by name, and it identifies a property of the objects of the class, for which each object takes a value. A class has 0 to n attributes.     Order number: String price: Money

Class - operations Operations are the processes that a class knows to carry out.   Order Attributes Operations

Class - operations The operations are the ‘responsibilities’ – the things we can ask an object to do. A class has 0 to n operations.   Name number: String price: Money Send () Close ()

Class - operations An operation is the implementation of a service that can be requested from any object of the class in order to affect behaviour. Operations are used to manipualte the attributes or to perform other actions. Operations are normally called functions, but they are inside a class and can be applied only to objects of that class. An operation is described with a return-type, a name and zero or more parameters. Together, the return-type, name, and parameters are called the signature of the operation. The signature describes everything needed to use the operation.  

Associations Associations are strcutural relationships where instances (objects) of one class are connected to instances (objects) of another class. an employee works for a company a company has a number of offices An association is normally bidirectional, which means that if an object is associated with another object, both objects are aware of each other (navigation is bidirectional by default). Binary association connects exactly two classes. N-ary connects may classes. The most common association is just a connection between classes.

Association Adornments: Name, Role The association has a name - the descriptive term, often a verb, for the association. Each association has two association ends; each end is attached to one of the classes in the association. An end can be explicitly named with a label. This label is called a role name (association ends are often called roles). Person Company employee employer works for  has employment for

Association: Multiplicity Multiplicity defines the number of objects associated with an instance of the association. Default of 1 (1: 1) 0 or 1: 0..1 Zero or more (0..infinite): * 1 or more (1..infinite): 1..* n..m; range from n to m inclusive Car Person transports passenger 5 * 1..* 2..5

Navigation It is possible to use navigable associations by adding an arrow at the end of the association. Within the specification perspective, navigability represent responsabilities. An Order has a responsability to tell you which Customer it is for.

Generalization A specialization / generalization relationship, in which objects of the specialized element (child) are substitutable for objects of the generalized element (parent). Superclass – the generalization of another class, the child. Subclass – the specialization of another class, the parent. Customer Corporate Customer Personal Customer

Generalization - characteristics Identify common features concerning behaviour and knowledge. Define these common features on a higher level in the inheritance hierarchy. The aim is at behaviour more than knowledge when combining classes. Generalization is a bottum-up process. A superclass includes all common properties of its subclasses.

Specialization - characteristics Define a new class which is a special appearance of an existing class. Specialization is a top-down process. A subclass can have attributes and operations that are specific for that sub-class. A subclass may redefine operations of its super-class.

Constraints The basic constructs of association, attribute, and generalization do much to specify important constraints. They cannot indicate every constraint. These constraints still need to be captured; the class diagram is a good place to do that. The UML allows you to use anything to describe constraints. The only rule is that you put them inside braces { }.

Remarks Class diagrams are the backbone of nearly all OO methods. The trouble with class diagrams is that they are so rich, they can be overwhelming to use. Start with: classes, associations, attributes, generalization, and constraints. If you are in the analysis stage of the project, draw conceptual models. File  New  Software  UML Model Diagram  UML Static Structure

Association class Association classes allow you to add attributes, operations, and other features to associations.

Association Class  Full Class Promoting an Association Class to a Full Class

Attribute Analysis It is not always clear which attributes belongs to which classes by finding out the class attributes. An attribute is assigned to that class where it is certainly a feature. For example: a project leader has the attributes name, department and age. But what to do with the attributes project number, project duration, starting time, and budget? These attributes clarifies something about the relation between project leader and type of project. This often happens if a n:m relation refers to an association between two classes. In that case, we can define a new class, for instance project management.

UML Classes UML has become an effective standard for object-oriented modelling. Object classes are rectangles with the name at the top, attributes in the middle section and operations in the bottom section. Relationships between object classes (known as associations) are shown as lines linking objects. Inheritance is referred to as generalisation and is shown ‘upwards’ rather than ‘downwards’ in a hierarchy.

Aggregation and Composition Aggregation is a special form of association that specifies a whole-part relationship between the aggregate (the whole) and a component (the part). Composition is a form of aggregation with strong ownership and coincident lifetime of the parts by the whole; parts with nonfixed multiplicity may be created after the composite itself, but once created they live and die with it; such parts can also be explicitly removed before the death of the composite. Fiets: Bike Wiel: Wheel Frame: Frame

Object diagram An object diagram is a diagram that shows a set of objects and their relationships at a point in time; object diagrams address the static design view or static process view of a system. An object diagram is shown as a class, and the name is underscored, although an object’s name can be shown optionally preceding the class name as: objectname: classname. The object does not have to be named, in which case only the classname is shown underscored.

NS Ticket service Define a use case diagram of ‘NS Ticket service’ Destination Define a use case diagram of ‘NS Ticket service’ Describe an use case. Take ticket

Use Case diagram ‘NS Ticket service’

Use Case Actors Preconditions Description Extension Exceptions Result   Use Case Buy OV Ticket Actors Traveller Preconditions Traveller has a valid pass Description Ticket device expects destination code Traveller enters destination code Extension point: NS ticket Ticket device checks code and calculates the charge. Shows destination code & fare. Activates ticket machine for paying Traveller pays (use case: Pay ticket) Ticket device print and supplies ticket Traveller takes ticket Extension Destination code = NS station. 3a. Ticket device expects ticket type 3b. Traveller enters Single/Return, Discount Y/N, Class Exceptions Traveller interrupt the interaction or walk away Traveller enters an incorrect destination code Payment is not finished off successful Result Traveller has ticket. (NS can look forward to the payment)  

Make a class diagram of ‘NS ticket service’ including the classes ‘Ticket’ and ‘Destination’

Structural modeling essentials

CRC (Class-Responsibility-Collaboration) - Card     <<Class>> Subscription <<Responsibility>> <<Collaboration>>