Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Gokhale Education Society’s

HPT Arts and RYK Science College, Nashik – 422005


Department of Computer Science

S.Y.B.Sc.(Computer Science) Semester - I


CBCS Syllabus 2020 – 2021

CS 232 : Software Engineering


Chapter 4 : Requirements Modeling
Lecture No : 6

By
Subject Teacher : Mrs. Ahire Anuradha C.
Prerequisites : Object Oriented Concepts & Systems
 Object Oriented Concepts
 Relationships among Objects
 The state and services of an object
 Object-Oriented Programming

ACA, Department of Computer Science, GES's HPT Arts and RYK Science College, Nashik-05
Object Oriented Concepts :
Aggregation and Composition :
 An aggregation and Composition
are the special types of association.
 An aggregation and Composition
reflect the whole/part or parent/child
relationship.
 In aggregation and composition, an
object of one class can be the owner
of an object of another class.
 In both, the child objects belong to a
single parent object, i.e. they may
have only one owner.
 These are referred as a “part–of” or
“has–a” relationship.
,
ACA, Department of Computer Science, GES's HPT Arts and RYK Science College, Nashik-05
Object Oriented Concepts :
Aggregation :
 Aggregation is a specialized form of association between two
or more objects in which each object has its own life cycle but
there exists an ownership as well.
 Aggregation is a typical whole/part or parent/child relationship.
 An essential property of an aggregation relationship is that the
whole or parent (i.e. the owner) can exist without the part or
child and vice versa.
 Aggregation is represented by a line segment with a small
hollow diamond at its one end indicates assembly end.

ACA, Department of Computer Science, GES's HPT Arts and RYK Science College, Nashik-05
Object Oriented Concepts :
Generally aggregation implies containment. That is, if an object A
is an aggregation of objects B and C, then objects B and C will
generally be within object A. The main implication is that a
contained object cannot survive without its containing object.
Aggregation may have two types of containment.
Physical containment :
Example 1 : a computer is composed of monitor, CPU, mouse,
keyboard, and so on.
Conceptual containment :
Example 2 : shareholder has–a share.
Example 3 : In the relationship, “a car has a steering”, car is the
whole object or the aggregate, and the steering is a “part–of” the
car.

ACA, Department of Computer Science, GES's HPT Arts and RYK Science College, Nashik-05
Object Oriented Concepts :
Composition :
 Composition is a specialized form of aggregation.
 Like aggregation, composition is also a whole/part or parent/
child relationship.
 In composition, if the parent object is destroyed, then the child
objects also cease to exist.
 Composition is actually a strong type of aggregation and is
sometimes referred to as a “death” relationship.
 In composition the life cycle of the part or child is controlled by
the whole or parent that owns it i.e. the parent may be directly
responsible for the creation or destruction of the child.
 Composition implies a relationship where the child cannot
exist independent of the parent.
ACA, Department of Computer Science, GES's HPT Arts and RYK Science College, Nashik-05
Object Oriented Concepts :
Composition :
 Composition is represented using a line segment connecting
the objects with a solid diamond at the end of the object that
owns the other object.
Example : A house may be composed of one or more rooms. If
the house is destroyed, then all of the rooms that are part of the
house are also destroyed.

ACA, Department of Computer Science, GES's HPT Arts and RYK Science College, Nashik-05
Object Oriented Concepts :
Aggregation and Composition :
In an aggregation relationship, the life cycles of parent objects
and child objects are independent. In a composition relationship,
the death of a parent object also means the death of its children.

Aggregation Composition
ACA, Department of Computer Science, GES's HPT Arts and RYK Science College, Nashik-05
Object Oriented Concepts :
The state and services of an object :
 State of an object : The state or attributes are the built in
characteristics or properties of an object.
Example : A car has the brand, model, colour etc.
 Behavior of the object : The behavior or operations of an
object are its predefined functions or methods.
 The state and services of an object together define its
behavior.
 The behavior of an object is how an object reacts in terms of
state changes when it is acted on, and how it acts on other
objects by requesting services and operations.
 Generally, the defined operations of an object together specify
the behavior of the object.
 Objects represent the basic runtime entities in an OO system.

ACA, Department of Computer Science, GES's HPT Arts and RYK Science College, Nashik-05
Object Oriented Concepts :
The state and services of an object :
 Objects occupy space in memory that keeps its state and is
operated on by the defined operations on the object.
 A class defines a possible set of objects which have some
attributes, whose values constitute much of the state of an
object.
 The attributes an object has, are defined by the class of the
object.
 The operations allowed on an object or the services it
provides, are defined by the class of the object.
 A class is simply a definition that does not create any objects
and cannot hold any values.

ACA, Department of Computer Science, GES's HPT Arts and RYK Science College, Nashik-05
Object Oriented Concepts :
Object-Oriented Programming :
 Object-Oriented Programming (OOP) is a programming
paradigm based upon objects which have both data & methods.
 Its main aim is to incorporate the advantages of modularity and
reusability.
 Objects, usually instances of classes, are used to interact with
one another to design applications and computer programs.
The important features of object–oriented programming are…
 Bottom–up approach in program design.
 Programs organized around objects, grouped in classes.
 Focus on data with methods to operate upon object’s data.
 Interaction between objects through functions.
 Reusability of design through creation of new classes by adding
features to existing classes
Example : C++, Java, PHP, Python, C#, Perl.
ACA, Department of Computer Science, GES's HPT Arts and RYK Science College, Nashik-05
Object Oriented Concepts :
 When an object is created, gets a private copy of the instance
variables.
 When an operation defined on the class is performed on the
object, it is performed on the state of the particular object.
 The relationship between a class and objects of that class is
similar to the relationship between a type and elements of that
type.
 A class represents a set of objects that share a common
structure and a common behavior, whereas an object is an
instance of a class.
 Object–Oriented Programming has been defined as “a method
of implementation in which programs are organized as
cooperative collections of objects, each of which represents an
instance of some class, and whose classes are all members of
ACA, Department of Computer Science, GES's HPT Arts and RYK Science College, Nashik-05
Object Oriented Concepts :
a hierarchy of classes united via inheritance relationships”.
 The object model visualizes the elements in a software
application in terms of objects.

ACA, Department of Computer Science, GES's HPT Arts and RYK Science College, Nashik-05

You might also like