Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Lecture 02 Object Orientation and Analysis

orientation and analysis

Uploaded by

waqarhumayu0
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Lecture 02 Object Orientation and Analysis

orientation and analysis

Uploaded by

waqarhumayu0
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

Object Oriented Analysis and

Design
Overview
⚫ In this course we will learn to perform
analysis on a given domain and come up
with an Object-Oriented Analysis and
Design (OOAD).
⚫ Unified Modeling Language (UML) will be
used as a tool to demonstrate the analysis
and design ideas.
Analysis and Design
⚫ Analysis emphasizes on investigation of the
problem and requirements, rather than a
solution. For example, if a new e commerce sit is
desired, how will it be used? What are its
functions?(what the system will do, like user registration, product browsing, and order
processing.)

⚫ Design emphasizes a conceptual solution that


fulfills the requirements, rather than its
implementation. For example, a description of a
database schema and software objects.(how the system
will meet those requirements. It involves creating classes like Product, User, and Order)
What Is Analysis and Design?
Cont’d

Analysis and design have been


summarized in the phase,

do the right thing and do the thing


(analysis,understand the right (design,
requirements and problem, function, conceptual blueprint, object like
process, df) product, user, interaction )
Object–Oriented Analysis (OOA)

⚫ Object–Oriented Analysis (OOA) is the procedure


of identifying software engineering requirements
and developing software specifications in terms of
a software system’s object model(object, attribute), which
comprises of interacting objects.
Contd..
⚫ The primary tasks in object-oriented analysis (OOA) are −
⚫ Identifying objects
⚫ Organizing the objects by creating object model diagram(user,
product)

⚫ Defining the internals of the objects, or object attributes(id,name)


⚫ Defining the behavior of the objects, i.e., object
actions(register,login,update)
⚫ Describing how the objects interact(add, remove product)
⚫ The common models used in OOA are use cases and object
models.
Object Oriented Design (OOD)
⚫ in OO development design is to skillfully
A critical ability assign responsibilities to
software objects.(user object : logging in, registering, updating
profile)
Object-Oriented Design
⚫ Object–Oriented Design (OOD) involves
implementation of the conceptual model produced
during object-oriented analysis. In OOD, concepts
in the analysis model, which are
technology−independent, are mapped onto
implementing classes, constraints are identified,
and interfaces are designed, resulting in a model
for the solution domain, i.e., a detailed description
of how the system is to be built on concrete
technologies.
Analysis and design example
⚫ Let’s design a “dice game”
⚫ In which software simulates a player rolling
two dice. If the total is seven, they win;
otherwise, they lose.
Define Use case
Define Domain Model
Define Interaction diagram
(shows objects in a system interact with each other
through message exchanges to accomplish a specific goal)
Design Class diagram
(visually represents the structure of a system by showing its
classes, their attributes, methods, and the relationships
between the classes.)

• Sequence diagram leads to the partial design of class


diagram
• Since a play message is sent to a DiceGame object, the
DiceGame class requires a play method, while class Die
requires a roll and getFaceValue method.
• In contrast to the domain model showing real-world
classes, this diagram shows software classes.
Applying UML
⚫ UML is just a standard diagramming
notation. It is just a tool, not a skill that is
valuable in itself. Knowing UML helps
you communicate with others in creating
software.
Assigning Responsibilities
⚫ The most important skill in Object-Oriented
Analysis and Design is assigning
responsibilities to objects. That determines
how objects interact and what classes
should perform what operations.
⚫ Responsibility: The DiceGame object manages the overall flow of the
game.
⚫ Die object is responsible for its individual behavior, rolling and returning its
face value.
⚫ DiceGame , Rules,
⚫ Die, rolls)
Requirements Analysis
⚫ All Software Analysis and Design is preceded
by the analysis of requirements.
⚫ One of the basic principles of good design is
to defer decisions as long as possible.
⚫ The more you know before you make a
design decision, the more likely it will be that
the decision is a good one.
⚫ TFCL: Think First, Code Later!
Use Cases
⚫ Writing Use Cases is not a specifically
Object Oriented practice. But it is a best
practice for elaborating and understanding
requirements. So we will study Use Cases.
The Unified(standardized) Process

⚫ A standardized approach to analysis and


