UML Class & Object Diagram I

Slides:



Advertisements
Similar presentations
Stereotypes Stereotypes provide the capability to create a new kind of modeling element. –They can be used to classify or mark modeling elements. –A type.
Advertisements

Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
Introduction To System Analysis and Design
Basic OOP Concepts and Terms
Chapter Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Object Oriented Software Development
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 1 Introduction to Object-Oriented Programming and.
BCS 2143 Introduction to Object Oriented and Software Development.
1 A Student Guide to Object- Orientated Systems Chapter 4 Objects and Classes: the basic concepts.
IS0514Slide 1 IS0514 Lecture Week 5 Introduction to Object Orientation.
Introduction To System Analysis and Design
Association Class Generalization/Specialization Whole-Part Page More Associations 1.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
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.
Basic OOP Concepts and Terms. In this class, we will cover: Objects and examples of different object types Classes and how they relate to objects Object.
BCS 2143 Object Oriented Design Using UML. Objectives Objects Interactions Finding Classes Relationship Between Classes Attribute and Operation Class.
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.
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.
Class Diagram Chapter 21 Applying UML and Patterns Craig Larman.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
COP 4331 – OOD&P Lecture 7 Object Concepts. What is an Object Programming language definition: An instance of a class Design perspective is different.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
OOP - Object Oriented Programming
CHAPTER
Unified Modeling Language (UML)
Object-Oriented Modeling
Sachin Malhotra Saurabh Choudhary
The Movement To Objects
Systems Analysis and Design
Visit for more Learning Resources
Course Outcomes of Object Oriented Modeling Design (17630,C604)
Inheritance Allows extension and reuse of existing code
Object-Oriented Analysis and Design
Class Diagrams.
Programming in Java Sachin Malhotra, Chairperson, PGDM-IT, IMS Ghaziabad Saurabh Chaudhary, Dean, Academics, IMS Ghaziabad.
Unified Modeling Language
The OO Solution The OO model closely resembles the problem domain
Analysis and Design with UML: Discovering Classes and Relationships
Object Oriented Programming
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
INTRODUCTION TO OOP Objective:
Analysis and Design with UML: Discovering Classes and Relationships
Software Architecture & Design Pattern
The OO Solution The OO model closely resembles the problem domain
Analysis and Design with UML: Discovering Classes and Relationships
Object Oriented Analysis and Design
Chapter 10 Thinking in Objects
Engineering Quality Software
Lec 3: Object-Oriented Data Modeling
Object Oriented Analysis and Design Using the UML
Appendix A Object-Oriented Analysis and Design
Understand and Use Object Oriented Methods
UML Class & Object Diagram I
Analysis and Design with UML: Classes and Relationships
Basic OOP Concepts and Terms
Object Oriented Analysis and Design
Object Oriented System Design Class Diagrams
Appendix A Object-Oriented Analysis and Design
Introduction to Object-Oriented Software Development
About Modelling.
UML  UML stands for Unified Modeling Language. It is a standard which is mainly used for creating object- oriented, meaningful documentation models for.
Cheng (Sp2001): Object-Oriented Development Overview
From Class Diagram to Contract Diagram
Software Architecture & Design
Chapter 20 Object-Oriented Concepts and Principles
Presentation transcript:

UML Class & Object Diagram I

Object-oriented modelling involves classes which function as types that describes their instances which are called objects. - You look around, and you see one particular chair, a table, a person, and you realize that the objects are related - the person is sitting on the chair by the table. - A system developed by using the object-oriented technique can be seen as a system consisting of a number of objects which cooperate to solve a task.

Object-oriented modelling includes description of: - object properties - links between objects - object behaviour - You look around, and you see one particular chair, a table, a person, and you realize that the objects are related - the person is sitting on the chair by the table. - A system developed by using the object-oriented technique can be seen as a system consisting of a number of objects which cooperate to solve a task.

Objects Icons representing “real world objects” of different types. myChair: :Bus :Plane :Truck :Ship PN62001:Car Represented in the UML notation. Anonymous object, only type is given Object name and no type Object name (id) and type At this moment you have x number of busses, one of them is represented by the buss picture.

