Académique Documents
Professionnel Documents
Culture Documents
Object Web
Bapayya Choudhary Maganti
2-2-647/182/J, C. E. Colony, New Nallakunta, Hyderabad
- 500 013.
Phone: +91-(0)40-27406781, E-mail:
Course Contents
Object Oriented Background
Object Oriented Programming Concepts
Analysis
Use Case Modeling
Design
Object Modeling
CRC
Class Diagrams
Dynamic Modeling
Sequence Diagram
Collaboration Diagram
State Diagrams
Activity Diagrams
Component Diagram
Deployment Diagram
Case Study – Drawing Editor Problem
Background
Object Web
Bapayya Choudhary Maganti
2-2-647/182/J, C. E. Colony, New Nallakunta, Hyderabad
- 500 013.
Phone: +91-(0)40-27406781, E-mail:
What Is Object Orientation?
Term ‘Object-Orientation’ means.
The organization of software as a collection of discrete
objects that incorporate both data structure and behavior.
A new technology based on objects and classes.
Use of objects and classes in analysis.
Everything here is object and process is sending a
message to objects.
A language is object oriented if supports the following
four proprieties:
Abstraction.
Polymorphism.
Encapsulation.
Inheritance.
Object-based Vs Object-oriented
Object-based programming usually refers to
objects without inheritance and hence without
polymorphism.
These languages support abstract data types
and not classes, which provide inheritance and
polymorphism.
Object-oriented programming refers to the
objects with inheritance and polymorphism.
What Is the Background?
Arrived from Process.
Talk about the Behavior Centric not Data Centric.
Simula 67 the first Object Oriented Language, 1967.
Objects, Classes, Inheritance, Dynamic Typing.
Smalltalk first Pure Object Oriented Language, 1969.
Classes, Objects, Inheritance.
Dynamic Typing.
First Graphics Environment.
First Use of Mouse in Programming Environment.
Introduced first Multi Threaded Environment.
Form Parc of Xerox Corporation.
For more info look at parc.xerox.com.
OO Programming Languages
Statically-typed:
Memory allocation at compile time
No Runtime Class, Objects
Type Defined.
Example: C++
Dynamically-typed:
Memory Allocation at Run-time
Runtime Classes, Object
Runtime Inheritance
No Data types
Example: Smalltalk
Both:
Example: Java
Statically-Typed:
C++
Classic-Ada
Dragoon
Emerald/Jade
Object Pascal
Trellis/Owl
Dynamically-Typed:
Actors Language
C+@
Flavors
Python
Self
Smalltalk
Both:
Actor Eiffel
Ada95 Java
BETA Modula-3
Cecil Sather
CLOS B
Object-Oriented Operating Systems
Object-Oriented Operating Systems provide
resources through objects, sometimes all the
way down to to the machine.
These are almost always distributed systems
(DOS or DPOS), allowing objects to be passed
freely between machines.
Object-Oriented Operating Systems
Some of the Object-Oriented Operating
Systems:
Apertos.
Chorus Micro-kernel.
Choices.
GEOS.
Mach.
NachOS.
Ouverture Project.
Peace.
Spring.
Object-Oriented Databases
Object-oriented databases are databases that
support objects and classes.
They are different from the more traditional
relational databases because they allow
structured sub objects, each object has its own
identity, or object-id and because of support for
methods and inheritance.
Object-oriented Databases
It is also possible to provide relational
operations on an object-oriented database.
OODBs allow all the benefits of object-
orientation, as well as the ability to have a
strong equivalence with object-oriented
programs, an equivalence that would be lost if
an alternative were chosen, as with a purely
relational database.
List of Object-oriented Databases:
Research Systems Commercial Systems
AVANCE ArtBASE, EasyDB
CLOSQL GemStone
ConceptBase* ITASCA, Matisse
COOL/COCOON NeoAccess
Encore* OBST+
Exodus* O2, Objectivity
Machiavelli ObjectStore
MOOD4-PC* Ontos
OBST/STONE* Odapter/OpenODB program (HP)
Ode* Unisys Universal Repository
Oggetto Versant
Orion VisualWorks
OOFILE
OTGen
Phyla, POET
PLOB
Statice
VODAK UniSQL
Object-oriented Methodologies
List of Methodologies:
Bernard IBM
BON Jacobson
Booch Martin/Odell
Coad/Yourdon Ooram
Colbert Room
de Champeaux Rumbaugh
Embley Shlaer and Mellor
EVB Open
Rebecca Wirf’s UML
FUSION Wasserman
HOOD Wirfs-Brock
UML
Collection of concepts from various
methodologies.
From:
BOOCH.
RUMBAUGH.
JACOBSON.
Started in 1995.
Adapted by OMG.
Current Version 1.3.
Can be adapted for any application.
UML, Stepping ahead
Booch OMT OOSE Others
Object Web
Bapayya Choudhary Maganti
2-2-647/185, C. E. Colony, New Nallakunta, Hyderabad - 500 013.
Phone: +9140-7422414, E-mail: info@objweb.com, Web: www.objweb.com
What is an Object?
The entity which represents something
Objects is having a concrete physical form as
well as intelligence, because we not only
perceive them but also make them do
something.
Physical Object
An object may be invisible to the human eye
but having some basic form of intelligence.
Conceptual Object
SBI/K
Object have State, Behavior, Identity and
Knowledge about Other Objects
State is attributes
Behavior is methods
Identity is uniqness
Knowledge is message sent between to objects.
Public
Private
Protected
... Encapsulation
Abstraction takes care of what an object can
do i.e., the various operations it can perform
Encapsulation takes care of how it does it i.e.,
the attributes and the implementation details.
All objects have two parts
The abstracted visible part - INTERFACE
The encapsulated hidden - IMPLEMENTATION
What Is Achieved by Encapsulation?
Encapsulation is the process of hiding the
representation of an abstraction that make up
the structure of a class of objects and their
behavior.
If the implementation is modified we continue
to use the object without any modifications to
the interface.
According to Booch.
Intelligent encapsulation localizes design decisions
that are likely to change.
Refactoring
In Refactoring is the process of changing the
object without changing the Interface.
Interface is public method defined in Class
Note:
If an Object need implementation to be modified
without changing the interface it is terms ad
Refactoring.
This may not be possible always.
Refactoring minimizes the changes on other object.
This process ensures that the classes have right
level of coupling and will have minimum/no impact
on the collaborating classes.
Achieving Encapsulation
Smalltalk.
By default all attributes are private and methods are public.
It is only documentation process to achieve private
methods.
Java.
Variables and methods can be declared as private public
and protected.
Can have package level access modifiers and can mark
classes as private to package.
Can define inner classes, which have class scope.
C++.
Variables and methods can be declared as private, public
and protected.
Can have private, protected, public inheritance.
Why Public, Protected and Private
Attributes of class
Make sure that all attributes are declared as private
and give protected or public access modifiers (get
and set methods)
Methods of class
Make sure that all methods are declared as
protected (never private) and only those required
as public.
Different levels of Encapsulation
Collaboration level
Inheritance level
Package level
Level of Encapsulation
Collaboration level
Between two classes there exists public and private
methods where the collaborating class can access
only the public behavior of other class but not the
private behavior.
Inheritance level
Sub class is extension to the existing behavior of
the super class and it should be able to access all
the behavior of the super class.
Package level
Classes can be defined as public or private to
package and this should minimize the coupling
between the packages.
Inheritance
Car Van
... Generalization
An instance of a subclass is simultaneously an
instance of all its ancestor classes.
Each subclass not only inherits all the features
of its superior class, but adds its own specific
attributes and operations as well. It may
augment or restrict the existing structure and
behavior of a super-class.
Classes are related to one another via
inheritance relationships.
... Generalization
The most specialized class in a hierarchy is
known as the leaf class.
The most generalized class is known as the
base class.
The leaf classes are also known as concrete
classes.
Only the leaf class (or concrete class) will have
instances.
The base class and other intermediary classes
usually do not have any instances.
... Generalization
Abstract classes are not expected to have
instances of their own.
Abstract classes are written with the
expectation that its subclasses will add to its
structure the behavior which implements
methods.
Single inheritance means each subclass has
exactly one super-class.
Multiple inheritance means each such class
has more than one super-class.
... Generalization
The terms Generalization, Inheritance and
Specialization refer to the same underlying
idea, and are many a time used
interchangeably.
Generalization is used while modeling and
implementation. It facilitates modeling by
structuring classes and capturing what is
similar and what is different amongst classes.
Identify the behavior of different classes
Magnitude
Integer Float
ShortInteger LongInteger
Solution
Magnitude Abstract Methods: +, -, <, ==
Concrete Method: >, <=, >=, !=
Concrete: +, -, *, /, <, ==
Integer Float
Concrete: +, -, *, /, <, ==
ShortInteger LongInteger
factorial ( ), B
Problem
Build the hierarchy/classes for the following.
Identify all classes in a coordinate system.
Identify the major responsibilities of the classes.
For a drawing editor problem define the elements.
Rectangle.
Has start point, stop point, the diagnoll opposite corners
Line.
Has start point, stop point.
Circle.
Has center and radius.
Ellipse.
Has center, major radius, minor radius.
Solution
Shape Shape Point
Line
Rectangle
Ellipse Line Rectangle Ellipse
Point