Class Modeling. Basic Class Modeling Concepts Object Class Link Association Generalization Inheritance.

Slides:



Advertisements
Similar presentations
Entity-Relationship (ER) Modeling
Advertisements

UML (cont.) “The Unified Modeling Language User Guide” by G. Booch, J. Rumbaugh and I. Jacobson ● Classes ● Relationships ● Class diagrams ● Examples.
Database Systems: Design, Implementation, and Management Tenth Edition
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
Entity-Relation Modeling Hun Myoung Park, Ph.D., Public Management and Policy Analysis Program Graduate School of International Relations International.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 14 (Web): Object-Oriented Data Modeling
Fundamentals, Design, and Implementation, 9/e COS 346 Day 2.
Chapter 2: Entity-Relationship Model (Continued)
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
Chapter 3 © 2005 by Prentice Hall 1 Objectives Definition of terms Definition of terms Importance of data modeling Importance of data modeling Write good.
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.
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas.
Entity Relationship Modeling Objectives: To illustrate how relationships between entities are defined and refined. To know how relationships are incorporated.
Data Modeling Using the Entity-Relationship Model
1 © Prentice Hall, 2002 CMIS564: E/R Modeling Dr. Bordoloi Based on Chapter 3; Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
CSE314 Database Systems Data Modeling Using the Entity- Relationship (ER) Model Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Data Modeling ERM ERD.
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.
UML Class Diagrams: Basic Concepts
Database Systems: Design, Implementation, and Management Ninth Edition
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Chapter 2: Modeling Data in the Organization
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 2/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Training: INSPIRE Basics EC JRC 1/15 UML class diagram: example INSPIRE UML class diagram for administrative units.
UML Diagrams: Class Diagrams The Static Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Chapter 2 Data Models Database Systems: Design, Implementation, and Management, Rob and Coronel Adapted for INFS-3200.
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.
7-1 © Prentice Hall, 2007 Week 5: Conceptual Data Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Databases : Data Modeling 2007, Fall Pusan National University Ki-Joune Li.
1 Class Diagrams: The Essentials. 2 Terms and Concepts A class is... The most important building block of any object-oriented system. A description of.
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.
Object Modeling (1) Chapter 3 (1) Part 1: Modeling Concepts Object-Oriented Modeling and Design Byung-Hyun Ha
An Introduction to the Unified Modeling Language
Initial Design of Entity Types for the COMPANY Database Schema Based on the requirements, we can identify four initial entity types in the COMPANY database:
Java™ How to Program, 10/e © Copyright by Pearson Education, Inc. All Rights Reserved.
Chapter 2 : Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of.
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.
Carnegie Mellon University © Robert T. Monroe Management Information Systems Data Modeling Management Information Systems Robert.
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,
Design? !… When it needs? To understand, to communicate with customers Complex problem What is good design? Separate What to do?(Policy) and How to do(mechanism)
Databases Illuminated Chapter 3 The Entity Relationship Model.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
1 Software Engineering Dr. K. T. Tsang Lecture 5 Class modeling
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.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 8 Entity-Relationship Modeling Pearson Education © 2009.
2 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Data Models Why data models are important About the basic data-modeling.
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.
Data Modeling Using the Entity- Relationship (ER) Model
Comp 1100 Entity-Relationship (ER) Model
Entity Relationship Modeling
Entity Relationship Model
Visit for more Learning Resources
The OO Solution The OO model closely resembles the problem domain
UML Class Diagrams: Basic Concepts
Object Oriented Analysis and Design
Chapter 3 Introduction to Classes, Objects Methods and Strings
UML Class Diagram.
Entity-Relation Modeling
Understand and Use Object Oriented Methods
Class Diagram.
Cheng (Sp2001): Object-Oriented Development Overview
Presentation transcript:

Class Modeling

Basic Class Modeling Concepts Object Class Link Association Generalization Inheritance

Objects The purpose of class modeling is to describe objects An object is a concept, abstraction, or thing with identity that has meaning for an application. Objects often appear as proper nouns or specific references in problem description and discussions with users.

Objects (cont.) Some objects have real-world counterparts, others are conceptual entities And others are introduced for implementation reasons and have no correspondence to physical reality The choice of objects depends on judgment and the nature of a problem; there can be many correct representations.

Objects (cont.) All objects have identity and are distinguishable The identity means that objects are distinguished by their inherent existence and by descriptive properties that may have.

Classes An object is an instance-or occurrence- of a class A class describes a group of objects with the same properties (attributes), behavior (operations), kinds of relationships, and semantics Classes often appear as common nouns and noun phrases in problem descriptions and discussions with users.

Class Diagrams Class diagram is a means for expressing models that is coherent, precise, and easy to formulate

Class diagrams (cont.) (1) class diagrams: Graphic notation for modeling classes and their relationships. Class diagrams corresponds to an infinite set of object diagrams (2) object diagrams: Shows individual objects and their relationships. Object diagrams are helpful for documenting test cases and discussing examples. There are two kinds of models of structure:

