0% found this document useful (0 votes)
109 views53 pages

Ooad PPT Unit II

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views53 pages

Ooad PPT Unit II

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

OOAD

Prof. Prerita Kulkarni


Curtesy by - Dr. Sanjeev Gour
Dept. of Computer Science
Medi-Caps University
Learning Path for OOAD

Phase-I Phase-II

▪ Introduction to Object-Oriented Concepts ▪ System Design

▪ Programming Foundations ▪ Modeling Relationships


▪ State and Activity Modeling
▪ UML Fundamentals
▪ Testing and Validation
▪ Design Principles and Patterns
▪ Real-world Applications and Case Studies
▪ Requirements Gathering and Analysis ▪ Practical Projects

2 OOAD-BCA V Sem September 14,


2024
Object Oriented Concept

Classes and Objects Polymorphism


Classes as blueprints or templates for creating objects. The ability of objects of different classes to be
treated as objects of a common superclass.
Objects as instances of classes, representing real-world
entities.
Encapsulation Abstraction
•Bundling data (attributes) and methods (functions) Hiding complex implementation details while
that operate on the data. exposing only essential features.
•Importance of access modifiers (public, private, Use of abstract classes and interfaces to define
protected) to control data visibility and common behaviors without providing full
manipulation. implementation.
Inheritance
Creating a new class based on an existing class
(superclass/base class).

3 OOAD- BCA V September 14,


2024

Software Engineering is a disciplined approach to designing, developing,
testing, and maintaining software systems in a systematic and efficient
manner. It involves applying engineering principles to the entire software
development lifecycle, from requirements gathering to deployment and
beyond. Just as civil engineers design bridges and buildings, software
engineers create digital solutions that power our modern world.
“ UNIT-II
CA3EL07
Static Modeling ?
Static modeling in (OOAD) is a
modeling technique used to capture
and represent the static structure of a
software system.
It focuses on the entities, classes,
objects, their attributes, relationships,
and constraints within the system.
Static modeling is concerned with how
the system is structured rather than
how it behaves dynamically. This
modeling technique is particularly
important during the early phases of
Key aspects of static modeling

❑ Classes
❑ Attributes
❑ Relationship
❑ Multiplicity
❑ Inheritance
❑ Packages and Modules
❑ Visibility & Access Control
Elaboration phase in static modeling

▪ The elaboration phase in static modeling of


(OOAD) is a critical stage in which the
structural aspects of a software system are
refined and detailed.

▪ During the elaboration phase, the goal is to


create a more comprehensive and precise
representation of the system's static
structure, including classes, attributes,
associations, and constraints.

8 OOAD-BCA-V Sem September 14,


2024
Elaboration phase
Example:
1. Refining Classes:
❑ Attributes: Define the attributes (data members)
for each class in more detail. Specify their data ▪ Attributes: if you have a "Person" class, you
types, access modifiers (public, private, might specify attributes like "Name," "Age," and
protected), and any initial values. "Address.“

❑ Methods: Elaborate on the methods (member ▪ Methods: For instance, for a "BankAccount"
functions) associated with each class. Describe class, you might define methods like "Deposit,"
their functionality, parameters, and return types. "Withdraw," and "CheckBalance."

9 BCA-V September 14,


2024
Elaboration phase
2. Describing Relationships: Example:
Association Details: If your initial conceptual model Association Details: for example, in a
included associations between classes, refine these
"Teacher-Student" association, you might specify
associations. Specify the multiplicity (e.g., one-to-one,
one-to-many) and roles (e.g., source, target) for each
that a "Teacher" can teach multiple "Students.“
end of the association.
Aggregation and Composition: If your model includes Aggregation and Composition: for instance, in a
aggregation or composition relationships (whole-part "Car-Engine" composition, specify that the
relationships), clarify the parts and their relationship to "Engine" is part of the "Car" and can't exist
the whole.
independently.
Generalization Hierarchy: If your conceptual model
introduced generalization relationships (inheritance),
Generalization Hierarchy: for example,
refine the inheritance hierarchy. Define the attributes FictionBook, NonFictionBook, define their
and methods for each subclass and specify any attributes and behaviors and specify their
additional attributes or behaviors that subclasses may relationship with the general class (e.g., Book).
have. 10 BCA-V September 14,
2024
Elaboration phase
3.Constraints: Example:
Define any constraints that apply to your classes. Constraints:
4. Visibility and Access Control: For instance, you might specify that a user must
be logged in to reserve a book.
Specify the visibility of attributes and methods.
Visibility and Access Control:
5. Validation:
For example, you may make certain attributes
Review and validate your refined class definitions
private to restrict direct access and enforce
and relationships with stakeholders, domain
encapsulation.
experts, and the development team. Ensure that
your model accurately represents the system's
structure and requirements.

