Вы находитесь на странице: 1из 53

DTEL (Department for Technology Enhanced Learning)

The Centre for Technology enabled Teaching & Learning , N Y S S, India

Teaching Innovation - Entrepreneurial - Global 1


DEPARTMENT OF COMPUTER
TECHNOLOGY
VII-SEMESTER
OBJECT ORIENTED MODELING

CHAPTER NO.1
Object Oriented Development

2
CHAPTER 1:- SYLLABUS

1 Object Oriented development


.

2 Modeling as a design technique

3 The three models

4 Links and Associations

5 Aggregation, Abstract Classes, Metadata, Packages

DTEL 3
CHAPTER-1 SPECIFIC OBJECTIVE / COURSE
OUTCOME
The student will be able to:

1 Understand the Object oriented concepts.

2 Modeling techniques.

DTEL 4
LECTURE 1 Object Oriented Concept

•What is model?
• Modeling consists of building an abstraction of reality.
• Abstractions are simplifications because:
• They ignore irrelevant details and
• They only represent the relevant details.
• What is relevant or irrelevant depends on the purpose of the model.

DTEL 5
LECTURE 1 Object Oriented Concept

•Why to model a System?


• Why model software?

• Software is getting increasingly more complex


• Windows XP > 40 mio lines of code
• A single programmer cannot manage this amount of code in its
entirety.
• Code is not easily understandable by developers who did not write it
• We need simpler representations for complex systems
• Modeling is a mean for dealing with complexity

DTEL 6
LECTURE 1 Object Oriented Concept

• A model is an abstraction describing a


subset of a system
• A view depicts selected aspects of a model
• A notation is a set of graphical or textual
rules for depicting views
• Views and models of a single system may
overlap each other

• Examples:
• System: Aircraft
• Models: Flight simulator, scale model
• Views: All blueprints, electrical wiring, fuel
7
system
DTEL 7
LECTURE 1 Object Oriented Concept

Models, Views and Systems (UML)

* *
System Model View
Described by Depicted by

Airplane: System

Scale Model: Model Flight Simulator: Model

Blueprints: View Fuel System: View Electrical Wiring: 8


View

DTEL 8
LECTURE 1 Object Oriented Concept

•Class?
.
•Object?

•Instance?

DTEL 9
LECTURE 1 Object Oriented Concept

•Object Orientation?
•Organize software as a collection of discrete
objects that can incorporate both data structure
and behavior.
•Object oriented approach include:
•Identity
•Classification
•Inheritance
•Polymorphism

10

DTEL 10
LECTURE 1 Object Oriented Development

•Development?
• Software development life Cycle : Analysis Design
and implementation.
•OO development is a conceptual process
independent of Programming language until the
final stage.
Why Modeling?
•Design flaws found earlier are more easy to
rectify.
•It encourages developers to think in terms of
application.
•So that details of data structures & functions
addressed effectively. 11

DTEL 11
LECTURE 1 Object Oriented methodology

• Object Oriented Methodologies are:


• System Conception
– Requirement gathering
• Analysis
– Analysis model is a concise, precise abstraction of
what the desired system must do, not how it will be
done.
– Domain model
• description of the real world objects
– Application Model
• Description of the parts of the application system.
• Application experts can check the application model.

DTEL 12
LECTURE 1 Object Oriented methodology

• System Design
• High – level strategy – the system architecture.
• Class Design
• Adds details to the analysis model in accordance
with the system design strategy.
• Implementation
• Translates the classes and relationships
developed during class design into a particular
programming language, database or hardware.

DTEL 13
LECTURE 1 Object Modeling in Practice

Foo

Amount
CustomerId

Deposit()
Withdraw()
GetBalance()

Class Identification: Name of Class, Attributes and Methods


Is Foo the right name?

DTEL 14
LECTURE 1 Object Modeling in Practice

“Dada” Foo

Amount Amount
CustomerId CustomerId

Deposit() Deposit()
Withdraw() Withdraw()
GetBalance() GetBalance()
Account

Amount
CustomerId

Deposit()
Withdraw()
Is Foo , Dada the right name? GetBalance()

DTEL 15
LECTURE 1 Object Modeling in Practice

