Ooad Notes Units 1
Ooad Notes Units 1
Prepared By:
Mr. S.Santhosh Rajan Asst.Prof / CSE
SYLLABUS
UNIT – I
INTRODUCTION
4
Fig. 1.2. Car Methods
5
- When developing an object-oriented application, two basic questions always arise,
o What objects does the application needs?
o What functionality should those objects have?
2.1 Object-Oriented Philosophy
o Object oriented programming is that it allows the base concepts of the language
to be extended to include ideas and terms closer to those of its applications.
o The traditional development methodologies are either algorithm centric or data
centric
1. Algorithm-centric methodology: An algorithm that can accomplish the
task, and then build data structures for that algorithm to use.
2. Data-centric methodology: To structure the data, and then build the
algorithm around that structure.
o Object-oriented methodology is the algorithm and the data structures are
packaged together as an object, which has a set of attributes or properties.
2.2 Objects are grouped into classes
o Classes are used to distinguish one type of objects from another
o A class is a set of objects that share a common structure and a common behavior
o Each object is an instance of a class, refer Fig. 3 and 4
o A class is a specification of,
1. Structure (instance variable)
2. Behaviour (methods)
3. Inheritance for objects
Fig. 1.3. Ada, Riche, James and Writh are Fig. 1.4. Employee
objectsof the class Employee class
6
2.3 Attributes or properties
o It represented by data type.
o It describe the state of an object
o Eg. Car attributes, see Fig. 5.
7
o An object behaviour is described in methods or procedures
o A method implements the behaviour of an object.
o Behaviour denotes the collection of methods that abstractly describes what an
object is capable of doing.
o Eg. Drive a car – Methods, refer Fig.6.
8
Fig. 1.7. Object responds to message
2.6 Encapsulation and information hiding
o Information hiding is the principle of hiding internal data and procedures of an
object, refer Fig.8
9
Fig. 1.9. Super class / Sub class Hierarchy
3.1 Inheritance
o Inheritance is a relationship between classes where one class is the parent class of
another (derived) class, refer Fig. 11.
o Inheritance allows classes to share and reuse behaviours and attributes.
o The real advantage of inheritance is that we can build and reuse what we already
have.
10
Fig. 1.11. Inheritance allows reusability
o Dynamic Inheritance
1. It allows objects to change and evolve over time.
2. Dynamic inheritance refers to the ability to add, delete or change parents
from objects at run time.
3.2 Multiple Inheritance
o 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”. Refer Fig. 12.
Fig. 1.12. Utility vehicle inherits from both the car and truck class
11
3.3 Polymorphism
o Poly means “Many” and morph means “Form”
o Polymorphism means that the same operation may behave differently on different
classes. Refer Fig. 13 and 14
Fig. 1.15. Association represents the relationship among objects which is bidirectional
12
o Cardinality: it is an important issue in associations which specifies how
manyinstances of one class may relate to a single instance of a associated class.
o E.g., Client account relationship, refer Fig. 16.
- A special future of object-oriented system is that every object has its own unique and
immutable identity.
- The identity name never changes even it all the properties of the object change, i.e., it
is independent of the object’s state.
13
- The identity does not depend on the objects name, or its key or its location.
- In an object system, object identity often is implemented through some kind of “OBJECT
IDENTIFIER” (OID) or “UNIQUE IDENTIFIER” (UID). An OID is dispersed by a part
of object-oriented programming system that is responsible for guaranteeing the uniqueness
of every identifier.
- OID’s are never reused.
- E.g., The car may have an owner property, which refer the class person. A person has an
owns property that contains a reference to the car instance. The relationship between the
car and person can be implemented and maintained by a reference, refer Fig. 18.
Fig. 1.18. The owner property of the car contains the reference to the personinstance named Hal
14
6. Object Oriented – SDLC
- The essence of the software development process that consists of
• Analysis
• Design
• Implementation
• Testing
• Refinement
- To transform users’ needs into a software solution that satisfies those needs.
Fig. 1.19. Software process reflecting transformation from needs to a software product that
satisfiesthose needs.
15
o Transformation 1 (Analysis): Translates the users’ needs into system
requirementsand responsibilities.
o Transformation 2 (Design): Begins with a problem statement and ends with
adetailed design that can be transformed into an operational system.
o Transformation 3 (Implementation): Refines the detailed design into the
systemdeployment that will satisfy the user’s needs.
“An Example (see Fig. 20) of the software development process is Waterfall
approach”
16
3. Correctness: It measures the consistency of the product requirements
withrespect to the design specification
4. Verification: It is the exercise of determining correctness
o Verification: Am, I building the product, right?
o Validation: Am, I building the right product?
Validation begins as soon as the project starts, but verification can begin only after a
specification has been accepted. Validation & verification are independent of each other.
- The object oriented SDLC (Software Development Life Cycle) consists of 3 macro
processes, refer Fig. 22.
i) Object Oriented Analysis (OOA)
ii) Object Oriented Design (OOD)
iii) Object Oriented Implementation (OOI)
- It includes the following activities
1. Object Oriented Analysis – Use case driven
2. Object Oriented Design
3. Prototyping
4. Component based development
5. Incremental testing
17
Fig. 1.22. The object-oriented system development approach
a) The goal of OOD is to design the classes identified during the analysis phase
b) OOA and OOD are distinct disciplines, but they can be interconnected.
c) In OOD, design classes, define attributes and methods then build object and
dynamic model.
d) First build the object model based on objects and their relationship then iterate
and refine the model
a. Design and refine classes
b. Design and refine attributes
c. Design and refine the methods
d. Design and refine the structures
e. Design and refine the associations
e) Guidelines to use in your OOD
a. Reuse rather than build a new class know the existing classes
b. Design a large number of simple classes, rather than a small number of
complex classes
c. Design methods
d. A detailed analysis, what you have proposed. If possible, go-back and
refine the classes.
3) Prototyping
a) A prototype is a version of a software product developed in the early stages of the
products life cycle for specific, experimental purposes.
b) Prototyping can further define the use-cases, and actually makes use-case
modelling much easier.
c) Prototyping provides the developer a means to test and refine the user interface
and increase the usability of the system.
d) Prototypes have been categorized in various ways
a. Horizontal prototype:
a. It’s a simulation of the interface but contains no functionality.
b. An advantage is quick to implement.
b. Vertical prototype:
a. It is a subset of the system features with complete functionality.
b. An advantage is that the few implemented functions can be tested
in great depth.
c. Analysis prototype:
a. It is an aid for exploring the problem domain.
b. The final product will use the concepts exposed by the prototype,
not its code.
d. Domain prototype:
19
a. It is an aid for the incremental development of the ultimate software
solution.
b. It demonstrates the feasibility of the implementation.
4) Implementation: Component Based Development
o Component Based Development (CBD) is an industrial approach to software
development.
o Software components are functional units, or building blocks offering a collectionof
reusable services.
o A CBD developer can assemble components to construct a completesoftware system.
o A component-based development is concerned with the implementation and system
integration aspects of software development.
o CASE: Computer Aided Software Engineering Tools allow their users to rapidly
develop information systems.
o Goal: The main goal of CASE technology is the automation of the entire systems
development life cycle process using a set of integrated software tools, such as
modelling, methodology and automatic code generation.
o RAD: Rapid Application Development
o RAD is to build a version of an application rapidly to see whether we actually
understood the problem.
o It builds the application quickly through tools such as Delphi, Visual Age, Visual
Basic.
5) Incremental Testing
o To test an application for bugs and performance.
o After development of applications are finally given to Quality Assurance group for
testing the process.
20