11 BCA-V September 14,


2024
Domain Model

❑ In OOAD, a domain model refers to a


conceptual representation of the
problem domain. It is a fundamental
artifact used in the early stages of
software development to
understand, analyze, and document
the key concepts, entities,
relationships, and behaviors that
exist within the problem space,
without diving into implementation
details.
12 OOAD-BCA- V Sem September 14,
2024
Role of a Domain Model in OOAD

✔ Understanding the Problem Domain


✔ Requirements Clarification
✔ Communication
✔ Abstraction
✔ Basis for Design

13 OOAD-BCA- V Sem September 14,


2024
Conceptual classes and Description classes

❑ Conceptual classes in static ❑ A Description class is used to


modeling represent high-level, provide detailed and concrete
abstract entities or concepts within descriptions of how specific
the problem domain. conceptual classes will be
implemented in code.
❑ Conceptual classes are not tied to
❑ Description classes contain
any specific implementation details
attributes, methods, and other
or programming constructs;
implementation-specific details that
instead, they capture essential
define the structure and behavior of
ideas, objects, or entities that are
objects created from these classes.
relevant to the problem at hand.
❑ It serve as a bridge between
conceptual classes and the actual
implementation of software classes
and objects.
14 Annual Review September 14,
2024
Finding conceptual
classes

❑ Finding conceptual classes in OOAD is a


crucial step in understanding the
problem domain and laying the
foundation for the software system.
❑ The identification of conceptual classes
is an iterative process and should
involve collaboration with domain
experts and stakeholders. The goal is to
create a shared understanding of the
problem domain, laying the groundwork
for designing a software system that
accurately represents that domain.

15 September 14,
2024
How to find Conceptual classes ?

❑ Domain Understanding: ❑ Gathering Requirements:


❑ Method: Deeply immerse yourself in
❑ Method: Analyze requirements
the problem domain by conducting
documents, use cases, and user
interviews, workshops, and
stories to identify nouns and noun
discussions with domain experts
phrases that represent potential
and stakeholders.
conceptual classes.
❑ Example: In a healthcare domain,
domain experts can help identify ❑ Example: In an e-commerce system,
conceptual classes like "Patient," requirements might mention
"Doctor," and "Appointment." "Product," "Customer," and "Order"
as important concepts.

16 BCA-V September 14,


2024
How to find Conceptual classes ?

❑ Brainstorming: ❑ Observation:
❑ Method: Organize brainstorming
❑ Method: Observe real-world
sessions or workshops with
processes and objects related to the
stakeholders to elicit and define
problem domain, taking note of
relevant concepts.
entities and concepts.
❑ Example: In an educational
software project, brainstorming ❑ Example: For a transportation
might reveal conceptual classes like management system, observations
"Course," "Student," and "Teacher." might lead to the identification of
"Vehicle," "Route," and "Driver" as
conceptual classes.

17 Annual Review September 14,


2024
How to find Conceptual classes ?

❑ Review Existing Documentation: ❑ Use Case Analysis:

❑ Method: Analyze use cases to


❑ Method: Review any existing identify actors (representing entities
domain-related documentation, in the problem domain) and the
standards, regulations, or actions they perform, which can lead
industry-specific materials. to the discovery of conceptual
❑ Example: In financial software classes.
development, existing
documentation may highlight ❑ Example: In a reservation system,
"Account," "Transaction," and use cases involving "Customer" and
"Customer" as key conceptual "Reservation" suggest the presence
classes. of these conceptual classes.
18 Annual Review September 14,
2024
How to find Conceptual classes ?

❑ Classify Nouns: ❑ Entity-Relationship Diagrams (ERDs):

