Kyung Hee University Class Diagramming Notation OOSD 담당조교 석사과정 이정환.

Slides:



Advertisements
Similar presentations
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall A.1.
Advertisements

Object-Oriented Analysis and Design
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Objects and Classes First Programming Concepts. 14/10/2004Lecture 1a: Introduction 2 Fundamental Concepts object class method parameter data type.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
1 Basic Object Oriented Concepts Overview l What is Object-Orientation about? l What is an Object? l What is a Class? l Constructing Objects from Classes.
Unified Modeling Language (UML)
C++ Training Datascope Lawrence D’Antonio Lecture 11 UML.
© Copyright Eliyahu Brutman Programming Techniques Course.
Copyright 2004 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Second Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix.
Objectives Explain the purpose and objectives of object- oriented design Develop design class diagrams Develop interaction diagrams based on the principles.
Object Oriented Databases - Overview
Object-Oriented Analysis and Design
Object-Oriented Analysis and Design
Chapter 13 (Online): Object-Oriented Databases
Programming Languages and Paradigms Object-Oriented Programming.
UML Unified Modeling Language. What is UML? Unified Modeling Language (UML) is a standardized, general-purpose modeling language in the field of software.
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.
Design patterns. What is a design pattern? Christopher Alexander: «The pattern describes a problem which again and again occurs in the work, as well as.
Copyright 2001 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix A Object-Oriented.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Programming in Java Unit 3. Learning outcome:  LO2:Be able to design Java solutions  LO3:Be able to implement Java solutions Assessment criteria: 
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13: Introduction to Classes.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
7-1 © Prentice Hall, 2007 Chapter 7: Conceptual Data Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Unit 3 Conceptual Data Modeling. Key Concepts Conceptual data modeling process Classes and objects Attributes Identifiers, candidate keys, and primary.
Kyung Hee University System Functional Model OOSD 담당조교 석사과정 이정환.
UML diagrams What is UML UML diagrams –Static modeoing –Dynamic modeling 1.
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
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.
12 September, 2007Information System Design IT60105, Autumn 2007 Information System Design IT60105 Lecture 11 Class and Object Diagrams.
An Introduction to the Unified Modeling Language
UML The Unified Modeling Language A Practical Introduction Al-Ayham Saleh Aleppo University
1 The Unified Modeling Language. 2 The Unified Modeling Language (UML) is a standard language for writing software blueprints. The UML may be used to.
Unified Modeling Language. Object Oriented Methods ► What are object-oriented (OO) methods?  OO methods provide a set of techniques for analyzing, decomposing,
Part VII: Design Continuous
Design Model Lecture p6 T120B pavasario sem.
Object Oriented Analysis and Design Class and Object Diagrams.
1 Kyung Hee University Modeling with Objects Spring 2001.
Ch- 8. Class Diagrams Class diagrams are the most common diagram found in modeling object- oriented systems. Class diagrams are important not only for.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
Lecture 14 22/10/15. The Object-Oriented Analysis and Design  Process of progressively developing representation of a system component (or object) through.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
The UML Notations Networking LAB OOSD 담당조교 석사과정 이정환 Kyung Hee University.
Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.
Object Modeling THETOPPERSWAY.COM. Object Modelling Technique(OMT)  Building a model of an application domain and then adding implementation.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 13: Introduction to Classes.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Appendix A Object-Oriented Analysis and Design A.1.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Chapter 12 Outline Overview of Object Database Concepts Object-Relational Features Object Database.
Kyung Hee University System Functional Model OOSD 담당조교 석사과정 이정환.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
1 Kyung Hee University Interaction Diagrams Spring 2001.
WELCOME TO OUR PRESENTATION UNIFIED MODELING LANGUAGE (UML)
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
UML Diagrams By Daniel Damaris Novarianto S..
Business System Development
Design Class Diagrams
UML Diagrams Jung Woo.
SNSCT_CSE_PROGRAMMING PARADIGM_CS206
Chapter 12 Outline Overview of Object Database Concepts
Object Oriented Analysis and Design
Chapter 20 Object-Oriented Analysis and Design
Understand and Use Object Oriented Methods
Visual Modeling Using Rational Rose
Presentation transcript:

Kyung Hee University Class Diagramming Notation OOSD 담당조교 석사과정 이정환

Kyung Hee University Introduction  A class diagram is a static model that defines the system’s legal object configurations  Any objects that exist during the system’s execution must be instances of classes in the class diagram, and any relationships between those objects must be instances of associations between those object’s classes  A class diagram, therefore, is a key component of an object-oriented design

Kyung Hee University Introduction (cont’d)  UML offers a very rich class-diagramming notation  Basic class concepts and notation  Links and associations  Uncommon association notation  Aggregation  Class specialization  Dependencies  Notes  Extension mechanisms  A class diagram for order processing

Kyung Hee University Basic Class Concepts and Notation  The most fundamental concepts of object- oriented design and programming are classes and objects  Class definitions exist in the implementation source code. So, in that sense, a class diagram defines the overall static structure of a system

Kyung Hee University Basic Class Concepts and Notation (cont’d)  Classes and Objects  A class defines a collection of similar instances. It exists at compilation time and serves as a type. It defines the interface and implementation of its instances  An object is a particular instance of a class. Each object represents a particular instance of something in the problem or solution domain and is created as needed