Classify Objects Some objects share the same type of qualities so we may formulate a general concept = define a class. This is a form of abstraction - some of the differences between the objects are “abstracted away” (ignored). Furniture myChair: yourChair: theBrownSofa: (a person has a name, the same number of chromosomes, ... ) A class describes a set of objects that have the same type of attributes, behaviour and relationships.

Class and Objects UML Notation Person SSN name address drive() Run() ... class attributes (fields) operations (methods) class name person1:Person SSN = 123... name= Jane address=Norway person2:Person SSN = 122... name = James address = USA objects You when you declare the class you select which attributes and operations (behavior) are of interest for your system. Objects of the given class will have individual values for the specified attributes.

Making a Model You are to solves some problem in a domain. Simplify and find what is essential for your problem. OO modelling: ”Objects from reality” are mapped ”directly” onto objects in your model. chair: car: Tom: Seated in owner model mapping reality

Subclass and Superclass The class of human beings The subclass of ”female objects” People is superclass of Female Jane: James: Person Female Male The classes represented in the UML notation. Person Female Male

Class Hierarchy ~ Reuse by Inheritance An employee is a special type of person, so if you already have a Person class and needs an Employee class, then inheritance allows you to reuse class Person. Person SSN name address Employee title department An object of type Employee Jane:Employee SSN = 123... name = Jane address = Norway title = accountant department = accounting inheritance or specialization Employee is a specialisation of Person superclass subclass An object of type Employee is also a Person. An will have all attributes that a Person has plus all of its own.

Multiple Inheritance UML and OWL supports multiple inheritance. Some object-oriented theoreticians claim that multiple inheritance should not be used! (e.g., Java). Cassette volume : Integer Book CassetteBook Some times when we describe a new class we see that this new class should have characteristics from two (or more) existing classes. It is then possible to inherit from both classes.

One Common Ancestor for All Classes Object hashCode In Java all classes have a common ancestor called Object. In OWL it is called Thing. In C++ UML this is not the case. Person Car E.g., common operations: clone(), getClass() Employee

Linking Objects Class Model Objects are typically connected in some way or another. For example: Jane is married to James, Jane owns a car. ownership Person Car Class Model married association Object Model (model instance of the class model) :ownership Jane:Person someWreck:Car Draw associations… :married links James:Person

Part-of Relation Some objects can be seen as compost of other objects. Head 1 1 Arm 1 Person 2 1 2 Leg

There Are Typically Many Ways to Classify Objects Jim may be classified as a person, a male person, an employee, a student and so on - the context decides. the classes may overlap (or they may be disjoint) xxx: Big box could be Person small once could be Male and Employee…

How to model gender?

Different Models May be Possible! Person Gender Person gender : String Gender Person Female Male Female Male Gender Person ? Androgyni Female Male Undecided Big box could be Person small once could be Male and Employee… Gender Person Female Male Androgyni

Object Behaviour operations ~ behaviour sending a message time Synchronous and also asynchronous “message passing”…

An Object-Oriented Program ------ Objects Work Together and Solve Problems Objects have identity. Objects have state, the values of the attributes defines the state. The state change when the values of the attributes change. Some objects are linked together. The objects communicate by sending messages to each other (messages follows the links). Sending a message is the same as asking an object to perform one of its operations (methods).

Descriptive Models Model describedBy given System E.g. physics : - the system under study is nature (which is given) - the mission is to come up with a description (model) that is so good that it can be used to predict and explain natural phenomenon.

Specification (Prescriptive) & Descriptive Model The “specifiedBy role” is a specialization of the “describedBy role.” Model describedBy specifiedBy given describedBy specifiedBy specifies System System In physics the system under study is nature (which is given); the mission is to come up with a description (model) that is so good that it can be used to predict and explain natural phenomenon. The specification of a software system; the implementation (system) must conform to the model. A system is a group of interacting, interrelated, or interdependent elements that form a complex whole. Person Car :Person :Car 1 * name name=“Bob” :Car Model A Model Instance snapshot