❑ Method: Construct
❑ Method: Go through textual entity-relationship diagrams to
descriptions, identifying nouns and visualize entities (conceptual
noun phrases, and classify them as classes) and their relationships.
potential conceptual classes.
❑ Example: In a social networking ❑ Example: In a database modeling
platform, nouns like "Profile," context, an ERD might reveal
"Friend," and "Post" can be conceptual classes like "Employee,"
classified as conceptual classes. "Department," and "Project."

19 Annual Review September 14,


2024
How to find Conceptual classes ?

❑ CRC Cards ❑ Competitive Analysis:


(Class-Responsibility-Collaboration
): ❑ Method: Analyze competitors'
products or systems to identify
❑ Method: Use CRC cards as a
common conceptual classes.
collaborative tool, where
stakeholders write down classes
❑ Example: In the smartphone
(concepts), their responsibilities,
industry, common conceptual
and how they collaborate.
classes include "User," "App," and
❑ Example: In a gaming system, CRC "Settings."
cards might result in identifying
conceptual classes like "Player,"
"Game," and "Score."
20 Annual Review September 14,
2024
Finding Description
classes

❑ Finding description classes in


Object-Oriented Analysis and Design
(OOAD) is an essential step in the design
phase. Description classes provide
detailed specifications for how the
software system's conceptual classes
will be implemented.

21 September 14,
2024
How to find Description classes ?

❑ Refinement from Conceptual ❑ Use Case Analysis:


Classes:
❑ Method: Analyze use cases and user
❑ Method: Start with the conceptual
stories to identify actions or
classes identified during the
scenarios that involve interactions
analysis phase and refine them into
with specific conceptual classes.
description classes by specifying
These interactions can suggest the
attributes, methods, and other
need for description classes.
implementation details.
❑ Example: If you have a conceptual ❑ Example: In a banking system, if a
class "Student," you can refine it use case involves "Account
into a description class Transactions," you might create a
"StudentRecord" by specifying description class called
attributes like "StudentID" and "Transaction" to handle these
22 September 14,
methods like "EnrollInCourse()".
BCA-V
2024 transactions.
How to find Description classes ?

❑ Identifying Behavior Needs: ❑ Data Modeling:


❑ Method: Examine the behavior
❑ Method: Construct data models such
required for the conceptual classes.
as entity-relationship diagrams
If certain behaviors require specific
(ERDs) or database schemas to
attributes and methods, create
define the structure of your data.
description classes to encapsulate
These models can help identify
these behaviors.
description classes for data
❑ Example: For a conceptual class management.
"Order," you might create a
description class "OrderProcessor" ❑ Example: In a database schema, you
to handle order processing may define a table "Product" as a
methods like "PlaceOrder()" and description class to manage
"CancelOrder()". product-related attributes and
23 BCA-V September 14,
2024 operations.
How to find Description classes ?

❑ Functional Decomposition: ❑ Responsibility Analysis:


❑ Method: Break down complex
❑ Method: Analyze the responsibilities
conceptual classes into smaller,
of conceptual classes. Identify
more manageable description
attributes and methods that should
classes based on the principle of
be encapsulated within separate
decomposition. Each description
description classes based on the
class represents a specific aspect
Single Responsibility Principle (SRP).
of the original concept.
❑ Example: If a conceptual class
❑ Example: If the conceptual class "Employee" has responsibilities for
"Vehicle" is too complex, you might both payroll calculations and leave
create description classes like "Car" management, you might create
and "Motorcycle" to represent separate description classes
specific types of vehicles. "PayrollProcessor" and
24 BCA-V September 14,
2024 "LeaveManager."
How to find Description classes ?

❑ Collaboration Identification: ❑ Pattern Application:


❑ Method: Identify collaborations
❑ Method: Apply design patterns as
between conceptual classes that
needed to structure your description
require specific interactions. Create
classes. Design patterns often
description classes to manage
suggest the creation of specific
these collaborations effectively.
classes with well-defined roles.
❑ Example: If "Customer" and "Order"
collaborate frequently, you might ❑ Example: The Observer pattern may
create a description class lead to the creation of a description
"OrderManager" to handle class like "EventSubscriber" to
order-related operations. manage event subscriptions and
notifications.
25 BCA-V September 14,
2024
How to find Description classes ?

