57
MODELING OBJECT TECHNOLOGY Dr. Priti Srinivas Sajja Professor G H Patel P G Department of Computer Science and Technology, Sardar Patel University, Vallabh Vidyanagar-388 120, Gujarat

MODELING OBJECT TECHNOLOGY

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: MODELING OBJECT TECHNOLOGY

MODELING OBJECT TECHNOLOGY

Dr. Priti Srinivas SajjaProfessor

G H Patel P G Department of Computer Science and Technology,

Sardar Patel University, Vallabh Vidyanagar-388 120, Gujarat

Page 2: MODELING OBJECT TECHNOLOGY

OBJECT MODELING:

Attributes

Vertices

Border Color

Fill Color

Operations

Draw

Erase

Move

Resize

Page 3: MODELING OBJECT TECHNOLOGY

Model: View of the system

Stages of development: Analysis, design and testing etc.

Page 4: MODELING OBJECT TECHNOLOGY

MODELING PURPOSE:

To test a physical entity before using itAirplanes, cars and boats (model) are tested before putting them in market

Page 5: MODELING OBJECT TECHNOLOGY

MODELING PURPOSE:

Communication with customers Building model to show external looks (behavior)

Page 6: MODELING OBJECT TECHNOLOGY

MODELING PURPOSE:

Visualization Advertising and film scripts

Page 7: MODELING OBJECT TECHNOLOGY

MODELING PURPOSE:

• Reduction of complexity

Page 8: MODELING OBJECT TECHNOLOGY

OBJECT MODELING TECHNOLOGY:

Methodology that combines the following three views of modeling systems: Object Model

Dynamic Model

Functional Model

Page 9: MODELING OBJECT TECHNOLOGY

OBJECT MODEL:

Describes structure of objects in a systems Identity

Attributes

Operations

etc.

Provides the frame for dynamic and functional modeling.

Page 10: MODELING OBJECT TECHNOLOGY

OBJECT MODEL:

Captures important real world concepts and also uses the same terminology as the environment.

Analysis model should not contain computer constructs unless the application itself is about the computer program, such as an operating system.

Page 11: MODELING OBJECT TECHNOLOGY

An object model is represented graphically with object diagrams containing object classes

Inheritance and other mechanism can be applicable on these classes.

Page 12: MODELING OBJECT TECHNOLOGY

DYNAMIC MODEL:

Describes the aspects of the system concern with time and the sequence of operation/events that

Mark changes

Sequence of events

Context for events and organization of events and stats.

Page 13: MODELING OBJECT TECHNOLOGY

DYNAMIC MODEL:

• The Dynamic Model is represented graphically with state diagrams.

• Each diagram shows the state and event sequence permitted in the system for a class of object

• State diagrams are used for other purpose also. Actions in state diagram Functions

Events Operations on objects (object model)

Page 14: MODELING OBJECT TECHNOLOGY

FUNCTIONAL MODEL:

• Describes the functions, mapping, constraints and functional dependencies.

• What system does without regard of how or when it is done.

• Represented with Data Flow Diagrams.

Page 15: MODELING OBJECT TECHNOLOGY

RELATIONSHIP BETWEEN MODELS:

• Each model describes an aspect of the system but contains reference to the other model.

• The object model describes the unit molecules of the other modeling approach.

• The object model describes the data structure on which other model operates.

Page 16: MODELING OBJECT TECHNOLOGY

• The operations in the object model correspond toevents in dynamic model and function into functionalmodel.

• Filling color is operation on an instances of a polygon class.

• The dynamic model describes the control structure ofobjects. It shows decisions which depend object valuesand which cause action that change object values andinvoke functions.

• The functional model shows the constraints on objectvalues.

Page 17: MODELING OBJECT TECHNOLOGY

SUMMARY

• Object model: Static structure in terms of

objects and relationship

• Dynamic: Control structure in terms of event

and states

• Functional model: Computational structure in

terms of values and functions

Page 18: MODELING OBJECT TECHNOLOGY

Person Class

Mary

Nency

George

Edward

Objects

Name.

Age, Sex

Attributes

Page 19: MODELING OBJECT TECHNOLOGY

ATTRIBUTES AND OPERATIONS:

Person

Name

Age

Change Job

Change address

Page 20: MODELING OBJECT TECHNOLOGY

ATTRIBUTES AND OPERATIONS:

Polygon

Color

Position

Move

Select

Rotate

Page 21: MODELING OBJECT TECHNOLOGY

LINKS:

• Physical or conceptual connections between object instances.

• A links is an instance of an association.

• Mathematically, it is an order pair of object instances.

