Organizing Data with Class-Based Modeling, Explained

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

Organizing Data with Class-Based Modeling

Software Engineering · Chapter 6: Requirements Engineering and PrototypingSection 6.7 · lesson 44 of 1036 min · free with a free account

← Structuring Information: Data Modeling BasicsNext lesson: Drawing Interactions: UML Use Case Diagrams in Action →

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

In this lesson

Class boxes, and the 4 ways classes connect.

  • Explain what a class diagram represents
  • Read the 3 compartments of a UML class box
  • Distinguish association, aggregation, and composition
  • Explain inheritance as an "is-a" relationship

Transcript

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

Requirements Engineering and Prototyping

Organizing Data with Class-Based Modeling

A scenario captures one walkthrough of a system in use. A class diagram captures something that stays true no matter which walkthrough you look at. The underlying shape of the data itself. This section covers how a class is drawn, and the four ways classes connect to each other.

Structure, Not a Story

True Across Every Walkthrough

A class diagram is a static, structural picture. It describes what exists and how it is related, not the sequence of events in any one situation. A scenario follows one specific path through time. A class diagram stays true across all of them, because it describes the structure they are built on. It shows what kinds of things exist in the system, what each one knows and can do, and how they connect. And it is a picture of the program's own classes. That is related to, but distinct from, modeling a database's stored data.

Anatomy of a Class Box

3 Compartments

In U M L, a class is drawn as a rectangle split into three compartments. The top holds the class's name. Here, Book. The middle lists its attributes, the data each instance holds, written as a name and a type. Here, a title, an I S B N, and whether the book is available. The bottom lists its methods, the operations an instance can perform. Here, check out, and return book. A plus sign marks something public, and a minus sign marks something private.

How Classes Connect

A Spectrum of Ownership

Beyond a single class, a diagram shows how classes relate. Three of these relationships form a spectrum of increasingly strong ownership. An association is the most general connection. Two classes are related, with no ownership implied either way. Aggregation is a whole-part relationship, where the part can still exist on its own if the whole goes away. A library closing does not erase its books. Composition is a stronger whole-part relationship, where the part's existence is bound to the whole. In this model, a room does not exist apart from the specific house it belongs to.

Inheritance

"Is a", Not "Has a"

Inheritance models something different. Not has a, but is a. A subclass inherits the attributes and methods of a more general superclass, while adding or overriding its own. A car is a kind of vehicle. It inherits whatever a vehicle already has, and adds what makes a car specifically a car.

Figure 1

The 4 Core Relationship Notations

Here are the four core notations, one per row. An association is a plain line. A customer and an order are connected, with no ownership. Aggregation adds a hollow diamond, at the whole's end. A library has books, but the books can outlive it. Composition adds a filled diamond. A house has rooms, and the rooms do not outlive the house. And inheritance is a line with a hollow triangle, pointing to the superclass. A car is a vehicle.

Table 1

Relationships at a Glance

Here is the same information as a table. Association is a plain line, like a customer placing an order. It is a general connection, with no ownership. Aggregation is a line with a hollow diamond, like a library that has books. The parts can exist independently. Composition is a line with a filled diamond, like a house that has rooms. The parts are destroyed with the whole. And inheritance is a line with a hollow triangle, like a car that is a vehicle. The subclass inherits and extends.

Worth Noticing

1 Detail, a Different Claim

It is worth noticing how similar two of these look. Aggregation and composition are drawn almost identically. The only difference is a hollow diamond, versus a filled one. But they make very different claims about what happens to the parts if the whole is removed. With aggregation, the parts carry on. With composition, they go with it. So that single visual detail carries real meaning.

Why This Matters

Capturing Structure, Not Designing It

Why does this matter at the requirements stage? Here, class notation is a tool for capturing and checking structure. It describes what the data looks like. Actually designing a system around that structure, decision by decision, is a separate step that comes later.

Key Terms

The Vocabulary of This Section

Let's lock in the key terms. A class diagram is a static, structural picture of a system's classes, their attributes and methods, and how they relate. An attribute is a piece of data an instance holds, listed in the middle compartment. A method is an operation it can perform, in the bottom compartment. Aggregation is a whole-part relationship, with a hollow diamond at the whole, where the part can exist independently. And composition is a whole-part relationship, with a filled diamond at the whole, where the part's existence is bound to the whole.

Key Takeaways

What to Carry Forward

To pull this together. A class diagram shows static structure, which stays true across every scenario. Each class box holds a name, attributes, and methods. Association, aggregation, and composition express increasingly strong ownership. Inheritance models an is-a relationship, with a hollow triangle pointing to the superclass. And the difference between a hollow and a filled diamond answers one question. Do the parts outlive the whole?

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 Organizing Data with Class-Based Modeling

What does a UML class diagram show?
A UML class diagram is a static, structural picture of a system's classes, what each one knows and can do, and how the classes relate. Unlike a scenario, which follows one path through time, a class diagram stays true across every walkthrough because it describes the structure they are built on. It models the program's classes rather than a database's stored data.
What are the three compartments of a UML class?
A UML class is drawn as a rectangle with three compartments. The top holds the class name, such as Book. The middle lists attributes, the data each instance holds, written as a name and type, such as title or ISBN. The bottom lists methods, the operations an instance can perform. A plus sign marks public members and a minus sign marks private ones.
What is the difference between aggregation and composition in UML?
Both are whole-part relationships, but they differ in what happens to the parts when the whole goes away. In aggregation, drawn with a hollow diamond at the whole's end, parts can exist independently, as books can outlive a library. In composition, drawn with a filled diamond, the part's existence is bound to the whole, as rooms do not outlive their house.
How is inheritance shown in a UML class diagram?
Inheritance is drawn as a line with a hollow triangle pointing to the superclass. It models an is-a relationship, unlike association, aggregation, and composition, which describe connection or has-a ownership. A subclass inherits the attributes and methods of the more general superclass and adds or overrides its own. For example, a car is a vehicle.

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 →