❑ Interface Design: Summary: The identification of


description classes should be driven by
the need to specify how the software
❑ Method: When designing interfaces system will implement the behaviors
for your system, identify the classes and attributes of the conceptual
that will implement those classes. It's a critical step in
interfaces. These implementing transitioning from the analysis phase
classes are often description to the design and implementation
classes. phases of OOAD.
❑ Example: If you have an interface
"PaymentGateway," the
implementing class
"CreditCardProcessor" is a
26 description
BCA-V class that handles
September 14,
credit card payments.
2024
Links and Association

❑ Link ❑ Association
❑ A link represents a connection
through which an object ❑ Association is a group of links
collaborates with other objects. having common structure and
common behavior.
❑ Rumbaugh has defined it as “a ❑ Association depicts the relationship
physical or conceptual connection between objects of one or more
between objects”. classes.
❑ Through a link, one object may ❑ A link can be defined as an instance
invoke the methods or navigate of an association.
through another object. A link
depicts the relationship between
two or more objects.
27 BCA-V September 14,
2024
Degree of an Association
❑ Cardinality Ratios of Associations
denotes the number of instances
participating in an association. There
❑ Degree of an Association: denotes the are three types of cardinality ratios,
number of classes involved in a namely −
connection.
❑ One–to–One − A single object of
Degree may be unary, binary, or ternary.
class A is associated with a single
❑ A unary relationship connects objects of object of class B.
the same class.
❑ A binary relationship connects objects of ❑ One–to–Many − A single object of
two classes. class A is associated with many
objects of class B.
❑ A ternary relationship connects objects of
three or more classes. ❑ Many–to–Many − An object of class
A may be associated with many
28 BCA-V September 14,
objects of class B and conversely an
2024 object of class B may be associated
many-to-many relationship

❑ Example 1: Student and Course

❑ Consider a university registration system.


You have two classes, Student and
Course. An association between these
two classes can represent the fact that
students enroll in courses.
❑ This association could be many-to-many
because one student can enroll in multiple
courses, and one course can have multiple
students.

29 BCA-V September 14,


2024
one-to-many relationship

❑ Example 2: Customer -Order


❑ In this representation, each Customer can
have multiple Order objects associated
with them, creating a one-to-many
relationship.

30 BCA-V September 14,


2024
one-to-one relationship

❑ Example 3: Employee and Manager

❑ Consider an organization where you have


two classes, Employee and Manager.
There is an association between these
classes representing the hierarchical
relationship between employees and their
managers. This association is typically a
one-to-one relationship, as each
employee typically has one direct
manager

31 BCA-V September 14,


2024
Class Diagram Exercise

▪ Class Diagram for ▪ Class Diagram for


Banking Management Library Management
system System

32 BCA-V September 14,


2024
33
Relationships in use-case diagrams
Category Function
Represent the flow between activities
Activity edges
Indicate that instances of one model element
Associations are connected to instances of another model
element
Indicate that a change to one model element
Dependencies
can affect another model element
Indicate that one model element is a
Generalizations specialization of another model element

Indicate that one model element provides a


specification that another model element
Realizations
implements

Transitions Represent changes in state


Relationships in use-case diagrams

Include relationships Extend relationships

▪ In UML modeling, an include ▪ In UML modeling, you can use an


relationship is a relationship in which extend relationship to specify that
one use case (the base use case) one use case (extension) extends the
includes the functionality of another behavior of another use case (base).
use case (the inclusion use case).
▪ This type of relationship reveals
▪ The include relationship supports the details about a system or application
reuse of functionality in a use-case that are typically hidden in a use case.
model.

38 September 14,
2024
39
40
41
Domain model refinement

Domain model refinement in


(OOAD) is a process of iteratively
improving and enhancing the initial
domain model to make it more
detailed, accurate, and aligned with
the problem domain.
It often involves refining initial
abstractions, adding more specific
classes, and detailing class
attributes and methods.
Domain model refinement

The ultimate goal of domain model


refinement in OOAD is to create a detailed and
accurate representation of the problem
domain that serves as a solid foundation for
system design and implementation.
It helps bridge the gap between the initial
conceptual model and the final system,
ensuring that the software solution
effectively addresses the complexities and
requirements of the real-world domain.
DMR-process (Banking system)