• An association describes a group of links with common structure and common semantics

• e.g. works for line from a person to department/section link

Page 22: MODELING OBJECT TECHNOLOGY

LINKS:

• Often association and links are appear as verbs

• Associations and links are inherently bi-directional

• Forward and reverse direction may be implied on instances

• Associations are often implemented as pointers in a programming languages

• That is link/pointer is not a part of object

Page 23: MODELING OBJECT TECHNOLOGY

CLASS DIAGRAM:

Country

Name

Capital

Name

Has capital

Page 24: MODELING OBJECT TECHNOLOGY

INSTANCE DIAGRAMS:

(Country)

Canada

(Capital)

Ottawa

Has capital

(Country)

France

(Capital)

Paris

Has capital

(Country)

India

(Capital)

New Delhi

Has capital

Page 25: MODELING OBJECT TECHNOLOGY

CLASS DIAGRAM:

Student

Int s _no

String s_name

Student ()

Exam()

Class Name

Attributes

Methods

Page 26: MODELING OBJECT TECHNOLOGY

INSTANCE DIAGRAMS:

S1

(Student )

s _no =1

s_name = “Micky”

Student ()

Exam()

S2

(Student )

s _no =2

s_name = “Donald”

Student ()

Exam()

Page 27: MODELING OBJECT TECHNOLOGY

TERNARY ASSOCIATION AND LINKS:

Project Language

Person

Class Diagram

Page 28: MODELING OBJECT TECHNOLOGY

TERNARY ASSOCIATION AND LINKS:

(Project)

Accounting

System

(Language)

FoxPro

(Person)

Mary

Instance Diagram

Page 29: MODELING OBJECT TECHNOLOGY

MULTIPLICITY:

• How many instances of one class may relate to a single instance of an associated class?

• It can be one or many but always a set of non-negative integers.

Page 30: MODELING OBJECT TECHNOLOGY

MULTIPLICITY:

• optional, zero or one multiplicity

• one or many multiplicity

Workstation Window

zero or one

Page 31: MODELING OBJECT TECHNOLOGY

ONE TO ONE MULTIPLICITY:

(Country)

Canada

(Capital)

Ottawa

Has capital

(Country)

France

(Capital)

Paris

Has capital

(Country)

India

(Capital)

New Delhi

Has capital

Page 32: MODELING OBJECT TECHNOLOGY

MANY TO ONE MULTIPLICITY & ONE TO MANY MULTIPLICITY

Person CompanyWorks for

OR

A company has many persons working for it.

Page 33: MODELING OBJECT TECHNOLOGY

ASSOCIATIONS AND LINKS:

• Useful modeling construct

• Most of the object oriented language implements associations with object pointers.

• This may leads to optimization for implementation.

• Use of association objects is a design decision.

• An attribute is a property of a class.

• Similarly a links attribute is property of link in an association.

• Consider an association as a class where Each link is treated as a member of a class.

Link attribute can also be considered as separate objects if needed.

Page 34: MODELING OBJECT TECHNOLOGY

LINK ATTRIBUTE FOR MANY TO MANY ASSOCIATION:

File UserAccess by

/etc/termcap (read) Jhon Doe

/etc/termcap (read-write) Mary Brown

/usr/doe/.login (read-write) Jhon Doe

Access Permission

Page 35: MODELING OBJECT TECHNOLOGY

LINK ATTRIBUTE FOR ONE TO MANY ASSOCIATION:

Person

NameSocial Security no

Address

Company

Name

Address

Works for

Salary

Job Title

Performance rating

Boss

Worker

Page 36: MODELING OBJECT TECHNOLOGY

PREFERRED FORMAT:

Person

NameSocial Security no

Address

Company

Name

Address

Works for

Salary

Job Title

Page 37: MODELING OBJECT TECHNOLOGY

DISCOURAGED FORMAT:

Person

NameSocial Security no

Address

Salary

Job Title

Company

Name

Address

Works for

Do not mix object attributes with link

attributes

Page 38: MODELING OBJECT TECHNOLOGY

ROLE NAMES:

• A role is one end of an association.

• A binary association has two roles, each of which may have role name.

• A role name is a name that uniquely identifies one end of an association.

Page 39: MODELING OBJECT TECHNOLOGY

ROLE NAMES:

It provides a way of viewing traversal from one object to another object without explicitly mentioning the association.

Person Company

Employee Employer

Works for

Page 40: MODELING OBJECT TECHNOLOGY

ROLE NAMES:

• Role names are necessary for two objects from same class. For example, Boss and Worker distinguishes two employees in the manage association.