design helps to ensure that all necessary
tasks are understood and completed in
software development.
Other Necessary Skills
⚫ Requirements Analysis, Object-Oriented Analysis
and Object-Oriented Design are not a complete
toolkit for a software developer. There are many
other skills necessary in Software development,
including programming.
• For example, usability engineering and user interface
design are critical to success; so is database design. This
course only covers a subset of the necessary skills.
What is Object Oriented Analysis?

⚫ The emphasis is on finding and describing


the objects (or concepts) in the problem
domain.
⚫ In a Library Information System, some of the
concepts include Book, Library, and Patron.
What is Object Oriented Design?

⚫ The emphasis is defining software


objects and how they collaborate to fulfill
the requirements.
⚫ In a Library Information System, a Book
software object may have a title attribute
and a get Chapter method.
Objects and Classes

⚫ Object: An object is a real-world element in an object–oriented


environment that may have a physical or a conceptual existence. Each
object has identity that distinguishes it from other objects in the system.
⚫ State that determines the characteristic properties of an object as well
as the values of the properties that the object holds.
⚫ Behavior that represents externally visible activities performed by an
object in terms of changes in its state.
⚫ Objects can be modelled according to the needs of the application. An
object may have a physical existence, like a customer, a car, etc.; or an
intangible conceptual existence, like a project, a process, etc.
Contd..
⚫ Class: A class represents a collection of
objects having same characteristic properties
that exhibit common behavior. It gives the
blueprint or description of the objects that can
be created from it. Creation of an object as a
member of a class is called instantiation.
Thus, object is an instance of a class.
Encapsulation and Data Hiding
⚫ Encapsulation
⚫ Encapsulation is the process of binding
both attributes(data) and methods together
within a class. Through encapsulation, the
internal details of a class can be hidden
from outside. It permits the elements of the
class to be accessed from outside only
through the interface provided by the class.
Inheritance
⚫ Inheritance is the mechanism that permits new classes to be
created out of existing classes by extending and refining its
capabilities. The existing classes are called the base
classes/parent classes/super-classes, and the new classes
are called the derived classes/child classes/subclasses. The
subclass can inherit or derive the attributes and methods of
the super-class(es) provided that the super-class allows so.
Besides, the subclass may add its own attributes and
methods and may modify any of the super-class methods.
Inheritance defines an “is – a” relationship.
Contd..
⚫ Example
⚫ From a class Mammal, a number of classes
can be derived such as Human, Cat, Dog,
Cow, etc. Humans, cats, dogs, and cows all
have the distinct characteristics of mammals.
In addition, each has its own particular
characteristics. It can be said that a cow “is –
a” mammal.
Types of Inheritance
⚫ Single Inheritance − A subclass derives from a single super-
class.
⚫ Multiple Inheritance − A subclass derives from more than one
super-classes.
⚫ Multilevel Inheritance − A subclass derives from a super-class
which in turn is derived from another class and so on.
⚫ Hierarchical Inheritance − A class has a number of subclasses
each of which may have subsequent subclasses, continuing for
a number of levels, so as to form a tree structure.
⚫ Hybrid Inheritance − A combination of multiple and multilevel
inheritance so as to form a lattice structure.
Polymorphism
⚫ Polymorphism is originally a Greek word that
means the ability to take multiple forms. In
object-oriented paradigm, polymorphism
implies using operations in different ways,
depending upon the instance they are
operating upon. Polymorphism allows objects
with different internal structures to have a
common external interface. Polymorphism is
particularly effective while implementing
inheritance.
Example
⚫ Let us consider two classes, Circle and Square,
each with a method findArea(). Though the name
and purpose of the methods in the classes are
same, the internal implementation, i.e., the
procedure of calculating area is different for each
class. When an object of class Circle invokes its
findArea() method, the operation finds the area of
the circle without any conflict with the findArea()
method of the Square class.
Abstraction
Benefits of Object Model
⚫ Now that we have gone through the core
concepts pertaining to object orientation,
it would be worthwhile to note the
advantages that this model has to offer.
⚫ The benefits of using the object model
are −
⚫ It helps in faster development of
software.
Contd..
⚫ It is easy to maintain. Suppose a module
develop an error, then a programmer can fix
that particular module, while the other parts of
the software are still up and running.
⚫ It supports relatively hassle-free upgrades.
⚫ It enables reuse of objects, designs, and
functions.
⚫ It reduces development risks, particularly in
integration of complex systems.

You might also like