Describe the process of decomposition into several related objects.


Teaching Note:

A simple example with 3–5 objects is suggested. Examples related to D.1.1 could be employers, traffic simulation models, calculators, calendars, media collections.

LINK Thinking abstractly.

AIM 4 Applying thinking skills critically to decompose scenarios.


Sample Question:


Describe three advantages of modularity in program development. [for 6 marks!]



JSR Notes:

Abstraction leads to Decomposition

The concept of abstration will come into focus increasingly as we move into Object Oriented Programming. Abstration is basically looking at one layer of detail at a time, ignoring the othe details. A fundamental task of abstraction in object-oriented design is to identify objects in the overall problem domain and to classify them into types/classes. This process is the process of decomposition.


General Definition of Decomposition

Decomposition, generally, is the process of taking a system or problem which is fairly large and/or complicated, and splitting it up into smaller, less complicated pieces. In doing so, each individual part of the system or problem is easier to handle. Via this kind of a "divide and conquor" approach, in which we handle all of the smaller pices/problems one at a time, the entire problem is solved.

Decomposition in Computer Science

Given that computer science is, at its most fundamental and general, the study and managment of complex systems, the concept and application of decomposition cannot be understated.

In one key computer science example of decomposition we speak of algorithmic decomposition; it is the process of solving a complex problem in a step-by-step way. And within a computer program itself, the process of grouping blocks of specialized code into functions/methods is another prime example of decomposition.

Decompostion in OOP

And so in object-oriented porgramming we apply this concept of decomposition on the level of classes/objects. We break a large system down into progressively smaller classes or objects that are responsible for some part of the problem domain.


Advantages of Decomposition / Modularity

1. Faster development
This is mainly because different programming teams can work on different modules/classes.

2. Easier to debug
The idea here is that smaller modules/classes are bound to have fewer mistakes and problems than one big complex program.

3. Easier to update in the future
Individual classes can be adjusted. And because of this, the implications of those changes via interactions with the rest of the program will be minimal and clear.

4. Re-usability
Modules/classes can be stored in libraries and reused for different programs. This in turn further speeds up development.


Examples from the Teaching Note:

So for each of these large/complex systems, how would you decompose them, i.e. how would you break them down into simpler pieces/parts.

Employers Example - A School

Using a school as an example, what classes of objects would make most sense for the management of the school's employees?

Each class would have its own attributes, and associated actions.

So, for example, an attribute of "entertainmentExpenses" for Administrators would be unique to them, along with associated action of "deductFromEntertainmentExpenses".

And as another example, a "teachingExperience" attribute might be common to the Administrator, Teacher, and TeacherAssistant classes, along with an associated action, such as "determineInternaitionalExperience".

(But note - if you are already familiar with OOP - that all would share attributes such as "name", and "address", and so likely here we would have a super class called "Employee", and all of the above would inherit from it.)


Traffic Simulation Model - Example Classes/Objects


Calculator Example Classes/Objects


Calendar Example Classes/Objects


Media Collection Example Classes/Objects