CSC375 ยท 2076 ยท 5 marks
What is modular decomposition? Discuss object oriented model of decomposition.
What is modular decomposition? Discuss object oriented model of decomposition. [5]
Quick answer
Modular decomposition is a process of decomposing subsystems into modules. After the system has been decomposed into subsystems (during system structuring), each subsystem must be further decomposed into lower-level modules such as components, objects, or functions. It is one of the key activities of the architectural design process.
Modular Decomposition and Object Oriented Model of Decomposition
Modular Decomposition
In short: System --> Subsystems --> Modules (via modular decomposition)
Two modular decomposition models are commonly used:
- Object Oriented Model (decomposition into objects/classes)
- Function Oriented (Pipeline) Model (decomposition into functions/processes)
Object Oriented Model of Decomposition
In the object oriented model, the system is decomposed into a set of loosely coupled objects with well-defined interfaces. Each object encapsulates its own private state (data/attributes) and operations (methods/behaviors).
Key characteristics of this model include:
| Feature | Description |
|---|---|
| Encapsulation | Each object hides its internal state from other objects |
| Abstraction | Objects expose only necessary interfaces |
| Reusability | Objects/classes can be reused across the system |
| Maintainability | Changes to one object have minimal impact on others |
Steps in Object Oriented Decomposition
- Define the context and modes of use of the system.
- Design the system architecture by identifying major subsystems.
- Identify the principal system objects (classes) from the requirements.
- Develop design models such as class diagrams, sequence diagrams, etc.
- Specify object interfaces -- define the operations each object provides.
Example
Consider a Patient Management System:
- It can be decomposed into objects such as
Patient,PatientRecord,Doctor,Appointment. - Each object has its own attributes and methods.
- Objects communicate with each other through well-defined interfaces.
Patient PatientRecord
----------- ---------------
- patientID - recordID
- name - diagnosis
- age - treatment
----------- ---------------
+ register() + addRecord()
+ getDetails() + getHistory()
These classes and their associations are modeled using UML Class Diagrams, which show the static structure of the system.
Advantages of Object Oriented Decomposition
- Software is easier to change and maintain compared to functional approaches.
- Promotes reusability of object classes.
- Closely models real-world entities, making design more intuitive.
- Supports incremental development -- individual objects can be developed and tested independently.
In summary, modular decomposition breaks subsystems into manageable modules, and the object oriented model does this by organizing the system around objects that encapsulate both data and behavior, making the system more modular, reusable, and maintainable.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.