---
title: "Encapsulation and abstraction working together"
subject: "Object Oriented Analysis and Design"
chapter: 1
key: "semester_6/object_oriented_analysis_and_design:encapsulation-abstraction-together"
source: https://www.bctengineer.com/q/semester_6/object_oriented_analysis_and_design/encapsulation-abstraction-together
site: BCT Engineering
---

# Encapsulation and abstraction working together

Object Oriented Analysis and Design · Chapter 1: Object Oriented Fundamentals

- Asked in: 2069 Bhadra, 4+6 marks
- Video: [Fundamental Concepts of Object Oriented Programming](https://www.youtube.com/watch?v=m_MQYyJpIjg) — Computer Science Lessons
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/object_oriented_analysis_and_design/encapsulation-abstraction-together
- Whole chapter: https://www.bctengineer.com/md/semester_6/object_oriented_analysis_and_design/chapter-1

## Question

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.

## 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.

## Answer

#### 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.

```text
   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.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. In structured analysis and design, what is the closest thing to encapsulation?
   A. Information hiding in a module, which hides how it works but does not own or protect the data
   B. Binding data and functions into one object
   C. Making all data global so every process can reach it
   D. Inheritance between modules
   Answer: A. SSAD has no true encapsulation; modules only hide their internal processing, while the data stays separate and freely accessible. (Key point: Encapsulation in SSAD)

2. Which statement correctly separates abstraction from encapsulation?
   A. Abstraction hides implementation; encapsulation shows essential features
   B. Abstraction is the outside view (what the object does); encapsulation is the inside view that hides how it is done and protects it
   C. They are the same idea with different names
   D. Abstraction is a mechanism using private fields; encapsulation is a design idea
   Answer: B. Abstraction defines the essential public interface (what), while encapsulation hides and protects the implementation (how). (Key point: Abstraction vs encapsulation)

3. In the BankAccount example, which part is the encapsulation?
   A. deposit(), withdraw() and getBalance() being visible to clients
   B. The private balance field and the minimum-balance rule that clients cannot bypass
   C. The class name BankAccount
   D. The client calling withdraw(500)
   Answer: B. The public operations are the abstraction; keeping balance and its rule private is the encapsulation that enforces it. (Key point: How they work together)

4. If the bank changes how balance is stored, why does no client code change?
   A. Because the client has direct access to balance
   B. Because the public interface (abstraction) stays the same and the implementation is hidden (encapsulation)
   C. Because inheritance copies the new storage to clients
   D. Because SSAD global data is used
   Answer: B. Clients depend only on the interface, so hidden implementation can change freely. (Key point: Benefit of the combination)

## Related in Object Oriented Analysis and Design

- [Object oriented system and core concepts](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Aoo-system-concepts-explained) — Object Oriented Analysis and Design, chapter 1
- [Algorithmic vs object-oriented decomposition](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Aalgorithmic-vs-oo-decomposition) — Object Oriented Analysis and Design, chapter 1
- [Define object; method implements behavior](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Adefine-object-method-behavior) — Object Oriented Analysis and Design, chapter 1
- [Short note: Flow of object](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Ashort-note-flow-of-object) — Object Oriented Analysis and Design, chapter 2

## Related in other subjects

- [Data abstraction versus encapsulation](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Adata-abstraction-encapsulation) — Object Oriented Programming, chapter 1
- [How the Internet and Web work together](https://www.bctengineer.com/question.md?key=semester_7%2Fweb_technology%3Ainternet-and-web-together) — Web Technology, chapter 1
- [Why system modeling; weakness of structured analysis](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Asystem-modeling-importance) — Software Engineering, chapter 2
- [Fundamental concepts of concrete mix design](https://www.bctengineer.com/question.md?key=semester_5%2Fconcrete_technology_and_masonry_structure%3Amix-design-fundamental-concepts) — Concrete Technology and Masonry Structure, chapter 3
