Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
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
OBJECT MODELING:
Attributes
Vertices
Border Color
Fill Color
Operations
Draw
Erase
Move
Resize
Model: View of the system
Stages of development: Analysis, design and testing etc.
MODELING PURPOSE:
To test a physical entity before using itAirplanes, cars and boats (model) are tested before putting them in market
MODELING PURPOSE:
Communication with customers Building model to show external looks (behavior)
MODELING PURPOSE:
Visualization Advertising and film scripts
MODELING PURPOSE:
• Reduction of complexity
OBJECT MODELING TECHNOLOGY:
Methodology that combines the following three views of modeling systems: Object Model
Dynamic Model
Functional Model
OBJECT MODEL:
Describes structure of objects in a systems Identity
Attributes
Operations
etc.
Provides the frame for dynamic and functional modeling.
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.
An object model is represented graphically with object diagrams containing object classes
Inheritance and other mechanism can be applicable on these classes.
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.
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)
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.
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.
• 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.
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
Person Class
Mary
Nency
George
Edward
Objects
Name.
Age, Sex
Attributes
ATTRIBUTES AND OPERATIONS:
Person
Name
Age
Change Job
Change address
ATTRIBUTES AND OPERATIONS:
Polygon
Color
Position
Move
Select
Rotate
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
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
CLASS DIAGRAM:
Country
Name
Capital
Name
Has capital
INSTANCE DIAGRAMS:
(Country)
Canada
(Capital)
Ottawa
Has capital
(Country)
France
(Capital)
Paris
Has capital
(Country)
India
(Capital)
New Delhi
Has capital
CLASS DIAGRAM:
Student
Int s _no
String s_name
Student ()
Exam()
Class Name
Attributes
Methods
INSTANCE DIAGRAMS:
S1
(Student )
s _no =1
s_name = “Micky”
Student ()
Exam()
S2
(Student )
s _no =2
s_name = “Donald”
Student ()
Exam()
TERNARY ASSOCIATION AND LINKS:
Project Language
Person
Class Diagram
TERNARY ASSOCIATION AND LINKS:
(Project)
Accounting
System
(Language)
FoxPro
(Person)
Mary
Instance Diagram
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.
MULTIPLICITY:
• optional, zero or one multiplicity
• one or many multiplicity
Workstation Window
zero or one
ONE TO ONE MULTIPLICITY:
(Country)
Canada
(Capital)
Ottawa
Has capital
(Country)
France
(Capital)
Paris
Has capital
(Country)
India
(Capital)
New Delhi
Has capital
MANY TO ONE MULTIPLICITY & ONE TO MANY MULTIPLICITY
Person CompanyWorks for
OR
A company has many persons working for it.
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.
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
LINK ATTRIBUTE FOR ONE TO MANY ASSOCIATION:
Person
NameSocial Security no
Address
Company
Name
Address
Works for
Salary
Job Title
Performance rating
Boss
Worker
PREFERRED FORMAT:
Person
NameSocial Security no
Address
Company
Name
Address
Works for
Salary
Job Title
DISCOURAGED FORMAT:
Person
NameSocial Security no
Address
Salary
Job Title
Company
Name
Address
Works for
Do not mix object attributes with link
attributes
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.
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
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.
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.
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
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.
AGGREGATION:
A Part-whole of or a part-off relationship
Document StatementsParagraphs
MULTI LEVEL AGGREGATION:
Microcomputer
Monitor System Box Mouse Keyboard
Chases CPU RAM Fan
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.
AGGREGATION AND GENERALIZATION:
Base SwitchWiring CoverFluorescent Simple
Lamp
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.
RECURSIVE AGGREGATES:
Program
Block
Simple
Statement
Compound
Statement
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.
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.
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.
ABSTRACT CLASSES:
Instance
Class
Abstract
Class
Concrete
Class
Leaf
Class
Non-leaf
Concrete
Class
Direct Instance
ABSTRACT & CONCRETE CLASSES:
CandleStick Maker
Butcher Baker
Worker
…
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
META DATA:
Person
Name
Age
weight
(person)
Joe smith
Age=39
Weight=158
(person)
Marry Willson
Age=32
Weight=132
Data
REFERENCE
• Ram Baugh J., etc., Object Oriented Modeling and Design, Prentice Hall of India, 1996.
• Eatlogos.com
• Clipartof.com
• Amazinganimations.com