Account

Amount Customer
Bank
Name
Name Deposit()
Withdraw()
GetBalance()

1) Find New Classes

2) Review Names, Attributes and Methods

DTEL 16
LECTURE 1 Object Modeling in Practice

THANK YOU

DTEL 17
LECTURE 2 Modeling as a design technique

Model serves various purposes.


• Testing a physical entity before building it
• Communication with customers
• Visualization
• Reduction of Complexity

18

DTEL 18
LECTURE LECTURE 2 SYSTEM
2:- NUMBER The Three Models

• Class Model
– Describes the structure of objects (data) in a
system.
• State Model
– Represents the control aspects of the system.
– Describes those aspects of objects concerned
with time and sequencing of operations
• Interaction Model
– Describes interaction between objects.

DTEL 19
LECTURE LECTURE 2 SYSTEM
2:- NUMBER The Class Model

Association
Class

Multiplicity
SimpleWatch
1 1 1
1 2 1
PushButton Display Battery Time

Class diagrams represent the structure of the system

DTEL 20
LECTURE LECTURE 2 SYSTEM
2:- NUMBER The Three Models

• Objects
• Is a concept, abstraction, or thing with identity
that has meaning for an application.
• It is an instance, or occurrence of a class.
• Classes
• Class describes a group of objects with the
same properties, behavior, kinds of
relationships, and semantics.

DTEL 21
LECTURE LECTURE 2 SYSTEM
2:- NUMBER The Class Model

THANK YOU

DTEL 22
LECURE 3 Links

• Links
– A link is a physical or conceptual connection
among objects.
– Eg. PD works for YCCE.
– Most links relate two objects.
– UML notation for link is line between objects.
– In programming links can not be modeled as it
is.
23

DTEL 23
LECTURE 3 Association

• Description of a group of links.


• Eg. Person Works for Company.
• Inherently bidirectional.
• The association name is optional if the model is
unambiguous.
• In programming association is implemented as
reference from one object to another.
• A reference is an attribute in one object that refers
to another object

DTEL 24
LECTURE 3 Association

TarifSchedule TripLeg

Enumeration getZones() Price


* *
Price getPrice(Zone) Zone

Associations denote relationships between classes


The multiplicity of an association end denotes how many objects the
instance of a class can legitimately reference.

DTEL 25
LECTURE 3 Association

Country 1 1 City

name:String name:String

1-to-1 association

Point
Polygon
* x: Integer

y: Integer
draw()

1-to-many association

DTEL 26
LECTURE 3 Association

Company

StockExchange * * tickerSymbol

DTEL 27
LECTURE 3

THANK YOU

DTEL 28
LECTURE 4 Multiplicity

• Specifies number of instances of one class that may


relate to a single instance of an associated class.
• Constraints the number of related objects.
• Eg. Many – to – many multiplicity
– One – to – one association
• Implementation of multiplicity
– Exposes hidden assumptions built into the model.

DTEL 29
LECTURE 4 Multiplicity

• Multiplicity defines how many objects participate in a


relationships
– The number of instances of one class related to
ONE instance of the other class
– Specified for each end of the association
• Associations and aggregations are bi-directional by
default, but it is often desirable to restrict navigation
to one direction
– If navigation is restricted, an arrowhead is added
to indicate the direction of the navigation

DTEL 30
LECTURE 4 Multiplicity

• Unspecified
• Exactly one
• Zero or more (many, unlimited)

• One or more
• Zero or one
• Specified range
• Multiple, disjoint ranges

DTEL 31
LECTURE 4 Links and Association

• Association end name


– Multiplicity refers to the end of association.
– Eg. One – to –many association has two ends, an
end with multiplicity one and many.
• Ordering
– Indicates explicit ordering of objects in model.

DTEL 32
LECTURE 4 Links and Association

• Qualified Association
– Disambiguate the objects for a “many”
association end.
– Eg.
• Generalization
– Relationship between a class and one or more
variations of the class.
– “is a ” relationship.

DTEL 33
LECTURE 4 Association

Without qualification
1 * File
Directory
filename

With qualification

1
Directory filename File

• Qualifiers can be used to reduce the multiplicity of


an association