Step 1: Initial Conceptual Model Step 2: Identification of Abstractions and Relationships

▪ Identification of Abstractions: As you gain a deeper


▪ Initially, you start with a high-level
understanding of the problem domain, you identify
conceptual model that captures the additional concepts and details. For instance, you
primary entities, their relationships, and may realize that there are different types of
some basic attributes and behaviors. accounts, such as savings and checking accounts,
▪ In the case of an online banking system, each with specific features and behaviors.
you might have classes like Account,
Customer, and Transaction. These ▪ Refining Relationships: You also refine the
classes have basic attributes like account relationships between classes. For example, you
number, customer name, and transaction might initially have a basic association between
amount. Account and Customer, but now you realize that a
customer can have multiple accounts, so you refine it
44 September 14, to a one-to-many association.
2024
DMR-process (Banking system)

Step 3: Introducing New Classes Step 4: Detailed Attributes and Behaviors

▪ New Classes: Based on the refined ▪ Attributes and Behaviors: Specify


abstractions, you may introduce more detailed attributes and
new classes. behaviors for the classes.
▪ In our example, you introduce ▪ For instance, you add attributes like
classes like SavingsAccount and interestRate for SavingsAccount,
CheckingAccount as subclasses and methods like withdraw and
of Account, each with its own deposit for Account.
attributes and methods.

45 September 14,
2024
DMR-process (Banking system)

Step 5: Relationship Refinement Step 6: Validation and Feedback

▪ Association Refinement: You ▪ Feedback and Validation:


refine associations based on new Throughout the refinement process,
insights. you validate the model with domain
▪ For instance, you may realize that experts, stakeholders, and
a Transaction should be end-users.
associated with an Account, not ▪ Their feedback helps ensure that
directly with a Customer, as the model aligns with real-world
transactions are specific to requirements and constraints.
accounts.
46 September 14,
2024
DMR-process (Banking system)

Step 7: Iteration 8. Documentation:

▪ Iteration: Domain model Document Changes: As you refine the


refinement is an iterative process. model, it's crucial to update
▪ As you continue to gather documentation, including class
information, uncover diagrams, entity-relationship
requirements, and refine your diagrams, and textual descriptions, to
understanding of the domain, you reflect the changes and improvements
iterate on the model to ensure it made during the refinement process.
remains accurate and up-to-date.

47 September 14,
2024
Conceptual Class Hierarchy

❖ In(OOAD), a conceptual class hierarchy in


static modeling refers to the high-level
representation of classes and their
relationships within a software system.
❖ It provides an abstract view of how classes
are organized and related based on their
common characteristics and behaviors.
❖ Conceptual class hierarchies are essential
for understanding the structure of a system
and serve as a foundation for further design
and implementation.

48 September 14,
2024
Conceptual Class Hierarchy

Classes: Inheritance Relationships:

▪ The hierarchy consists of classes, ▪ In a conceptual class hierarchy, you


which are templates or blueprints often define inheritance
for creating objects in the system. relationships.
▪ Each class represents a group of ▪ Inheritance allows you to create a
objects with similar attributes and hierarchy of classes where
behaviors. subclasses inherit attributes and
behaviors from their superclass.
▪ This is represented by an "is-a"
relationship, where a subclass is a
49 September 14,
2024 more specialized form of the
Conceptual Class Hierarchy

Generalization and Specialization Abstraction:

▪ The hierarchy may include concepts of ▪ The hierarchy abstracts away


generalization and specialization. implementation details and focuses
▪ Generalization represents the process of on the essential relationships and
creating a more general (superclass) class hierarchies among classes.
from more specific (subclass) classes.
▪ It provides a high-level view of the
▪ Specialization, on the other hand,
represents the process of creating more
system's structure.
specific subclasses from a general
superclass.

50 September 14,
2024
Conceptual Class Hierarchy

Organizing Entities: Communication Aid:

▪ Classes are organized into a ▪ Conceptual class hierarchies aid in


hierarchy based on their shared communicating the system's design
characteristics or attributes. to stakeholders, team members, and
▪ The hierarchy helps in grouping developers.
related classes together. ▪ They provide a common visual
language for discussing the system's
structure.

51 September 14,
2024
52
Thank you

END of UNIT-II

You might also like