UML Notation of class diagram The UML symbol for an object is a box with an object name followed a colon and the class name. The object names and the class name are both underlined. The object name and class name in boldface by convention Singular nouns used for the names of classes JoeSmith:Person MarySharp:Person :Person

Values and Attributes A value is piece of data that lacks identity An attribute is an named property of a class that describes a value held by each object of the class Name, birthdate, and weight are attributes of Person objects Each attribute has a value for each object. For example: attribute birthdate has value 21 Octorber 1983 Each attribute name is unique within a class Object is to class as value is to attribute An attribute should describe values NOT objects

Values and Attributes (UML notation) The UML notation lists attributes in the second compartment of the class box. Optional details, such as type and default value, may follow each attribute. A colon precedes the type. And equal sign precedes the default value Person Name: string Birthdate: date JoeSmith:Person Name: JoeSmith Birthdate=21 October 1983

Operations and Methods An operation is a function or procedure that may be applied to or by objects in a class. The same operation may apply to many different classes. Such an operation is polymorphic; that is, the same operation takes on different forms in different classes. A method is the implementation of an operation for a class. When an operation has methods on several classes, it is important that the methods all have the same signature- the number and types of arguments and the type of result value. Feature is a generic word for either an attribute or operation.

Operations and Methods (UML notation) The UML notation is to list operations in the third compartment of the class box. parentheses enclose argument list, commas separate the arguments, a colon precedes the result type, parentheses enclose argument list that is empty therefore no arguments Person Name Birthdate changeJob changeAddress GeometricObject Color Position Move(delta : Vector) Select(p: Point) : Boolean Rotate (in angle: float=0.0) Test(p:Point,v:Vector)

Summary of Notation for classes Each argument may have a direction, name, type and default value. The direction indicates whether an argument is an input (in), output (out), or an input argument that can be modified (inout). A colon precedes the type. An equal sign precedes the default value, which is used if no argument is supplied for the argument. Direction argumentName : type = defaultValue The attribute and operation compartments of class boxes are optional, and you may or may not show them. ClassName attributeName1: dataType1=defaultValue1 attributeName2:dataType2=defaultValue2 operationName1 (argumentList1): resultType1 operationName2(argumentList2):resultType2

Link and Association Concepts Links and Associations Multiplicity Association End Names Association Classes Qualified Associations

Links and Associations A link is a physical or conceptual connection among objects. Most links relate two objects, but some links relate three or more objects. A link is an instance of an association. A association is a description of a group of links with common structure and common semantics. Links and associations often appear as verbs in problem statements

Many-to-many association Many-to-many association: An association describes a set of potential links in the same way that a class describes a set of potential objects The asterisk is a multiplicity symbol Multiplicity specifies the number of instances of one class that may relate to a single instance of another class The UML notation for a link is a line between objects; a line may consist of several line segments. If the link has a name, it is underlined. An association connects related classes and is also denoted by a line.

. Person name John:Person name=“John" Mary:Person name= “Mary" GE:Company name=“GE" Company name ** UML notation of Many-to-many association Sue:Person name= “Sue" Alice:Person name= “Alice" Jeff:Person name= “Jeff" IBM:Company name=“IBM"

The association name is optional, if the model is unambiguous. Ambiguity arises when a model has multiple associations among the same classes When there are multiple associations, you must use association names or association end names to resolve ambiguity. Developers often implement associations in programming languages as references from one object to another. A reference is an attribute in one object refers to another object.

Multiplicity Multiplicity: the number of instances of one class that may relate to a single instance of an associated class/ constraint on the size of a collection “1” (exactly one) “1..*” (one or more) “3..5” (three to five, inclusive) “*” equals “many” (zero or more)

. Country name Canada:Country name=“Canada" France:Country name= “France" Ottawa:CapitalCity name=“Ottawa" CapitalCity name 11 One to one association Sengal:Person name= “Sengal" Dakar:CapitalCity name=“Dakar" Paris:CapitalCitly name=“Paris" HasCapital

Zero-or-one multiplicity WorkstationWindow console

Multiplicity (continued) Cardinality: is the count of elements that are actually in a collection Underestimating multiplicity(“one”)…can restrict the flexibility of an application Overestimating multiplicity(“many”)…imposes overhead and requires the application to supply additional information to distinguish among the members of a “many” set

Association vs. link BA anA:AaB:B ** anAssociation A B ** anotherAssociation Class Diagram aLink anA:A aB:B aLink anotherLink Object Diagram

Association End Names Association end names: often appear as nouns Convenient for traversing associations (treat like a pseudo attribute) Company Person * employee employer WorksFor0…1

Association Classes Association Class: an association that is also a class Like the links of an association, the instances of an association class derive identity from instances of the constituent classes Like a class, an association class can have attributes and operations and participate in associations

UML notation of an association class Association Classes (continued) UML notation for an association class is a box (class box) attached to the association by a dashed line. AccessibleBy accessPermission File User **