Unit 1
Unit 1
OOA: we find and describe business objects or concepts in the problem domain
OOD: we define how these software objects collaborate to meet the requirements,
attributes and methods.
OOP: Implementation: we implement the design objects in, Java, C++, C#, etc.
Definition: Object-oriented analysis and design (OOAD) is a popular technical approach
for analyzing, designing an application, system, or business by applying the object oriented
paradigm and visual modelling throughout the development life cycles for better
communication and product quality.
Software development: It is dynamic and always undergoing major change.
Systems development refers to all activities that go into producing an information
systems solution. Systems development activities consist of systems analysis, modelling, design,
implementation, testing and maintenance.
A software development methodology is a series of processes describe how the work
is to be carried out to achieve the original goal based on the system requirements.
TWO ORTHOGONAL VIEWS OF THE SOFTWARE
Two Approaches,
Traditional Approach
Objected-Oriented Approach
Traditional Approach: Here Algorithms + Data structures = Programs. “A software
system is a set of mechanisms for performing certain actions on certain data.”
Difference between Traditional and Object Oriented Approach
Moving from one phase to another Moving from one phase to another
phase is complex phase is easier
Car
Cost
Color
Make
Model
For color, we could choose to use a sequence of characters such as red, etc.
Behavior (Object Behavior and methods);-
We can drive a car, we can ride an elephant, or the elephant can eat a peanut. Each of
these statements is a description of the object’s behavior. In the object model, object behaviour
is described in methods or procedures. A method implements the behavior of an object.
Messages (Objects respond to messages):
An object’s capabilities are determined by the methods defined for it. Methods
conceptually are equivalent to the functions definitions used in procedural languages. Objects
perform operations in response to messages. For example, when you press on the brake pedal of
a car, you send a stop message to the car object.
Messages essentially are non specific function calls: we would send a draw message to
a chart when we want the chart to draw itself. A message is different from a subroutine call,
since different objects can respond to the same message in different ways. For example, cars,
motorcycles, and bicycles will all respond to as top message, but the actual operations
performed are object specific.
Methods are similar to functions, procedures, or sub-routine in more traditional
programming languages, such as COBAL, Basic, or C. The methods and functions differ,
however, is in how they are invoked.
Figure: Objects respond to messages according to methods defined in its class.
Brake
Car Object
Information Hiding (and Encapsulations):- Information hiding is the principle of concealing
the internal data and procedures of an object and providing an interface to each object in such a
way to reveal as little as possible about its inner workings.
On object is said to encapsulate the data and a program. This means that user cannot see the
inside of the object “capsule,” but can use the object by calling the object’s methods.
Encapsulation or information hiding is a design goal of an object-oriented system.
Rather than allowing an object direct access to another object’s data, a message is sent to the
target object requesting information.
Another issue is per-object or per-class protection. Inner-class protection, the most
common form (e.g.,Ada,C++,Eiffel),class methods can access any object of that class and not
just the receiver. In per-object protection, methods can access only the receiver.
A car engine is an example of encapsulation.
CLASS HIERARCHY:- An object-oriented system organizes classes into a sub class – super
class hierarchy. Different behaviours are used as the basics for making distinctions between
classes and subclasses. At the top of the Class hierarchy are the most general classes and at the
bottom are the most specific.
A subclass inherits all of the properties and methods defined in its superclass.
Motor Vehicles
A car class defines how a car behaves. The ford class defines the behavior of ford class.
Formal or abstract classes have no instances but define the common behaviours that
can be inherited by more specific classes.
In some object-oriented languages, the terms superclass and subclasses are used instead
of base and derived.
Inheritance:- Inheritance is the property of object-oriented systems that allows objects to be
built from other objects. Inheritance allows explicitly taking advantage of the commonality of
objects when constructing new classes. Inheritance is a relationship between classes where one
class is the parent class of another (derived) class. The parent class is also known as the base
class or super class.
For example the car class defines the general behaviour of cars. The ford class inherits
the general behavior from the car class and adds behavior specific to fords.
Vehicle
Car
Ford
Dynamic inheritance allows objects to change and evolve over time. Since base classes
provide properties and attributes for objects, changing base classes changes the properties and
attributes of a class.
More specifically, dynamic inheritance refers to the ability to add, delete, or change
parents form objects (or classes) at run time.
Multiple inheritance:-
Some object-oriented systems permit a class to inherit its state (attributes) and
behaviors from more than one super class. This kind of inheritance is referred to as Multiple
Inheritance.
POLYMORPHISM:-
Poly means “many” and morph means “form”. In the context of object-oriented
systems, it means objects that can take on or assume many different forms. Polymorphism
means that the same operation may behave differently on different classes.
Booch defines polymorphism as the relationship of objects of many different classes by
some common super class.
Object Relationships
• There are two kinds of Relationships
• Generalization (parent-child reationship)
• Association (link b/w objects/class)
• Associations can be further classified as
• Aggregation (whole/part of relationship)
Composition (strong form of aggregation)
OO Relationships: Generalization
Associations represent the relationship between objects and classes. For example, in the
statement “a pilot can fly planes”(below figure), the italicized term is an association.
Planes
Pilot
Can fly flown by
A special feature of object – oriented system is that every object has its own unique
and immutable identity. An object’s identity comes into being when the object is created and
continues to represent that object from then on. This identity never is confused with another
object, even if the original object has been deleted.
In an object system, object identity often is implemented through some kind of object
identifier (OID) or unique identifier (UID).
Dynamic Binding (Static and Dynamic Binding):-
Objects have a life time. They are explicitly created and can exist for a period of time
that, traditionally, has been the duration of the process in which they were created. A filer or a
database can provide support for objects having a longer life line longer than the duration of the
process for which they were created.
From a language perspective, this characteristic is called object persistence.
An object can persist beyond application session boundaries, during which the object is
stored in a file or a database, in some file or database form. The object can be retrieved in
another application session and will have the same state and relationship to other objects as at
the time it was saved. The life time of an object can be explicitly terminated.
Meta-Classes