Beruflich Dokumente
Kultur Dokumente
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 …
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
Public
Cohesion
Cohesion measures the extent of connectivity
among the elements of a single object or class.
The most desirable form of cohesion is the
FUNCTIONAL COHESION.
i.e. We check if elements comprising an abstraction
are truly representative of the behaviors.
You can't abstract an animal and a vehicle if
they don't serve the same semantic purpose.
Both animal and vehicle may be abstracted in the
class “LoadCarrier” but cannot be abstracted
together if we are looking at a race horse and a
passenger car.
Sufficiency
This means that the class captures in its
abstraction all the expected behavior of the
class for meaningful interaction.
For example
if we are designing a class 'UpdateItem', it makes
sense to include an operation that will add an item
or remove an item or modify an item.
Though this may sound very routine, it has been
noticed that many times we neglect or miss out to
include all the operations.
Completeness
This has two forms
Extension of sufficiency
A complete class or module is one whose interface is
general enough to be commonly usable to any client.
In other words the interface should be such that it covers
all aspects of the abstraction.
Extension of generalization
The class should have implemented all the expected
abstract or virtual functions of the super class.
The class hierarchy is considered to complete when all
the sub classes are defined and the sub-classes are
defined as per the minimum expectations of the super
class.
The Process of Abstraction
Booch says
Classes and objects should be at the right level of
abstraction;
Neither too high nor too low.
The process of abstraction, is incremental and
iterative.
We study the problem domain
Identify objects which may seem disparate in the beginning
Identify their relationship and group them in different classes
based on their common characteristics.
The identification of abstractions involves
Knowledge of the problem domain
Discovery
Invention.
Encapsulation
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 ( ), …
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