Designing with Objects: The OOAD Approach, Explained

UPI Study › Courses › Software Engineering › Free lessons › Lesson 1.5 Free with a free account

Designing with Objects: The OOAD Approach

Software Engineering · Chapter 1: Foundations of Software Engineering and Process ModelsSection 1.5 · lesson 5 of 1037 min · free with a free account

← Analyzing Systems Within the Software Engineering WorkflowNext lesson: Proven Steps and Guidelines for Building Quality Software →

Earn 3 college credits for Software EngineeringRecommended for credit by NCCRS · Computer Science 301 · self-paced · one payment, lifetime access

In this lesson

The OOAD approach: objects, classes, encapsulation, inheritance, and polymorphism.

  • Explain why the object-oriented paradigm emerged
  • Define an object, and how a class acts as its blueprint
  • Describe encapsulation, and why protecting state matters
  • Explain inheritance and polymorphism with concrete examples

Transcript

Everything said in the video, section by section (1,016 words). Read along, or search it.

Foundations of Software Engineering and Process Models

Designing with Objects

As software grew from hundreds of instructions to millions, one way of organizing it kept breaking down. This section introduces the approach that replaced it, object-oriented analysis and design, or O O A D. Its core ideas are objects, classes, encapsulation, inheritance, and polymorphism.

Why It Emerged

Code Here, Data There

Picture a payroll system built the traditional way. One giant list of steps reads an employee record, calculates pay, applies deductions, and prints a check, acting on data sitting somewhere else. Now add overtime rules, part-time employees, contractors, and bonuses. Every new rule means editing that same long sequence. This procedural style kept data structures and procedures apart, and at scale, two problems kept recurring. Bugs were hard to trace, because any procedure anywhere could modify shared data. Every one of them was a suspect. And reuse was hard, because behavior lived apart from its data, and had to be untangled before it could be used elsewhere. O O A D responded by organizing software around objects, self-contained units that bundle their own data with their own behavior, the way real things work. A car does not exist as a pile of parts beside a separate manual of driving instructions. The car and its behavior belong together.

Objects

State and Behavior, Together

An object combines two things. State is the data describing it at a given moment, also called attributes. A bank account holds an account number, and a current balance. Behavior is the actions it can perform, also called methods. The account can accept a deposit, allow a withdrawal, and report its balance. Anyone using the object works through its behavior. They do not need to know how it is implemented inside. This mirrors the real world. A thermostat has a target temperature, and a dial that raises or lowers it. You would never think of the dial as existing apart from the setting it controls. Software objects keep related data and logic together the same way.

Classes

One Blueprint, Many Objects

Every object is created from a class. A class defines what attributes and methods its objects will have, without itself being an object. A class is a blueprint. An object built from it is called an instance. A single car class might give every car a color, a speed, and a fuel level, with methods to accelerate, brake, and refuel. Three car objects created from it are three independent instances. Each holds its own values, while sharing the same methods. This is why the paradigm scales. Improve the accelerate method once, in the class, and every car object ever created gets the improvement.

Encapsulation

Protecting Internal State

Encapsulation means keeping an object's internal state hidden, and exposing only a controlled set of methods to view or change it. A bank account object does not let outside code overwrite its balance directly. Instead it offers deposit and withdraw methods, and each can enforce rules, such as refusing a withdrawal that would overdraw the account. Someone might say encapsulation just hides code for no reason. It does much more. If the balance is wrong, the search for the cause is narrowed to the account's own methods. Not every piece of code in the whole system that happens to touch account data.

Figure 1.5(b)

Inheritance and Polymorphism

Here is inheritance and polymorphism in one picture. At the top is the vehicle class, with a speed attribute and a move method. Car and boat each inherit from vehicle. The hollow triangle arrow means is a kind of. Both automatically receive the speed attribute, without redefining it. But each overrides move with its own behavior. A car drives, and a boat sails.

Inheritance

Building on an Existing Class

Inheritance lets a new class be defined in terms of an existing one. The existing class is the parent, or base, class. The new one is the child, or derived, class. The child automatically receives the parent's attributes and methods, rather than rewriting them from scratch. Inheritance captures real is-a relationships. A car is a vehicle, and a boat is a vehicle. The logic every vehicle shares lives once, in the vehicle class, instead of being duplicated in each.

Polymorphism

One Interface, Many Behaviors

Polymorphism means the same method name can trigger different behavior, depending on which object it is called on. Call move on a car object, and it drives. Call the very same move on a boat object, and it sails. The calling code does not need to check which type of vehicle it has. It simply calls move, and the right behavior runs. Together, inheritance and polymorphism let a system grow. Add an airplane class later, with its own move method, and code that already works with vehicles works with airplanes too, without being changed.

Table 1.5

The 5 Core Ideas at a Glance

