- 2069 Bhadra · 4+6 marks
Encapsulation and abstraction working together
Short answer
In structured systems analysis, encapsulation only means information hiding of a module's internal process, but data remains shared. In object-orientation, abstraction defines the essential public interface, while encapsulation bundles data and methods and restricts direct access, ensuring the abstraction is enforced and implementation changes are local.
What is the meaning of Encapsulation from the viewpoint of structured systems analysis and design? Explain how Encapsulation and Abstraction concepts work together in object-orientation.
Encapsulation in structured systems analysis and design
In structured analysis and design (SSAD), a system is built from processes (functions) acting on data (data stores, data flows) that are kept separately. The data is global or passed around freely, and any process can read or change it. So in SSAD there is no true encapsulation. The nearest idea is information hiding (modularity): a module (a bubble in a DFD or a box in a structure chart) hides how it works internally and shows only its inputs and outputs. The data it works on, however, is not owned or protected by that module.
Encapsulation in the object-oriented sense goes further: it binds data and the operations on that data into one unit (the object) and restricts direct access to the data from outside.
| Point | Structured (SSAD) | Object-oriented |
|---|---|---|
| Unit | Process/function | Object (data + methods) |
| Data | Separate, often global | Hidden inside object |
| Access | Any function can change data | Only through public methods |
| Effect of data change | Many functions may break | Change is local to the class |
How encapsulation and abstraction work together
- Abstraction is the outside view: it focuses on the essential characteristics of an object that matter to the user and ignores the rest. It answers "what does the object do?"
- Encapsulation is the inside view: it hides the implementation (data structure and algorithms) behind that abstraction. It answers "how is it done, and how is it protected?"
Abstraction decides the public interface; encapsulation enforces it by keeping everything else private. One is the design idea, the other is the mechanism that makes the idea hold.
Client code
| withdraw(500), getBalance()
v
+----------------------------+
| BankAccount (abstraction)| <- public interface
|----------------------------|
| - balance (hidden) | <- encapsulated data
| - checkLimit() (hidden) | <- encapsulated logic
+----------------------------+
Example: A client sees BankAccount only as something that can deposit(), withdraw() and getBalance() (abstraction). The balance field and the rule that the balance must not go below the minimum are private (encapsulation). The client cannot set balance = -1000. If the bank later changes how balance is stored, no client code changes.
Together they give: reduced complexity (user thinks only about the interface), safe data (invariants are protected), easy maintenance (implementation can change freely) and reuse of the class in many programs.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Object oriented system and core concepts · Object Oriented Analysis and Design, chapter 1
- Algorithmic vs object-oriented decomposition · Object Oriented Analysis and Design, chapter 1
- Define object; method implements behavior · Object Oriented Analysis and Design, chapter 1
- Short note: Flow of object · Object Oriented Analysis and Design, chapter 2
- Data abstraction versus encapsulation · Object Oriented Programming, chapter 1
- How the Internet and Web work together · Web Technology, chapter 1
- Why system modeling; weakness of structured analysis · Software Engineering, chapter 2
- Fundamental concepts of concrete mix design · Concrete Technology and Masonry Structure, chapter 3
All Object Oriented Analysis and Design chapter 1 questions →