DTEL 34
LECTURE 4

THANK YOU

DTEL 35
LECTURE 5 Navigating Class Model

• Model express the behavior of navigating among


classes.
• Traversing class model
– Attributes
– Operations
– Simple association
– Qualified association
– Association classes
– Generalization
– Filters (predicate)
DTEL 36
LECTURE 5 Aggregation, Abstract Classes, Metadata, Packages

• Abstract classes
• Has no direct instance.
• Defined methods that can be inherited by
subclasses.

DTEL 37
LECTURE 5 Abstract Classes

• Used to hold common operations and data


• Used in inheritance hierarchy
– Derived (child) classes provide implementations
• Documented with class name in italics
– Can also use {abstract} property

Shape
+move()
+erase() : void Shape
+draw() : void {abstract}
+move()
+erase() : void {abstract}
+draw() : void {abstract}

Circle Rectangle Triangle


+draw() : void +draw() : void +draw() : void
+erase() : void +erase() : void +erase() : void

DTEL 38
LECTURE 5 Aggregation

•An aggregation is a special case of association


denoting a “consists-of” hierarchy

•The aggregate is the parent class,


the components are the children classes
Exhaust system

1 0..2

Muffler Tailpipe
diameter diameter

DTEL 39
LECTURE 5 Aggregation

•A solid diamond denotes composition: A


strong form of aggregation where the life time
of the component instances is controlled by
the aggregate. That is, the parts don’t exist
on their won (“the whole controls/destroys the
parts”)

TicketMachine

3
ZoneButton

DTEL 40
LECTURE 5 Generalization

•Models the concept of inheritance

•Subclasses inherit the attributes and


operations of all their superclasses

•Objects of a subclass should be substitutable


for objects of their superclasses

•Uses hollow triangle arrowhead on superclass

DTEL 41
LECTURE 5 Generalization

Shape
+draw()

Rectangle Triangle Circle


+draw() +draw() +draw()

Square
+draw()

DTEL 42
LECTURE 5

THANK YOU

DTEL 43
LECTURE 6 Metadata

• Meatadata is a data that describes other data


• Eg. Class definition is metadata.
• Packages
– Group of elements with common theme.
– Partitions a model, making it easier to understand
and manage.
– Forms a tree with increasing abstraction towards
root.

DTEL 44
LECTURE 6 Metadata

– To devise a package
• Carefully decide each package’s scope
• Define each class in a single package
• Make package cohesive.
– Association and generalization should appear in
single package.

DTEL 45 45
LECTURE 6 Package

•Packages help you to organize UML models to


increase their readability
•We can use the UML package mechanism to organize
classes into subsystems

Account

Bank Customer

•Any complex system can be decomposed into


subsystems, where each subsystem is modeled as a
package.
DTEL 46 46
LECTURE 6

THANK YOU

DTEL 47 47
LECTURE 7 Strengths of Object Orientation

•A single paradigm
•Facilitates architectural and code reuse
•Models more closely reflect the real world
•More accurately describe corporate data and
processes
•Decomposed based on natural partitioning
•Easier to understand and maintain
•Stability
•A small change in requirements does not mean
massive changes in the system under
development

DTEL 48 48
LECTURE 7 Characteristics of OOD

•Objects are abstractions of real-world or


system entities and manage themselves

•Objects are independent and encapsulate


state and representation information.

•System functionality is expressed in terms of


object services

DTEL 49 49
LECTURE 7 Characteristics of OOD

•Shared data areas are eliminated


•Objects communicate by message passing

•Objects may be distributed

•Objects may execute sequentially or in parallel

DTEL 50 50
LECTURE 7 advantages of OOD

•Easier maintenance. Objects may be


understood as stand-alone entities

•Objects are appropriate reusable


components

•For some systems, there may be an


obvious mapping from real world entities to
system objects

DTEL 51 51
OBJECT 1:-
LECTURE ORIENTED CONCEPTS
NUMBER SYSTEM

THANK YOU

DTEL 52
OBJECT 1:-
LECTURE ORIENTED CONCEPTS
NUMBER SYSTEM

Text Book: Object – Oriented Modeling and


Design with UML

DTEL 53

Вам также может понравиться