COMP 211 OOP ASSIGNMENT (30 Marks)
Question 1 (5 marks)
A rural digital library has unreliable internet connectivity and must support physical books, e-
books, and journals using a single software system.
Task:
Explain how you would apply abstraction and polymorphism so that:
i. The system functions offline
ii. New resource types can be added without rewriting existing code
Your answer must explain what you would abstract, why, and how polymorphism would reduce
future redesign.
Expected Answer (Guidance)
A strong response explains that abstraction allows a common resource interface (e.g., borrow,
display metadata) independent of storage or connectivity. Polymorphism enables each resource
type to implement behavior differently (offline file access vs physical lending) while the system
interacts uniformly. The explanation must connect design choices to offline resilience and
extensibility rather than generic definitions.
Question 2 (5 marks)
In a payroll system, management insists that salaries must never be directly modified, but
developers complain that strict encapsulation slows development.
Task:
Evaluate this conflict and propose a balanced encapsulation strategy that protects salary data
without making the system rigid.
Your answer must include one advantage and one limitation of your approach.
Expected Answer (Guidance)
A high-quality answer proposes controlled access via validation methods or properties,
acknowledges development overhead, and explains how encapsulation protects integrity while
allowing legitimate updates. Answers must show trade-off reasoning, not just list benefits.
Question 3 (5 marks)
You are modeling DigitalBook functionality that includes DRM protection, cloud storage, and
offline access.
Task:
Decide whether inheritance or composition is the better design choice and defend your decision
based on:
i. Future feature changes
ii. System maintainability
There is no single correct answer, but your reasoning must be consistent.
Expected Answer (Guidance)
Strong answers clearly justify the chosen approach, showing awareness of coupling, flexibility,
and evolution. Marks are awarded for coherent argumentation rather than the choice itself.
Question 4: Eliminating Conditional Complexity (5 marks)
A junior developer writes a shopping system with many if-else statements to calculate discounts
for different products.
Task:
Explain how polymorphism would change the system’s structure and why this improves long-term
maintainability, especially when new product types are added.
Expected Answer (Guidance)
Learners should reason about structural simplification, adherence to open/closed principle, and
reduced error risk—without repeating textbook definitions.
Question 5 (5 marks)
A team rushes into coding a student records system without designing UML diagrams.
Task:
Critically evaluate what problems are likely to appear later and explain how a UML class diagram
could have prevented at least two of them.
Expected Answer (Guidance)
High-level responses link UML to misunderstanding of responsibilities, poor class relationships,
and rework. The focus is on consequences, not diagram symbols.
Question 6 (5 marks)
A student records system crashes whenever invalid data is entered.
Task:
Analyze how exception handling changes the behavior and reliability of the system and explain
why this matters in real institutions, not just exams.
Expected Answer (Guidance)
Answers must connect exception handling to trust, continuity, and institutional impact—not just
technical correctness.
Question 7 (5 marks)
Your system must:
i. Share student data with external systems
ii. Store data locally when offline
iii. Avoid security risks
Task:
Evaluate the use of JSON and pickle for this context and justify which you would use where.
Expected Answer (Guidance)
Learners should demonstrate contextual decision-making rather than stating pros/cons in isolation.
Question 8 (5 marks)
You are training junior developers who think OOP is “just syntax.”
Task:
Explain how OOP principles directly reduce software failure, rework, and maintenance cost, using
one concrete system example (library, payroll, or shopping).
Expected Answer (Guidance)
Top responses link principles to real outcomes (cost, errors, scalability), demonstrating deep
conceptual understanding.