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,

Slides:



Advertisements
Similar presentations
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
Advertisements

UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
Informatics 43 – May 7, Restatement of Goals for Testing Want to verify software’s correctness  Need to test  Need to decide on test cases  No.
Department of Informatics, UC Irvine SDCL Collaboration Laboratory Software Design and sdcl.ics.uci.edu 1 Informatics 43 Introduction to Software Engineering.
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 Diagram and Packages Written by Zvika Gutterman Adam Carmi.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
Design Patterns in Java Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
Class Diagram & Object Diagram
7M822 UML Class Diagrams advanced concepts 15 September 2008.
Programming With Java ICS201 University Of Hail1 Chapter 12 UML and Patterns.
7M822 UML Class Diagrams advanced concepts 14 October 2010.
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
© SERG Software Design (UML) Software Design Static Modeling using the Unified Modeling Language (UML) Material based on [Booch99, Rambaugh99, Jacobson99,
UML Class Diagrams: Basic Concepts. Objects –The purpose of class modeling is to describe objects. –An object is a concept, abstraction or thing that.
Object-Oriented Analysis and Design
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.
Software Construction Lecture 5 Class Diagrams. Agenda 2  Topics:  Examples of class diagrams  Navigation, visibility, named associations, and multiplicity.
© SERG Software Design (UML) Software Design Static Modeling using the Unified Modeling Language (UML) Material based on [Booch99, Rambaugh99, Jacobson99,
12-CRS-0106 REVISED 8 FEB 2013 CSG2H3 Object Oriented Programming.
UML Diagrams: Class Diagrams The Static Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
DOMAIN MODEL CLASS DIAGRAM Prepared by: Fatimah Alakeel November, 2011.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
Databases : Data Modeling 2007, Fall Pusan National University Ki-Joune Li.
Department of Informatics, UC Irvine SDCL Collaboration Laboratory Software Design and sdcl.ics.uci.edu 1 Informatics 43 Introduction to Software Engineering.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
Chapter 16 Applying UML and Patterns Craig Larman
® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 03. Classes,
UML Diagrams: The Static Model Class Diagrams. The Static Model Define the static structure of the logical model Represent classes, class hierarchies.
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.
Software Design Software Design (UML) Static Modeling using the Unified Modeling Language (UML) Material based on [Booch99, Rambaugh99, Jacobson99, Fowler97,
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.
2007ACS-3913 Ron McFadyen1 Class Diagram See Schaum’s UML Outline, especially chapters 4, 5, 6, 7.
Chapter 5 System Modeling Sommerville, "software engineering ", 9 th Ed., 2011.
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.
Class Diagram Chapter 21 Applying UML and Patterns Craig Larman.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
Programming With Java ICS201 University Of Hail1 Chapter 12 UML and Patterns.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #2 1.
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.
© SERG Software Design Static Modeling using the Unified Modeling Language (UML) Material based on [Booch99, Rambaugh99, Jacobson99, Fowler97, Brown99]
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
Class Diagrams Revisited. Parameterized Classes Parameterized Classes - are used to represent relationships between templates.
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.
Introduction to UML and Rational Rose UML - Unified Modeling Language Rational Rose 98 - a GUI tool to systematically develop software through the following.
Informatics 43 – May 5, Restatement of Goals for Testing Want to verify software’s correctness  Need to test  Need to decide on test cases  No.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Unified Modeling Language (UML)
UML Diagrams: Class Diagrams The Static Analysis Model
Lec-4 : Unified Modeling Language (UML)
Chapter 5: Structural Modeling
Course Outcomes of Object Oriented Modeling Design (17630,C604)
UML Class & Object Diagram II
UNIT-III.
Unified Modeling Language (UML)
UML Class Diagrams: Basic Concepts
UML Diagrams: The Static Model Class Diagrams
Object Oriented Analysis and Design
UML Class Diagram.
Unified Modelling Language
Understand and Use Object Oriented Methods
Static Modeling using the Unified Modeling Language (UML)
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.
Static Modeling using the Unified Modeling Language (UML)
Object Oriented System Design Class Diagrams
Class Diagram and Composite Structure Diagram P. P. Mahale
Presentation transcript:

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, operations, relationships, and semantics. Graphically, a class is rendered as a rectangle, usually including its name, attributes, and operations in separate, designated compartments.

Class Names Software Design (UML) ClassName attributes operations The name of the class is the only required tag in the graphical representation of a class. It always appears in the top-most compartment.

Class Attributes Software Design (UML) Person name : String address : Address birthdate : Date ssn : Id An attribute is a named property of a class that describes the object being modeled. In the class diagram, attributes appear in the second compartment just below the name-compartment.

Class Attributes (Cont’d) Software Design (UML) Person name : String address : Address birthdate : Date / age : Date ssn : Id Attributes are usually listed in the form: attributeName : Type A derived attribute is one that can be computed from other attributes, but doesn’t actually exist. For example, a Person’s age can be computed from his birth date. A derived attribute is designated by a preceding ‘/’ as in: / age : Date

Class Attributes (Cont’d) Software Design (UML) Person + name : String # address : Address # birthdate : Date / age : Date - ssn : Id Attributes can be: + public # protected - private / derived

Class Operations Software Design (UML) Person name : String address : Address birthdate : Date ssn : Id eat sleep work play Operations describe the class behavior and appear in the third compartment.

Class Operations (Cont’d) Software Design (UML) PhoneBook newEntry (n : Name, a : Address, p : PhoneNumber, d : Description) getPhone ( n : Name, a : Address) : PhoneNumber You can specify an operation by stating its signature: listing the name, type, and default value of all parameters, and, in the case of functions, a return type.

Depicting Classes Software Design (UML) Person name : String birthdate : Date ssn : Id eat() sleep() work() play() When drawing a class, you needn’t show attributes and operation in every diagram. Person name address birthdate Person eat play Person

Relationships Software Design (UML) In UML, object interconnections (logical or physical), are modeled as relationships. There are three kinds of relationships in UML: dependencies generalizations associations

Dependency Relationships Software Design (UML) CourseSchedule add(c : Course) remove(c : Course) Course A dependency indicates a semantic relationship between two or more elements. The dependency from CourseSchedule to Course exists because Course is used in both the add and remove operations of CourseSchedule.

Generalization Relationships Software Design (UML) Person A generalization connects a subclass to its superclass. It denotes an inheritance of attributes and behavior from the superclass to the subclass and indicates a specialization in the subclass of the more general superclass. Student

Generalization Relationships (Cont’d) Software Design (UML) Student UML permits a class to inherit from multiple superclasses, although some programming languages (e.g., Java) do not permit multiple inheritance. TeachingAssistant Employee

Association Relationships Software Design (UML) If two classes in a model need to communicate with each other, there must be link between them. An association denotes that link. Instructor Student

Association Relationships (Cont’d) Software Design (UML) We can indicate the multiplicity of an association by adding multiplicity adornments to the line denoting the association. The example indicates that a Student has one or more Instructors: Instructor Student 1..*

Association Relationships (Cont’d) Software Design (UML) The example indicates that every Instructor has one or more Students: Instructor Student 1..*

Association Relationships (Cont’d) Software Design (UML) We can also indicate the behavior of an object in an association (i.e., the role of an object) using rolenames. Instructor Student 1..* learns fromteaches

Association Relationships (Cont’d) Software Design (UML) We can also name the association. Team Student membership 1..*

Association Relationships (Cont’d) Software Design (UML) We can specify dual associations. Team Student member of 1..* president of 1 1..*

Association Relationships (Cont’d) Software Design (UML) We can constrain the association relationship by defining the navigability of the association. Here, a Router object requests services from a DNS object by sending messages to (invoking the operations of) the server. The direction of the association indicates that the server has no knowledge of the Router. Router DomainNameServer

Association Relationships (Cont’d) Software Design (UML) Associations can also be objects themselves, called link classes or an association classes. Warranty ProductRegistration modelNumber serialNumber warrentyCode

Association Relationships (Cont’d) Software Design (UML) We can model objects that contain other objects by way of special associations called aggregations and compositions. An aggregation specifies a whole-part relationship between an aggregate (a whole) and a constituent part, where the part can exist independently from the aggregate. Aggregations are denoted by a hollow-diamond adornment on the association. Car Engine Transmission

Association Relationships (Cont’d) Software Design (UML) A composition indicates a strong ownership and coincident lifetime of parts by the whole (i.e., they live and die as a whole). Compositions are denoted by a filled-diamond adornment on the association. Window ScrollbarTitlebarMenu *

Interfaces Software Design (UML) An interface is a named set of operations that specifies the behavior of objects without showing their inner structure. It can be rendered in the model by a one- or two-compartment rectangle, with the stereotype > above the interface name. > ControlPanel

Interface Services Software Design (UML) Interfaces do not get instantiated. They have no attributes or state. Rather, they specify the services offered by a related class. > ControlPanel getChoices : Choice[] makeChoice (c : Choice) getSelection : Selection

Interface Realization Relationship Software Design (UML) > ControlPanel VendingMachine A realization relationship connects a class with an interface that supplies its behavioral specification. It is rendered by a dashed line with a hollow triangle towards the specifier. specifier implementation

Interfaces Software Design (UML) A class’ interface can also be rendered by a circle connected to a class by a solid line. File outputStream inputStream FileWriter {file must not be locked} FileReader {file must exist}

Packages Software Design (UML) Compiler A package is a container-like element for organizing other elements into groups. A package can contain classes and other packages and diagrams. Packages can be used to provide controlled access between classes in different packages.

Packages (Cont’d) Software Design (UML) Classes in the FrontEnd package and classes in the BackEnd package cannot access each other in this diagram. FrontEndBackEnd Compiler

Packages (Cont’d) Software Design (UML) Classes in the BackEnd package now have access to the classes in the FrontEnd package. FrontEndBackEnd Compiler

Packages (Cont’d) Software Design (UML) JavaCompiler We can model generalizations and dependencies between packages. CompilerJava

Star UML: Entity-Control-Boundary Pattern Software Design (UML) Entity-Control-Boundary Pattern is a simplification of the Model-View-Controller Pattern

Star UML: Entity-Control-Boundary Pattern Software Design (UML) 1.Actors can only talk to boundary objects. 2.Boundary objects can only talk to controllers and actors. 3.Entity objects can only talk to controllers. 4.Controllers can talk to boundary objects and entity objects, and to other controllers, but not to actors