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
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Software Engineering.
Lesson complete
Earn the 3 college credits for Software Engineering
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: Drawing Interactions: UML Use Case Diagrams in Action →← Structuring Information: Data Modeling BasicsNext lesson: Drawing Interactions: UML Use Case Diagrams in Action →
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.
Enroll now → Course details Download the syllabus All Computer Science courses Every course with PRO →
Why take it here
Why students take Software Engineering with UPI Study
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.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →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?
What are the three compartments of a UML class?
What is the difference between aggregation and composition in UML?
How is inheritance shown in a UML class diagram?
About the Software Engineering course
How many college credits is Software Engineering?
How much does Software Engineering cost and what is included?
Which universities accept UPI Study credits?
How long does Software Engineering take?
How are the exams done?
How do my credits reach my college?
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.
3 credits · NCCRSEnroll →