Kyung Hee University Basic Class Concepts and Notation (cont’d)  Generally an object must have there properties  Identity  State  behavior

Kyung Hee University Basic Class Concepts and Notation (cont’d)  Attributes and Methods Figure 1. UML notation for attributes

Kyung Hee University Basic Class Concepts and Notation (cont’d) Figure 2. UML notation for operation

Kyung Hee University Basic Class Concepts and Notation (cont’d)  The expanded Java definition of the class is Class order { private int orderNumber; private float totalPrice; public void cancel() { /* implementation omitted here */ } public void commit() { /* implementation omitted here */ }

Kyung Hee University Basic Class Concepts and Notation (cont’d)  Class Attributes and Methods Figure 2. UML notation for class attributes and methods

Kyung Hee University Basic Class Concepts and Notation (cont’d)  When you need a generate a unique order number for each Order  A simple solution is to keep a running count of the number of orders that have been created and to use that count as an Order’s order number

Kyung Hee University Basic Class Concepts and Notation (cont’d) Class order { private static int numberOfOrders //…… public static int numberOfOrders() { /* implementation omitted here */ } //…… }  This means that there will be a single copy of the numberOfOrders fields that is shared by all Order instances

Kyung Hee University Basic Class Concepts and Notation (cont’d)  Notations for Method Categories and Class Compartment  Constructor : Initializes the instance (It is invoked only when an instance is created)  Query : Returns a value but does not change the state of the instance  Update : Carries out some action that may change the state of the instance  Destructor : Handles any cleanup required by the deletion of an instance (It is invoked only when an instance is deleted)

Kyung Hee University Basic Class Concepts and Notation (cont’d) Figure 3. Depicting the purpose of a method

Kyung Hee University Basic Class Concepts and Notation (cont’d)  Actors as Classes  External agents are called actors in UML. They interact with system, but are not a part of the system itself.  They are included in the class diagram so the way that they interact with the objects in the system can be modeled  UML treats actors as special stereotyped classes  Unlike a normal class, however, an actor class is a black box because you don’t have to implement it or understand its internal details

Kyung Hee University Basic Class Concepts and Notation (cont’d) Figure 4. The Telephone Agent actor class

Kyung Hee University Links and Associations  Links and Associations  Elements in class and object diagrams are not “islands”  Association between classes represents a structural property among the classes where the instances of one class may be linked to the instances of another Figure 5. A link between an Order and its Customer

Kyung Hee University Links and Associations (cont’d)  An object’s links to other objects may change at execution time

Kyung Hee University Links and Associations (cont’d)  Associations between Classes  An association is a relationship between classes in a class diagram Figure 6. An association between the Order and Customer classes

Kyung Hee University Links and Associations (cont’d)  Association Implementations  The association between Order and Customer described in Figure 6 must be implemented in both directions  An Order instance holds a reference to a single Customer instance Class Order { private Customer recipient; //… }

Kyung Hee University Links and Associations (cont’d)  The recipient field is of Customer type, meaning that you can store a reference to a Customer instance in that field  You can access that Customer instance using the contents of that field Class Order { private Customer recipient; //… Public String customerName() { return recipient.name(); }

Kyung Hee University Links and Associations (cont’d)  The customername method returns the results of calling the name method in this Order’s Customer object

Kyung Hee University Links and Associations (cont’d)  Ternary and Reflexive Associations

Kyung Hee University Links and Associations (cont’d)  While ternary (and lager) associations are permitted in UML, you should normally try to avoid them during design

Kyung Hee University Links and Associations (cont’d)  One reason is based on human cognition : Such associations are not intuitive and are somewhat difficult to describe  Another problem with ternary associations is that they have no standard implementation idioms  UML also allows reflexive (or recursive) associations in which a class has on association with itself

Kyung Hee University Links and Associations (cont’d)  Value versus Reference Semantics  Consider the class diagram in the next Figure. According to this diagram, each Customer instance will have a name (String) and a link to an Account instance.  If String is a class(as it is in Java, Smalltalk, and many C++ class libraries, including the C++ Standard Library), both the attribute and the association will be implemented as object references  Why,then,is one modeled as an attribute and the other as an association ?

Kyung Hee University Links and Associations (cont’d)  The difference between the two is that name has value semantics, whereas the Account link (in the act field) has reference semantics.  What’s difference ?  Identity  Sharing  Cardinality of values  Direction of navigation

Kyung Hee University Links and Associations (cont’d)

Kyung Hee University Links and Associations (cont’d)  Role Names  A class inherently plays a role in an association in which participates. From the Order’s point of view, the Customer is playing the role of a recipient – that is the Customer is the one who receives the contents of the Order Figure 7. Specifying the Customer’s role in the association

Kyung Hee University Links and Associations (cont’d)  One benefit of role names is that they can indicate (or be mapped to) instance variable names Class Order { private Customer recipient; //… }  Observe that the field name is recipient, which is the role Customer plays in its relationship with an Order

Kyung Hee University Uncommon Association Notation  Qualified association  A qualified association is an association in which an object on one end can employ a key to select either one, or a subset of the instances on the other end Figure 8. An association from Product Catalog to Catalog Item

Kyung Hee University Links and Associations (cont’d)