1 Object-Oriented Modeling Using UML CS 3331 Fall 2009.

Slides:



Advertisements
Similar presentations
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
Advertisements

Improved software quality through semantic descriptions (Skutt) Karlstad University Dept. of Computer Science UML introduction A short introduction.
Objects and Classes OO model an approximate interpretation of real world – Objects represent real world entities which have identities, states and behaviors.
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
UML – Class Diagrams.
Chapter 14 (Web): Object-Oriented Data Modeling
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
Unified Modeling Language (UML)
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation (Adapted) Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra,
Chapter 14: Object-Oriented Data Modeling
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
Unified Modeling Language
Object-Oriented Analysis and Design
Introduction To System Analysis and design
Object Oriented Software Development
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.
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.
1 Object-Oriented Modeling Using UML (2) CS 3331 Fall 2009.
Unified Modeling Language, Version 2.0
1. 2 Object-Oriented Concept Class & Object Object-Oriented Characteristics How does it work? Relationships Between Classes Development Tools Advantage.
Object-Oriented Modeling Using Modified Modeling Language (UML)
Object-Oriented Modeling Using Modified Modeling Language (UML)
UML Diagrams: Class Diagrams The Static Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Object-Oriented Modeling Chapter 10 CSCI CSCI 1302 – Object-Oriented Modeling2 Outline The Software Development Process Discovering Relationships.
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.
CHAPTER 13 (ONLINE): OBJECT-ORIENTED DATA MODELING © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
1 © Prentice Hall, 2002 Chapter 14: Object-Oriented Data Modeling Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 15: Object-Oriented Data Modeling Modern Database Management 9 h Edition Jeffrey A.
Databases : Data Modeling 2007, Fall Pusan National University Ki-Joune Li.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 13 (Online): Object-Oriented Data Modeling Modern Database Management 10 th Edition.
CHAPTER 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
The Static Analysis Model Class Diagrams Prof. Hany H. Ammar, CSEE, WVU, and Dept. of Computer Science, Faculty of Computers and Information, Cairo University.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
1 Object-Oriented Modeling Using UML CS 3331 Section 2.4 Modeling Requirements with Use Cases.
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.
An Introduction to the Unified Modeling Language
BCS 2143 Object Oriented Design Using UML. Objectives Objects Interactions Finding Classes Relationship Between Classes Attribute and Operation Class.
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.
Object-Oriented Data Modeling
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.
Object-Oriented Modeling: Static Models Grady Booch, James Rumbaugh, and Ivar Jacobson, The Unified Modeling Language User Guide, 2 nd edition, Addison.
Software Engineering Lecture 8 Object-Oriented Analysis.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
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 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) Modern Database Management 11 th Edition Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson.
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.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Object-Oriented Modeling
Object-Oriented Analysis and Design
Class Diagram M. Seidl, et al., Introduction to Object-Oriented Modeling, Springer, Chaper 4. Soft copy (pdf) downloadable freely.
Class Diagram M. Seidl, et al., Introduction to Object-Oriented Modeling, Springer, Chaper 4. Soft copy (pdf) downloadable freely.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Object Oriented Analysis and Design
Lec 3: Object-Oriented Data Modeling
Software Engineering Lecture #11.
UML Class Diagram.
Understand and Use Object Oriented Methods
Presentation transcript:

1 Object-Oriented Modeling Using UML CS 3331 Fall 2009

2 Object-Oriented Modeling  Uses object-orientation as a basis of modeling  Models a system as a set of objects that interact with each others  No semantic gap (or impedance mismatch)  Seamless development process Data-oriented Conceptual/computational world Real world Abstraction Interpretation Object-oriented

3 Key Ideas of O-O Modeling  Abstraction  Encapsulation  Relationship Association: relationship between objects Inheritance: mechanism to represent similarity among objects  Object-oriented = object (class) + inheritance + message send

4 Objects vs. Classes Interpretation in the Real World Representation in the Model Object An object represents anything in the real world that can be distinctly identified. An object has an identity, a state, and a behavior. Class A class represents a set of objects with similar characteristics and behavior. These objects are called instances of the class. A class characterizes the structure of states and behaviors that are shared by all of its instances.

5 Object = Identity + State + Behavior  Identity Distinguishes an object from all other objects.  State Consists of a set of attributes (or fields), which have names, types, and values.  Behavior Defined by the set of operations (or methods) that may operate on the object. Each method has a name, a type, and a value, where  The type consists of the return type and the list of parameter types of the method, often called signature.  The value is the implementation of the method often expressed as a sequence of statements, in languages like Java and C++.

6 Class  Characterizes the structure of states and the behaviors shared by all instances.  Defines a template for creating or instantiating instances. Names and types of all fields Names, signatures, and implementations of all methods.

7 Unified Modeling Language (UML)  Notation for object-oriented modeling  Standardized by Object Management Group (OMG)  Consists of 12+ different diagrams Use case diagram Class diagram Statechart diagram Sequence diagram Collaboration diagram Component diagram …

8 Static vs. Dynamic Models  Static model Describes static structure of a system Consists of a set of objects (classes) and their relationships Represented as class diagrams  Dynamic model Describes dynamic behavior of a system, such as state transitions and interactions (message sends) Represented as statechart diagram, sequence diagrams, and collaboration diagrams