Here are the five core ideas side by side. An object is data and behavior as one unit, like one specific car in a parking lot. A class is the blueprint an object is built from, like the manufacturer's design specification. Encapsulation hides internal state behind controlled methods, like a car's dashboard controls, rather than its wiring. Inheritance reuses an existing design. A convertible is a specific kind of car. And polymorphism is the same action behaving differently per object. Start works differently on a car and on a boat.

Key Terms

The Vocabulary of This Section

Let's lock in the key terms. An object is a self-contained unit that bundles its own state together with its own behavior. A class is a blueprint that defines an object's attributes and methods. An instance is one specific object created from it. Encapsulation hides an object's internal state, exposing only controlled methods. Inheritance lets a new class reuse the attributes and methods of an existing class. And polymorphism lets the same method name produce different behavior, depending on the object.

Key Takeaways

What to Carry Forward

To pull this together. O O A D emerged because keeping data apart from the procedures that act on it, became unmanageable as systems grew. An object bundles state and behavior, and a class is the blueprint from which many independent instances are made. Encapsulation hides state behind controlled methods, limiting where it can be changed. Inheritance reuses an existing class's design, and polymorphism lets one method name behave differently per object. Together, they let a system add new types, without changing the code that already works.

About Software Engineering at UPI Study

Software Engineering (Computer Science 301) is a self-paced online course of 103 video lessons in 15 chapters, from process models and agile to requirements, design, user interfaces, reliability, security and project management. It carries a NCCRS credit recommendation for 3 semester credits.

Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Compare: Software Engineering vs Systems Analysis

Why take it here

Why students take Software Engineering with UPI Study

How professional software gets builtSoftware Engineering covers how teams turn requirements into working, maintainable software: process models, agile, requirements, design, testing, reliability and project management. It is a core course in computer science and software degrees.
Credit at a fraction of the priceThe same 3 credits can cost $750 or more at a US college. Here it is one payment, self-paced, with lifetime access.
Finish your degree soonerTransfer credits reduce the courses you still owe, so you can graduate earlier or lighten a heavy semester.
Strengthen an applicationA completed college-level course on an official transcript shows admissions and scholarship committees you can do the work.
Study on your own scheduleNo start dates, no deadlines. Watch the lessons, practice, and take the final when you are ready.
130,000+students helped with college creditsACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Where the credit goes

Universities that work with NCCRS

Software Engineering carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.

FAQ

Questions students ask us

About Designing with Objects: The OOAD Approach

What is the difference between a class and an object?
A class is a blueprint that defines which attributes and methods its objects will have, while an object is one specific instance built from that class. A car class might define color, speed and fuel level plus accelerate and brake methods. Three car objects would each hold their own values while sharing the same methods, so improving a method in the class improves every object.
What is encapsulation in object-oriented design?
Encapsulation means hiding an object's internal state and exposing only a controlled set of methods to view or change it. A bank account object, for example, does not let outside code overwrite its balance; it offers deposit and withdraw methods that can enforce rules, such as refusing an overdraft. If the balance is ever wrong, the search for the cause narrows to the account's own methods.
What is the difference between inheritance and polymorphism?
Inheritance lets a child class reuse the attributes and methods of an existing parent class, while polymorphism lets the same method name produce different behavior depending on the object. Car and boat can both inherit a speed attribute from a vehicle class, yet each overrides move: a car drives and a boat sails. Calling code simply calls move without checking the vehicle type.
Why was object-oriented analysis and design developed?
Object-oriented analysis and design emerged because the procedural style, which kept data and the procedures acting on it apart, became unmanageable as systems grew. Bugs were hard to trace since any procedure could modify shared data, and reuse was hard because behavior lived apart from its data. OOAD instead organizes software around objects that bundle their own data with their own behavior.

About the Software Engineering course

How many college credits is Software Engineering?
Software Engineering (Computer Science 301) carries a NCCRS credit recommendation for 3 semester credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
How much does Software Engineering cost and what is included?
$250, paid once, with lifetime access: all 103 video lessons, a practice quiz after each, the graded work and final exam, and an official transcript when you finish. Students who want several courses choose UPI Study PRO instead.
Which universities accept UPI Study credits?
UPI Study has signed partner agreements with universities such as Thomas Edison State University, University of the People and Charter Oak State College, and works with universities such as Penn State, SNHU and SUNY. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities. Use "Find my college" on this page to check yours.
How long does Software Engineering take?
It is self-paced with no deadlines. The 103 lessons total about 11 hours of video; most students add reading and practice time and finish in a few weeks to a few months, on their own schedule.
How are the exams done?
Quizzes and assignments are online in the course. The final exam is taken online with proctoring; a person on the UPI Study team checks assignments, usually within two days.
How do my credits reach my college?
When the course shows 100% complete, request the official transcript from your dashboard. It is sent to the college you name, and you can send it to more than one. Check your college first with "Find my college" on this page, or ask Athena.

Ready for the full course? Earn 3 credits in Software Engineering.

103 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.

Software Engineering
3 credits · NCCRS
Enroll →