Up to this point, we have learned how objects work.
We understand:
Objects
Classes
State
Behavior
Relationships
Encapsulation
Abstraction
Inheritance
Polymorphism
Information HidingHowever, an important question remains:
Where do objects come from?
Suppose a product manager says:
“We need an online hotel booking system.”
How do you go from:
English Requirementsto:
class Hotel {};
class Room {};
class Booking {};
class Guest {};How do architects identify:
Objects
Responsibilities
Relationships
Behavrios
BoudnariesThis process is called:
Object-Oriented Analysis (OOA)
Historical Context
Before Object-Oriented Analysis became popular:
Requirements
↓
CodeDevelopers jumped directly into implementations.
Results:
Rigid Systems
Poor Maintainability
Wrong Abstractions
Massive RefactoringSoftware engineering needed a disciplined way to model reality before coding.
Object-Oriented Analysis emerged as a solution.
What Is Object-Oriented Analysis?
Definition:
Object-Oriented Analysis is the process of identifying objects, responsibilities, relationships, and behaviors from a problem domain.
Notice:
Analysis != CodingAnalysis happens before implementation.
The goal is understanding.
The Three Stages
Professional object-oriented development typically follows:
Analysis
↓
Design
↓
ImplementationAnalysis
Focus:
What exists?Example:
Customer
Order
Product
PaymentDesign
Focus:
How should they interact?Example:
Relationships
Interfaces
Patterns
DependenciesImplementation
Focus:
How do we code it?Example:
class Customer
{
};Common Beginner Mistake
Beginners often do:
Requirements
↓
ImplementationSkipping analysis entirely.
Result:
Poor Object ModelsThe Core Idea
Object-Oriented Analysis starts with:
Understanding the Domain
What Is a Domain?
A domain is:
The area of business or problem space the software operates in.
Examples:
Banking
Healthcare
Education
Hotel Booking
E-Commerce
Ride SharingExample Domain
Consider:
Library Management SystemDomain concepts:
Book
Member
Librarian
Loan
ReservationThese concepts exist before software exists.
You job is to discover them.
Domain-Driven Thinking
A common mistake:
Think about Database TablesWrong.
Instead think:
What concepts exist in reality?Professional designers model reality first.
Technology later.
The Noun Technique
One of the oldest OOA techniques.
Step 1
Read requirements carefully.
Example:
A customer can place an order.
An order contains products.
A payment is made for an order.Step 2
Extract nouns.
Customer
Order
Products
PaymentThese become object candidates.
Example:
Requirement:
Students enroll in courses.
Professors teach courses.
Departments manage professors.Nouns:
Student
Course
Professor
DepartmentPotential objects discovered.
Important Warning
Not every noun becomes a class.
Example:
System
Database
Screen
InformationThese are often not domain objects.
The noun technique provides candidates.
No final answers.
Verb Analysis
After finding nouns:
Analyze verbs.
Verbs reveal:
Behaviors
Requirement:
Customer places order.Verb:
placesPotential behavior:
customer.placeOrder();Requirement:
User logs in.Verb:
logs inPotential behavior:
user.login();Requirement:
Librarian issues book.Behavior:
librarian.issueBook();Example Walkthrough
Requirement:
A user can add products to a cart and place an order.Nouns:
User
Product
Cart
OrderVerbs:
Add
PlacePotential model:
class User;
class Product;
class Cart;
class Order;Behaviors:
cart.addProduct();
user.placeOrder();Identifying Responsibilities
Once objects are identified:
Ask:
What is each object responsible for?
Example
Library System
Book Responsible for:
Title
Author
AvailabilityMember Responsible for:
Borrowing
Returning
ReserverationsLoan Responsible for:
Issue Date
Due Date
StatusGood object models emerge from good responsibility assignment.
Responsibility-Driven Design
Professional designers often use: Responsibility-Driven Design (RDD)
Core Question:
Who should do this?
Requirement:
Calculate Order TotalWho should do it?
Possible answers:
User
Order
Database
UICorrect:
OrderBecause Order owns the items.
Bad Design:
class User
{
public:
double calculateOrderTotal();
};Wrong responsibility.
Good Design:
class Order
{
public:
double calculateTotal();
};Responsibility aligned with ownership.
Identifying State
Each object usually owns information.
Ask:
What does this object know?
Example:
Customer knows:
Name
Email
AddressOrder knows:
Items
Status
TotalProduct knows:
Price
Name
StockThese become candidate attributes.
Identifying Behavior
Ask:
What can this object do?Customer
Place Order
Update AddressOrder
Add Item
Remove Item
calculate TotalProduct
Update PriceBehavior should align with responsibility.
Object Discovery Example
ATM System
Requirement:
Customer inserts card.
Customer enters PIN.
ATM validates card.
Customer withdraws money.
ATM dispenses cash.Nouns:
Customer
Card
ATM
PIN
CashPotential objects:
Customer
Card
ATM
Transaction
CashDispenserVerbs:
Insert
Validate
Withdraw
DispenseBehaviors discovered.
Initial Model
Customer
|
v
Card
|
v
ATM
|
v
CashDispenserAvoid Technical Objects Early
Beginners often identify:
DatabaseManager
NetworkHandler
FileManager
CacheControllertoo early.
These are implementation concerns.
Object-oriented analysis should focus on:
Business Conceptsnot technical details.
Domain Vocabulary
One of the most important outcomes of OOA:
Ubiquitous Language
Every stakeholder should use the same terms.
Example:
Hotel System
Guest
Reservation
Room
Check-In
Check-OutEveryone speaks the same language.
Bad Vocabulary:
Developer says:
BookingEntity
Business says:
ReservationConfusion emerges.
Use domain language whenever possible.
Example: Food Delivery System
Requirement:
Customers place orders.
Restaurants prepare food.
Delivery partners deliver orders.
Payments are processed.Objects:
Customer
Restaurant
Order
DeliveryPartner
PaymentResponsibilities:
Customer:
Create Order
Restaurant:
Prepare Food
Order:
Track Status
DeliveryPartner:
Deliver Order
Payment:
Process PaymentDiscovering Relationships
Once objects exist:
Ask:
Who knows whom?
Who owns whom?
Who uses whom?Example:
Order contains OrderItem
Relationship CompositionCustomer places Order
Relationship AssociationOrder uses PaymentService
Relationship DependencyCRC Cards
A classic OOA technique.
CRC:
Class
Responsibilities
CollaboratorsExample:
Order
Responsibilities:
Add Item
Remove Item
Calculate Total
Collaborators:
Product
Payment
Leave a comment
Your email address will not be published. Required fields are marked *