9 UML Class Diagram  Most common diagram in OO modeling  Describes the static structure of a system  Consist of: Nodes representing classes Links representing of relationships among classes  Inheritance  Association, including aggregation and composition  Dependency

10 Notation for Classes  The UML notation for classes is a rectangular box with as many as three compartments. ClassName field 1 …… field n method 1 … method n The top compartment show the class name. The middle compartment contains the declarations of the fields, or attributes, of the class. The bottom compartment contains the declarations of the methods of the class.

11 Example Point - x: int - y: int + move(dx: int, dy: int): void Point xyxy move Point

12 Field and Method Declarations in UML  Field declarations birthday: Date +duration: int = 100 -students[1..MAX_SIZE]: Student  Method declarations +move(dx: int, dy: int): void +getSize(): int VisibilityNotation public+ protected# package~ private-

13 Exercise  Draw a UML class diagram for the following Java code. class Person { private String name; private Date birthday; public String getName() { // … } public Date getBirthday() { // … }

14 Notation for Objects  Rectangular box with one or two compartments objectName: Classname field 1 = value 1 …… field n = value n The top compartment shows the name of the object and its class. The bottom compartment contains a list of the fields and their values. p1:Point x = 10 y = 20 p2:Point x = 20 y = 30

15 UML Notation for Interfaces interface Drawable { void draw(Graphics g); } + draw(g: Graphics): void Drawable + draw(g: Graphics): void > Drawable

16 Inheritance in Java  Important relationship in OO modeling  Defines a relationship among classes and interfaces.  Three kinds of inheritances extension relation between two classes (subclasses and superclasses) extension relation between two interfaces (subinterfaces and superinterfaces) implementation relation between a class and an interface

17 Inheritance in UML  An extension relation is called specialization and generalization.  An implementation relation is called realization. Superclass Subclass Superinterface Subinterface Interface Class extension of classes implementation of interfaces extension of interfaces

18 Inheritance in UML (Cont.)  Interpretation Models the is-a relationship Extension relation between classes: reusing or sharing of implementation (code) Extension relation between interfaces: expansion of service contracts. Implementation relation: implementation of contractual interfaces by classes

19 Example Student {abstract} Undergraduate Graduate {abstract} Nondegree MasterPhD

20 Exercise  Draw a UML class diagram showing possible inheritance relationships among classes Person, Employee, and Manager.

21 Association  General binary relationships between classes  Commonly represented as direct or indirect references between classes StudentCourse

22 Association (Cont.)  May have an optional label consisting of a name and a direction drawn as a solid arrowhead with no tail.  The direction arrow indicates the direction of association with respect to the name. Student Course enroll

23 Association (Cont.)  An arrow may be attached to the end of path to indicate that navigation is supported in that direction  What if omitted? Student Course enroll

24 Association (Cont.)  May have an optional role name and an optional multiplicity specification.  The multiplicity specifies an integer interval, e.g., l..u closed (inclusive) range of integers i singleton range 0..* entire nonnegative integer, i.e., 0, 1, 2, … Student Faculty adviseeadvisor 1 0..*

25 Example StudentCourse enroll advisee advisor Faculty teach 1..* 6..* 0..* 1 1

26 Exercise  Identify possible relationships among the following classes and draw a class diagram Employee Manager Department

27 Aggregation  Special form of association representing has-a or part-whole relationship.  Distinguishes the whole (aggregate class) from its parts (component class).  No relationship in the lifetime of the aggregate and the components (can exist separately). AggregateComponent

28 Composition  Stronger form of aggregation  Implies exclusive ownership of the component class by the aggregate class  The lifetime of the components is entirely included in the lifetime of the aggregate (a component can not exist without its aggregate). CompositionComponent

29 Example Department member-of Faculty College chair-of Student * 0..* 1..* University

30 Dependency  Relationship between the entities such that the proper operation of one entity depends on the presence of the other entity, and changes in one entity would affect the other entity.  The common form of dependency is the use relation among classes. Class1Class2 >

31 Example Registrar + addCourse(s: CourseSchedue, c: Course): void + removeCourse(s: CourseSchedue, c: Course): void + findCourse(title: String): Course + enroll(c: Course, s: Student): void + drop(c: Course, s: Student): void CourseSchedule Course Student Dependencies are most often omitted from the diagram unless they convey some significant information.

32 Group Exercise: E-book Store Develop an OO model for an e-bookstore. The core requirements of the e- bookstore are to allow its customers to browse and order books, music CDs, and computer software through the Internet. The main functionalities of the system are to provide information about the titles it carries to help customers make purchasing decisions; handle customer registration, order processing, and shipping; and support management of the system, such as adding, deleting, and updating titles and customer information. 1. Identify classes. Classes can represent physical objects, people, organizations places, events, or concepts. Class names should be noun phrases. 2. Identify relevant fields and methods of the classes. Actions are modeled as the methods of classes. Method names should be verb phrases. 3. Identify any inheritance relationships among the classes and draw the class diagram representing inheritance relationships. 4. Identify any association relationships among the classes and draw the class diagram representing association relationships. 5. Identify any aggregation and composition relationships among the classes and draw the class diagram representing dependency relationships.