• The name of class can often serve as role name.

• All the roll name at the far end of association attached to a class must be unique.

• No role name should be used as attribute name.

Page 41: MODELING OBJECT TECHNOLOGY

ORDERING:

Objects on the many side of an associationhave no explicit order, and can be regardedas a set.

{ordered}

Visible on

• Workstation screen containing overlapping windows can be

explicitly ordered, so only the topmost window is visible to the

screen.

Page 42: MODELING OBJECT TECHNOLOGY

QUALIFICATION:

• A qualifies association relates two object classesand a qualifier.

• A qualifier is a special attribute that reduces theeffective multiplicity of an association

• One to many and many to many associationsmay be qualified.

Directory FilesFile name

A qualified associationA directory plus file name yields a file

Page 43: MODELING OBJECT TECHNOLOGY

QUALIFICATION:

• A qualifier often reduces multiplicity but not always.

• e.g.. A company is having many directors (board of directors) but a secretary and a treasurer.

Page 44: MODELING OBJECT TECHNOLOGY

AGGREGATION:

A Part-whole of or a part-off relationship

Document StatementsParagraphs

Page 45: MODELING OBJECT TECHNOLOGY

MULTI LEVEL AGGREGATION:

Microcomputer

Monitor System Box Mouse Keyboard

Chases CPU RAM Fan

Page 46: MODELING OBJECT TECHNOLOGY

GENERALIZATION AND INHERITANCE:

• Powerful abstraction for sharing similarities among classes while preserving the difference.

• They are transitive across an arbitrary number of layers.

• The notation of generalization is triangle connecting a super class into its subclass.

• One can write discriminator along with triangle symbol.

• Generalization is useful in modeling and implementation

• A Subclass may override a feature by defining a feature by same name.

• A module is a logical construct of grouping classes, associations and generalizations.

Page 47: MODELING OBJECT TECHNOLOGY

AGGREGATION AND GENERALIZATION:

Base SwitchWiring CoverFluorescent Simple

Lamp

Page 48: MODELING OBJECT TECHNOLOGY

TYPES OF AGGREGATES:

• Aggregation may be fixed, variable and recursive.

• The (previous) lamp example has fixed aggregatestructure.

• A variable aggregate has a finite number of levels. But the number of parts may vary.

• The company has division has departments is a variable aggregate with fixed two level structure, but departments may be many.

Page 49: MODELING OBJECT TECHNOLOGY

RECURSIVE AGGREGATES:

Program

Block

Simple

Statement

Compound

Statement

Page 50: MODELING OBJECT TECHNOLOGY

PROPAGATION:

• Propagation is also known as triggering.

• It is the automatic application of an operation to a network of objects when the operation is applied to a starting object.

• For example, while moving an aggregate objects, the “moving” operation also propagates to its all aggregates.

Page 51: MODELING OBJECT TECHNOLOGY

PROPAGATION OF OPERATION:

Person Para WordDocument

Owns

Copy Copy

Copy Copy Copy

• The copy operation propagates from documents toparagraphs to characters.

• The operation does not propagate in reverse order.

• Propagation is possible for save/restore, destroy, print, lockand display.

Page 52: MODELING OBJECT TECHNOLOGY

ABSTRACT CLASSES:

• It has no direct instances, but whose descendent classes have direct instances.

• A concrete class is a class that is instantiable.

• A concrete class may have abstract subclasses

• Only a concrete classes can be leaves in inheritance tree.

Page 53: MODELING OBJECT TECHNOLOGY

ABSTRACT CLASSES:

Instance

Class

Abstract

Class

Concrete

Class

Leaf

Class

Non-leaf

Concrete

Class

Direct Instance

Page 54: MODELING OBJECT TECHNOLOGY

ABSTRACT & CONCRETE CLASSES:

CandleStick Maker

Butcher Baker

Worker

Page 55: MODELING OBJECT TECHNOLOGY

MULTIPLE INHERITANCE:

• A class may inherit features from more than one super classes. Such a class is called as join class.

Vehicle

Water

Vehicle

Land

Vehicle

Amphibious

Vehicle

Car Boat

Page 56: MODELING OBJECT TECHNOLOGY

META DATA:

Person

Name

Age

weight

(person)

Joe smith

Age=39

Weight=158

(person)

Marry Willson

Age=32

Weight=132

Data

Page 57: MODELING OBJECT TECHNOLOGY

REFERENCE

• Ram Baugh J., etc., Object Oriented Modeling and Design, Prentice Hall of India, 1996.

• Eatlogos.com

• Clipartof.com

• Amazinganimations.com