Object-Oriented Software Engineering Guide
Object-Oriented Software Engineering Guide
They have been adapted into a clear, student-friendly textbook format to support self-study
and classroom use.
The aim of this book is to simplify complex ideas and present them in a way that’s easy to
follow — combining conceptual understanding with practical examples and illustrations.
Whether you are studying software engineering for the first time or reviewing for exams, this
book provides the foundation you need to think like a software engineer and design systems
using object-oriented principles.
Introduction
Software has become an essential part of modern life — powering everything from smartphones
and banking systems to transportation and healthcare.
As systems have grown larger and more complex, the need for a disciplined, systematic
approach to software development has become critical. This is where Software Engineering
comes in.
Software engineering combines the creativity of programming with the structure and discipline
of engineering.
It focuses on planning, design, testing, and maintenance, ensuring that software is not only
functional but also reliable, efficient, and maintainable.
Over the years, new methodologies have been developed to improve the way we design and
build software.
Among these, the object-oriented approach has proven to be one of the most powerful and
effective.
By thinking in terms of objects, classes, and relationships, developers can model real-world
systems in a natural and reusable way.
To communicate these designs, engineers use the Unified Modeling Language (UML) — a
universal language for describing systems visually.
Finally, to guide the entire process, the Unified Process (UP) provides a structured framework
for iterative and incremental development.
Chapter 1: Introduction to Software Engineering
Software engineering is the discipline concerned with the systematic development of software
systems.
It involves not only writing code but also designing, building, testing, and maintaining
software in an organized and reliable way.
Software – the programs and data structures that perform logical and control operations.
Hardware – electronic devices (like CPUs, sensors, or motors) that provide computing
and physical functions.
People – users, operators, and maintainers who interact with the system.
Database – organized collections of data accessed through software.
Documentation – manuals and materials describing how the system works.
Procedures – the steps or rules that describe how to use or operate the system.
Figure 1: Elements of a Computer-Based System
Material Manufacturing
Movement Cells
System
For instance, modern systems often include reusable graphical components like buttons, menus,
and forms.
By reusing these building blocks, developers can build complex applications faster and more
reliably.
As computers became more powerful and widely used, a major problem emerged in the software
industry — known as the software crisis.
This crisis refers to the increasing difficulty of developing, maintaining, and managing
software systems effectively.
Underlying Reasons
Definition:
“Software engineering is the establishment and use of sound engineering principles in order to
obtain economically software that is reliable and works efficiently on real machines.”
1. Methods – the technical “how-to” approaches for building software (e.g., requirements
analysis, coding, testing).
2. Process – defines the order in which methods are applied, the deliverables produced, and
the milestones used to track progress.
3. Tools – software aids that support the methods and processes (e.g., IDEs, testing tools,
and CASE systems).
CASE tools integrate software, hardware, and repositories to automate parts of software
development — much like how CAD/CAE tools are used in mechanical or electrical
engineering.
Regardless of project size or complexity, the main software engineering activities can be grouped
into three generic phases:
Key tasks:
System Analysis
Project Planning
Requirements Analysis
Key tasks:
Software Design
Code Generation
Software Testing
Key Stages:
1. System Engineering and Analysis – define overall system requirements and assign part
of them to software.
2. Requirements Analysis – understand data, functions, performance, and interfaces.
3. Design – define the architecture, data structures, and algorithms.
4. Code Generation – translate design into code.
5. Testing – verify that the system works correctly.
6. Maintenance – handle post-delivery changes and improvements.
Although simple, this model has a limitation: once a stage is completed, returning to a previous
one is difficult.
1.11 The Prototyping Model
The Prototyping Model helps when requirements are unclear or still evolving.
Developers create a prototype — an early, simplified version of the software — to visualize
ideas and gather feedback from users.
Typical Steps:
This iterative process continues until both developer and user agree on the final system
requirements.
Requirements analysis
Design
Implementation
Testing
Over time, the system grows gradually and becomes more refined with each iteration.
2.1 Introduction
The object-oriented (OO) approach to software development is a way to design and build
systems by thinking in terms of objects — just like we think about things in the real world.
Instead of focusing on steps or procedures, OO development focuses on identifying objects,
their attributes (data), and their behaviors (actions).
This approach breaks complex systems into smaller, manageable, and reusable parts that interact
with each other.
Example: In a hospital system, we can think of objects like Doctor, Patient, and Appointment —
each having specific data and actions.
2.2 Objects
An object represents a person, place, thing, or concept that we need to model in software.
Objects are the building blocks of an OO system.
Attributes (or properties): Data that describes the object (e.g., a patient’s name, age,
and address).
Methods (or behaviors): Actions the object can perform (e.g., schedule an appointment,
update information).
The state of an object is determined by the values of its attributes and its relationships with other
objects at a given time.
Example:
Object: Appointment
Attributes: date, time, doctor, patient
Methods: schedule(), cancel(), reschedule()
2.3 Classes
A class is a template or blueprint that defines the structure and behavior of similar objects.
While an object is a single instance, a class describes what all those instances have in common.
Example:
The Car class defines general attributes and operations common to all cars, like color, speed, and
the ability to start or stop.
Specific cars — like a Toyota or BMW — are objects (instances) of that class.
Class: Car
Attributes: color, speed
Methods: start(), stop(), accelerate()
Encapsulation means bundling an object’s data and the methods that operate on that data into a
single unit.
This concept keeps the internal details of an object hidden from the outside world, exposing only
what’s necessary.
Benefits of Encapsulation
1. Modularity:
o Each object’s code is independent from others, making systems easier to
maintain.
2. Information Hiding:
o An object’s internal data can only be accessed or modified through its defined
methods.
o This reduces dependency between parts of the system.
Example:
A BankAccount object hides the balance variable. Users interact with it only through deposit()
and withdraw() methods.
Encapsulation improves cohesion (objects do one clear task) and reduces coupling (objects don’t
depend too heavily on each other).
2.5 Inheritance
Inheritance allows one class to inherit attributes and methods from another class.
This enables reuse of existing code and creates a logical hierarchy among classes.
How It Works
The superclass (or parent class) defines general attributes and operations.
The subclass (or child class) inherits these and can add its own new features.
Example:
A Person class may define common attributes like name and address.
A Doctor class and a Patient class can inherit from Person while adding unique details (like
specialization or medical history).
An abstract class provides a general idea for a group of related classes but doesn’t represent a
complete object itself.
It often includes abstract methods — methods declared but not implemented.
Subclasses must implement these methods to become concrete.
Example:
class Shape {
virtual void Draw() = 0; // abstract method
};
Here, Shape is abstract because it defines a generic concept of drawing, while Circle provides
the actual implementation.
Figure 4: Abstract Class and Derived Implementation
Abstract classes are useful for defining generic behaviors shared by multiple related classes.
Represents ownership — if the whole is destroyed, its parts are destroyed too.
Example: A ChessBoard consists of Squares. If the board is deleted, the squares disappear too.
3. Association
A general link between two classes that aren’t dependent on each other.
Example:
2.8 Messages
A message contains:
1. The object that receives the message,
2. The name of the method to call,
3. Any parameters (inputs) needed.
Example:
[Link](lowGear)
Here, the object John (a Person) sends a message to the Car object to perform the
changeGears() method.
2.9 Polymorphism
Example:
class Shape {
virtual void Draw() = 0;
};
When the method DrawShape(Shape& s) calls [Link](), the system automatically runs
the correct Draw() for the actual shape (circle or rectangle).
Polymorphism lets developers design generic functions that work with different object types,
improving flexibility and code reuse.
Many methodologies have been developed to support OO analysis and design, including:
These methods help developers identify objects, define relationships, and model system behavior
in a structured way.
Three pioneers in OO design — Rumbaugh, Booch, and Jacobson — combined their methods
to create the Unified Modeling Language (UML) in 1997.
UML became the standard language for modeling object-oriented systems.
Later, they also developed the Unified Process (UP) — a framework for OO software
engineering using UML diagrams.
Today, UML and UP are widely used in software projects to visualize, design, and document
object-oriented systems.
The object-oriented approach models software as a set of objects interacting with each
other.
Classes define the blueprint for creating objects.
Encapsulation hides data and behavior within objects, improving reliability.
Inheritance allows code reuse and hierarchy creation.
Polymorphism lets objects respond differently to the same message.
Relationships between classes (aggregation, composition, association) define system
structure.
Object-oriented technologies lead to reusability, maintainability, and scalability.
UML and the Unified Process provide the foundation for modern OO design.
Chapter 3: Introduction to the UML
The Unified Modeling Language (UML) is a standard language used to visualize, design,
construct, and document software systems — especially object-oriented systems.
UML helps software engineers create blueprints for systems before writing code.
It allows developers, analysts, and even clients to communicate ideas clearly through diagrams
rather than long written descriptions.
UML can also be used beyond programming — for business modeling and describing non-
software systems — because it focuses on processes, interactions, and structure.
UML provides a variety of graphical elements (such as boxes, arrows, and symbols) that
represent different aspects of a system.
These elements combine to form diagrams, each showing a different view or perspective.
When all the diagrams of a system are put together, they form a model.
Each diagram shows a specific part of the system (structure, behavior, flow, etc.).
The model represents the system as a whole.
A UML model describes what the system should do, not how to implement it.
A class diagram is a static model that shows the structure of a system by displaying its classes,
attributes, operations (methods), and relationships.
+------------------+
| Class Name |
+------------------+
| Attributes |
+------------------+
| Operations |
+------------------+
Classes are then connected by lines showing how they relate to each other (e.g., inheritance,
association).
Example
Doctor
Patient
Appointment
These classes connect through relationships such as “Patient schedules Appointment with
Doctor.”
3.5 Object Diagram
An object diagram shows a snapshot of objects (real instances of classes) and their
relationships at a specific moment in time.
While a class diagram shows general structure, an object diagram shows actual examples of
how those classes interact during runtime.
Example:
john : Patient
dr_smith : Doctor
app1 : Appointment
These objects illustrate one real-world situation, such as “John has an appointment with Dr.
Smith.”
A use case diagram helps describe the functional requirements of a system — what the system
does from the user’s perspective.
Each use case represents a specific goal or function the user can perform.
Each actor represents someone or something that interacts with the system (like a person,
another system, or a device).
Figure 3: Use Case Diagram Components
Example:
In an appointment system, use cases might include:
Schedule Appointment
Cancel Appointment
View Patient Details
Use case diagrams help developers and clients agree on what the system will do before
implementation.
«include» relationship:
Means one use case always includes the behavior of another.
Example: “Process Order” includes “Validate Payment.”
«extend» relationship:
Means one use case optionally adds to another.
Example: “Offer Discount” extends “Process Order.”
3.8 State Diagram
A state diagram shows how an object changes over time in response to different events.
Each object has various states, and transitions occur when certain actions or events happen.
Example:
A Patient object could have states like:
State diagrams are particularly useful for modeling systems with objects that react to inputs or
conditions (like machines, transactions, or orders).
Example:
In a login system, a sequence might look like:
A collaboration diagram (also called a communication diagram) shows how objects work
together by exchanging messages.
Unlike the sequence diagram, objects can be arranged anywhere, and messages are numbered
to indicate order.
Each message shows:
Example:
A client interacts with an ATM by inserting a card, verifying a PIN, selecting transactions, and
receiving money — all represented by messages exchanged among Client, ATM, Controller, and
Database objects.
Each activity is shown as a rounded rectangle, and decision points are shown as diamonds.
Arrows indicate the flow from one step to the next.
Figure 8: Example of an Activity Diagram
Example:
The process of creating and printing a document might include:
Activity diagrams are useful for visualizing business processes, use case flows, or software
algorithms.
3.12 Other UML Features
1. Packages
Example: A “Billing” package might contain all classes related to payment processing.
2. Notes
A stereotype lets designers extend UML by creating new types of elements from existing ones.
It’s written inside double angle brackets like this: «Interface», «Entity», or
«Controller».
Example:
An interface in UML can be shown as:
«Interface»
PaymentGateway
Stereotypes are useful when we want to tailor UML for specific domains, such as databases,
embedded systems, or web apps.
UML is a universal communication tool that bridges the gap between analysis, design, and
implementation.
Chapter 4: Introduction to the Unified Process Model
The Unified Process (UP) is a modern software development framework that provides a
structured, organized way to build object-oriented systems.
The UP was designed to combine the best practices of software engineering while addressing
the limitations of older linear models like the waterfall.
Grady Booch
James Rumbaugh
Ivar Jacobson
These three experts (often called the “Three Amigos”) combined their individual methods — the
Booch Method, OMT, and OOSE — to form the Unified Modeling Language (UML) and the
Unified Process (UP).
Later, Rational Software developed the commercial version known as the Rational Unified
Process (RUP), which became the industry standard for object-oriented system development.
The UP is built around three main ideas that make it both flexible and effective:
1. Use Case–Driven
All development activities revolve around use cases — descriptions of how users interact with
the system.
Each iteration focuses on implementing a set of use cases that deliver value to the user.
2. Architecture-Centric
The system’s architecture — its fundamental structure — plays a central role in guiding design
and implementation.
By focusing on architecture early, the UP ensures the system remains scalable, maintainable,
and robust.
In traditional models like the waterfall, development happens in one long sequence.
If a mistake is found late, it’s very costly to fix.
The UP solves this by using iterations — smaller development cycles within the larger project.
Requirements gathering
Analysis and design
Implementation
Testing
Integration and evaluation
At the end of every iteration, a working product (even if incomplete) is delivered.
This allows early user feedback and helps reduce risks.
Each iteration adds new functionality, gradually leading to the complete system.
The UP divides the project life cycle into four main phases:
1. Inception
2. Elaboration
3. Construction
4. Transition
These phases are sequential at a high level but contain multiple iterations within them.
The result of this phase is a clear business case that justifies moving forward.
Typical deliverables:
Vision document
Initial use case model
Preliminary project plan
Risk assessment
The output is an architectural baseline, which provides a stable foundation for construction.
Deliverables:
The Construction phase is where most of the system is designed, coded, and tested.
It involves multiple iterations, each adding more functionality.
Activities include:
At the end of this phase, the system should be functionally complete and ready for deployment.
Deliverables:
The Transition phase focuses on delivering the product to users and ensuring it meets their
needs.
This includes final testing, bug fixing, and deployment.
Key activities:
The goal is to make sure the product is ready for operational use.
Deliverables:
After this phase, the system enters its maintenance phase, where updates and improvements are
made as needed.
Within each phase, the UP defines several core workflows (disciplines) that guide what
activities should happen.
Workflow Description
Business Modeling Understand the business context and goals.
Requirements Identify what the system must do (use cases).
Analysis & Design Define how the system will meet the requirements.
Implementation Write and integrate code.
Testing Verify that the system works as expected.
Deployment Deliver the system to users.
Configuration & Management Track versions, changes, and artifacts.
Project Management Plan, monitor, and control the project.
Environment Prepare the tools and infrastructure needed.
Each iteration may focus more on certain workflows than others — for example, early iterations
emphasize requirements, while later ones focus on implementation and testing.
Artifacts are organized and managed carefully to maintain traceability — the ability to track
how each requirement is implemented in the system.
Figure 2: Unified Process Artifacts and Their Relationships
The Unified Process remains one of the most influential methodologies in modern software
engineering, especially for object-oriented projects.
Chapter 5: The Inception Phase
5.1 Introduction
The Inception Phase is the first phase of the Unified Process (UP).
It marks the beginning of a software project, where the main goal is to understand what the
system should do and why it should be developed.
This phase focuses on defining the scope, identifying the main requirements, and
establishing a solid business case for the project.
The inception phase is short but crucial — it sets the direction for the entire project.
The main purpose of this phase is to analyze the project’s feasibility and to decide whether it’s
worth continuing.
By the end of the inception phase, the development team and stakeholders should have a shared
understanding of:
The inception phase includes several key activities that help the team gather the necessary
information for planning.
Define what the project will include — and what it will not include.
The scope should describe the system boundaries, main goals, and high-level features.
3. Identify Risks
4. Estimate Resources
Estimate time, effort, budget, and personnel required for the next phase.
These are rough estimates but useful for decision-making.
During inception, a use case model is developed to describe how users will interact with the
system.
This model includes:
Example:
In a Library Management System, the actors might be:
Librarian
Member
Add Book
Borrow Book
Return Book
Renew Membership
This early use case model helps everyone visualize what the system will do — even before
detailed design begins.
The Vision Document is one of the main outputs of the inception phase.
It provides a clear overview of the system’s purpose, main features, and expected benefits.
It typically includes:
The vision document serves as a reference point for all future work.
5.7 The Business Case
The business case explains why the project should be developed and whether it makes sense to
invest in it.
It’s often presented to management for approval.
If the business case is strong, the project can confidently move forward to the Elaboration
Phase.
Feasibility assessment determines whether the project is technically and economically viable.
1. Technical Feasibility
Can the system be built with current technology, skills, and resources?
2. Economic Feasibility
3. Operational Feasibility
4. Schedule Feasibility
Can the project be completed within the required time?
Every project has risks — especially in early stages when information is incomplete.
Unclear requirements
Over-optimistic timelines
Inexperienced team members
Dependence on new or untested technology
Assumptions made in this phase (like technology availability or user cooperation) should be
clearly documented and reviewed later.
The project plan outlines the schedule and resources needed to reach project goals.
It is a living document — refined in later phases — but during inception, it gives a rough
estimate.
High-level timeline
Major milestones
Resource estimates (staff, budget, tools)
Risk management summary
This plan helps decision-makers evaluate whether the project should proceed.
By the end of the inception phase, several important artifacts (documents and models) should be
completed:
Deliverable Description
Vision Document Describes the system’s purpose, scope, and features.
Initial Use Case Model Identifies main actors and use cases.
Business Case Justifies the project’s existence.
Risk List Outlines key project risks.
Preliminary Project Plan Gives a rough estimate of cost, schedule, and resources.
These outputs are reviewed to decide whether to move to the next phase — Elaboration.
At the end of the inception phase, a Lifecycle Objective (LCO) milestone review takes place.
This review ensures that the project is ready to proceed.
6.1 Introduction
After the Inception Phase confirms the project’s vision and feasibility, the next step in the
Unified Process (UP) is the Elaboration Phase.
This phase focuses on understanding the system in depth, stabilizing requirements,
resolving major risks, and building the core system architecture.
In other words, the elaboration phase is where ideas start turning into a working technical
foundation.
By the end of this phase, the development team should have a clear and validated architecture,
a detailed plan for construction, and a working prototype demonstrating key system
capabilities.
Best Practice: If an iteration is running out of time, move unfinished tasks to a later iteration
instead of extending the deadline.
This keeps development predictable and disciplined.
Several important software engineering practices are emphasized during this phase:
The architecture includes subsystems like Sales, Payments, Tax Calculation, and
Inventory.
Early iterations focus on defining and connecting these modules, even if they contain
only stub code.
This allows the team to verify interfaces, dependencies, and communication paths early in
development.
Interfaces between modules (including local and remote ones) are defined and tested.
This includes setting up method parameters, return values, and data exchange formats.
Example:
In the NextGen POS system, one interface connects to a third-party accounting service.
Testing and refining such interfaces early prevents major integration issues later.
End-to-End Scenarios
Simplified versions of complete workflows (e.g., “Process Sale” scenario) are built to ensure all
system parts work together.
1. Usability testing – Evaluate user interface design for the Process Sale scenario.
2. Recovery testing – Check how the system behaves when remote services (like credit
authorization) fail.
3. Performance testing – Simulate high load to see how remote services (like the tax
calculator) respond.
Early feedback from these tests helps the team make timely improvements and prevent expensive
redesigns later.
After each iteration, the team plans the next one based on:
Adaptive Planning
Below is an example of ranking features and use cases for the NextGen POS project:
Based on this ranking, the Process Sale use case is addressed first since it’s architecturally
significant and high priority.
The first iteration in the NextGen POS system focuses on a simple, core scenario:
This iteration builds the foundation for future work while keeping the system functional and
testable.
Artifact Description
Domain Model Visual representation of main concepts and relationships in
the system.
Design Model Logical design including class diagrams, interaction
diagrams, and packages.
Software Architecture Document Summary of architectural decisions and design rationale.
(SAD)
Data Model Database schema and mapping between objects and tables.
Test Model Defines what will be tested and how.
Implementation Model The actual code, executables, and databases.
Use-Case Storyboards / UI Early versions of the user interface and navigation paths.
Prototypes
These artifacts evolve over several iterations and become more detailed with time.
Before moving into detailed design, it’s important to understand the system behavior — what
the system does in response to user actions.
System Behavior:
Each message represents a system operation, and the diagram focuses on interactions across the
system boundary.
Figure 1: Example of a System Sequence Diagram (SSD)
This keeps the design flexible and independent from specific UI implementations.
The Elaboration Phase stabilizes requirements, reduces risks, and builds the system’s
core architecture.
It includes several iterations, each timeboxed and focused on high-priority tasks.
Key activities include refining interfaces, integrating components, and early testing.
Planning is adaptive, guided by risk, coverage, and criticality.
Artifacts such as domain models, design models, and sequence diagrams are initiated.
System Sequence Diagrams (SSDs) are used to visualize how actors interact with the
system during a use case.
The elaboration phase ends when the architecture is proven stable, the main risks are under
control, and a solid foundation for construction is ready.
Chapter 7: The Domain Model
7.1 Introduction
In object-oriented software engineering, one of the most important early steps in understanding a
system is to analyze the problem domain—the real-world environment in which the software
will operate.
This process is known as Object-Oriented Analysis (OOA).
The key goal of OOA is to identify the main concepts and relationships that exist in the
problem domain, and then represent them visually through a Domain Model.
A Domain Model is not a software design or code structure—it doesn’t show classes with
methods or software logic.
Instead, it focuses on conceptual classes and how they are related in the real world.
A Domain Model is a visual representation of the important concepts (or “conceptual classes”)
and relationships in a given problem domain.
It is typically drawn using UML class diagrams, but without methods or behaviors.
It shows:
This model helps developers, analysts, and clients share a common understanding of what the
system is about before jumping into technical details.
This is a prepared list of common categories of objects that frequently appear in different
domains.
You can use it as a checklist to identify possible conceptual classes.
Category Examples
Physical or tangible objects Register, Airplane
Specifications or descriptions ProductSpecification, FlightDescription
Places Store, Airport
Transactions Sale, Payment, Reservation
Transaction line items SalesLineItem
Roles of people Cashier, Pilot
Containers Store, Airplane
External systems CreditPaymentSystem, AirTrafficControl
Abstract concepts Hunger, Acrophobia
Organizations SalesDepartment, Airline
Events Sale, Crash, Flight
Processes SellingAProduct, BookingASeat
Rules or policies RefundPolicy
Catalogs ProductCatalog
Financial instruments LineOfCredit, Stock
Documents Receipt, Ledger, Contract
By checking which of these categories apply to your system, you can quickly generate a list of
candidate classes.
From this, we can extract nouns like Customer, Cashier, Item, Sale, Payment, Receipt, Tax,
and Store — most of which are conceptual classes.
In the NextGen Point-of-Sale (POS) application, we can use the techniques above to identify
the following conceptual classes:
ProductSpecification
SalesLineItem
Cashier
Customer
Manager
Register
Item
Store
Sale
Payment
ProductCatalog
Useful Associations
Include only associations that represent meaningful, “need-to-know” relationships that must be
remembered or understood in the domain.
For example:
A Sale has multiple SalesLineItems — we must keep this link to calculate totals.
A Sale has one Payment — this must be recorded for receipts and financial tracking.
A ProductCatalog records ProductSpecifications — needed to find item details.
In UML:
Example:
Register — Records — Sale
means that one Register records many Sales.
7.9 Multiplicity
Example:
A Store stocks many Items, so the multiplicity is 1 Store → * Items.
Include attributes only if the system needs to remember or display that information.
Common data types include:
From the Process Sale scenario, we can identify key attributes needed to support system
behavior:
This diagram shows how all entities are connected and what data they carry.
This model provides a foundation for further design — it helps developers understand the key
elements of the system before defining operations, interfaces, or databases.
7.13 Key Takeaways
Through this model, software engineers can communicate effectively with stakeholders and
ensure that the system design is firmly grounded in the real-world context it aims to serve.
Chapter 8: From Requirements to Design
8.1 Introduction
Up to this point, we have focused mainly on requirements analysis — understanding what the
system should do by studying use cases, domain models, and system interactions.
It’s perfectly normal for some requirements to evolve or change as we begin designing and
coding.
This iterative feedback loop is a strength of the Unified Process (UP).
Object Design begins once the domain model and use cases are in place.
Here, we start defining software classes, methods, and messages — deciding how objects will
collaborate to satisfy each use case.
Definition:
Object design is the process of assigning methods and defining interactions between objects to
realize system behavior.
In object-oriented design, each class has responsibilities — the things it must do or know.
The UML defines a responsibility as “a contract or obligation of a class.”
1. Doing Responsibilities
2. Knowing Responsibilities
Example:
Each interaction diagram corresponds to one or more system events — for example,
makeNewSale() or enterItem() in the NextGen POS system.
A use-case realization describes how a particular use case is achieved through collaboration
among software objects.
When a cashier starts a new sale, the system receives the makeNewSale() message.
When the cashier enters an item’s ID and quantity, the enterItem() operation is triggered.
When the sale is complete, the system must calculate the total.
The Sale object is responsible for knowing its total, but the total depends on:
Therefore:
This design follows the Information Expert principle — assign a responsibility to the class that
has the necessary information to fulfill it.
Chapter 9: Design Class Diagrams (DCDs)
9.1 Introduction
After creating interaction diagrams, the next step is to define the software classes formally in a
Design Class Diagram (DCD).
Example:
Each attribute and method parameter can specify a type for clarity.
Attribute/Parameter Type
Description Text
Price Money
itemID ItemID
Date Date
Time Time
quantity Integer
Each association between classes represents a reference from one object to another.
Navigability arrows show which direction this reference goes.
Example:
10.1 Introduction
Once the design is stable, we can start implementing it in code using an object-oriented
language like Java.
Example (Java):
Example:
From the enterItem() sequence diagram:
This method in Register sends messages to both ProductCatalog and Sale, matching
the diagram flow.
When a class must maintain multiple related objects, a collection (like a List) is used.
Example:
This allows the Sale to store and manage all SalesLineItem instances.
This shows how messages like create(spec, qty) and add(sl) translate directly to
code.
When coding, start with least-coupled classes (those with few dependencies) first.
Then gradually move toward most-coupled ones.
Typical order:
1. ProductSpecification
2. SalesLineItem
3. Sale
4. Payment
5. ProductCatalog
6. Register
7. Store
Figure 1: Implementation Order Based on Coupling
The transition from requirements to design involves defining how objects collaborate to
fulfill use cases.
Interaction diagrams show these collaborations.
Design Class Diagrams formalize the structure and relationships.
The DCD maps directly into source code definitions.
Collections and associations are implemented using lists or reference attributes.
Implementation proceeds from simple, independent classes to more complex,
interconnected ones.
This completes the journey from analysis through design and into coding — the essential path of
Object-Oriented Software Engineering.