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:
Object-Oriented Analysis and Design
Chapter 1 Object-Oriented System Development
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Introduction To System Analysis and Design
COMP1007 Intro to Requirements Analysis © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to Requirements Analysis Object Oriented.
Slide 1 Systems Analysis & Design CS183 Spring Semester 2008 Dr. Jonathan Y. Clark Course Website:
Slide 1 Chapter 7 Structural Modeling. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
Basic OOP Concepts and Terms
Chapter Chapter 1 Introduction to Object-Oriented Programming and Software Development.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation (Adapted) Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra,
Object Oriented Software Development
BCS 2143 Introduction to Object Oriented and Software Development.
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.
Slide 1 Structural Modeling Chapter 7. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
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.
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.
Software Engineering Lecture 8 Object-Oriented Analysis.
Class Diagram Chapter 21 Applying UML and Patterns Craig Larman.
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.
UML Class & Object Diagram I
Chapter 0: Introduction
CHAPTER
Unified Modeling Language (UML)
Unified Modeling Language Tutorial
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
Programming in Java Sachin Malhotra, Chairperson, PGDM-IT, IMS Ghaziabad Saurabh Chaudhary, Dean, Academics, IMS Ghaziabad.
The OO Solution The OO model closely resembles the problem domain
Analysis and Design with UML: Discovering Classes and Relationships
OO Domain Modeling With UML Class Diagrams and CRC Cards
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
INTRODUCTION TO OOP Objective:
Analysis and Design with UML: Discovering Classes and Relationships
CSC 205 – Java Programming II
CSC 205 Programming II Lecture 2 Subclassing.
Interactions.
Analysis and Design with UML: Discovering Classes and Relationships
Object Oriented Analysis and Design
Chapter 10 Thinking in Objects
Engineering Quality Software
Software Engineering Lecture #11.
Object Oriented Analysis and Design Using the UML
Appendix A Object-Oriented Analysis and Design
Understand and Use Object Oriented Methods
Analysis and Design with UML: Classes and Relationships
Basic OOP Concepts and Terms
Object Oriented Analysis and Design
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.
ITEC324 Principle of CS III
From Class Diagram to Contract Diagram
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.

How does one show Classes and Objects in a Java Program?

public class Patient extends Person { private Journal patientsJournal; public Patient(String name, Doctor createdBy) { super(name); patientsJournal = new Journal(); patientsJournal.setCreatedBy(createdBy); patientsJournal.setConcerns(this); } public Journal getPatientsJournal(){ return patientsJournal; } public void setPatientsJournal(Journal patientsJournal) { this. patientsJournal = patientsJournal;

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

“Not all people feel at home in the categories male or female “Not all people feel at home in the categories male or female. Professor of sexology Esben Esther Pirelli Benestad believes there are seven different genders.” [https://www.nrk.no/norge/visste-du-at-det-finnes-sju-kjonn_-1.13057760] 1/14/2019

Object Behaviour time operations / behaviour sending a message canUse * canBeUseBy * operations / behaviour time sending a message Synchronous and also asynchronous “message passing”… lifeline for object office:CoffeeMachine

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

Domain Model What is a Domain Model “A domain model is a model of the domain within which an Enterprise conducts its business. The Domain Model for one Enterprise should be the same as that for any other Enterprise conducting business in the same do main. When we get down to more detailed levels, different people have different ideas about what constitutes a Domain Model.” [http://www.aptprocess.com/whitepapers/DomainModelling.pdf] describedBy given Domain 1/14/2019

A UML class diagram can be used to describe a domain model. Some would say that a domain model is an ontology. The model is a model of software which is the main purpose of UML. Domain Model describedBy given Domain Model specifiedBy specifies System 1/14/2019