Qwestrum Engineering360 · IT & Software · Object-Oriented Programming
Design Principles
Design principles like SOLID and DRY guide maintainable object-oriented code by promoting single responsibility, extensibility without modification, substitutable subclasses, focused interfaces, and dependence on abstractions.
Exam tip: keep SI units consistent end-to-end, write the governing relation symbolically before substituting, and sanity-check magnitude and sign.
Key formulas & points
Skim these first — then read the full notes below.
- SRP: a class should have one reason to change
- OCP: open for extension, closed for modification
- DIP: depend on abstractions, not concretions
Topic details
Introduction
This topic covers principles for sustainable design. You study each SOLID principle with examples, apply DRY to remove duplication, and evaluate designs by cohesion and coupling to judge how easily they can evolve.
Key relations & formulas
Formulas (Indian textbook notation)
Formulas (Indian textbook notation)
Formulas (Indian textbook notation)
Notation and sign conventions
Relation 1 —
Formulas (Indian textbook notation)
Write this relation with symbols exactly as in Programming in ANSI C / OOP with C++ — E. Balagurusamy before substituting numbers. Examiners award partial marks for a correct setup even when arithmetic slips.
Relation 2 —
Formulas (Indian textbook notation)
Write this relation with symbols exactly as in Programming in ANSI C / OOP with C++ — E. Balagurusamy before substituting numbers. Examiners award partial marks for a correct setup even when arithmetic slips.
Relation 3 —
Formulas (Indian textbook notation)
Write this relation with symbols exactly as in Programming in ANSI C / OOP with C++ — E. Balagurusamy before substituting numbers. Examiners award partial marks for a correct setup even when arithmetic slips.
Concept in depth
Good design is about accommodating change cheaply. The single-responsibility principle keeps each class focused so a change has one cause, and the open-closed principle lets you add behaviour by extension rather than editing tested code, reducing regression risk. Liskov substitution keeps polymorphism safe, interface segregation avoids forcing clients to depend on methods they do not use, and dependency inversion decouples high-level policy from low-level detail by routing both through abstractions. Underlying all of them are two measures: high cohesion (a module’s parts belong together) and low coupling (modules depend on each other minimally), which together make systems easier to understand, test and modify.
Assumptions and validity limits
State assumptions explicitly before using any relation for design principles — steady state, uniform properties, linear elastic material, ideal gas, incompressible flow, etc., as applicable.
Wrong assumptions invalidate the entire solution even when the formula is correct. In OOP viva and GATE descriptive questions, listing valid assumptions often earns separate marks.
Step-by-step problem approach
1. Read the question and list given data with SI units (common in OOP papers).
2. Draw a neat labelled diagram where applicable — examiners in Indian universities award diagram marks even when arithmetic slips.
3. Identify which relation from this topic applies to design principles.
4. Use equation 1:
5. Use equation 2:
6. Substitute values, compute, and verify units and sign (direction).
7. State conclusion in one line — e.g. safe/unsafe, stable/unstable, feasible/infeasible.
2. Draw a neat labelled diagram where applicable — examiners in Indian universities award diagram marks even when arithmetic slips.
3. Identify which relation from this topic applies to design principles.
4. Use equation 1:
.
5. Use equation 2:
.
6. Substitute values, compute, and verify units and sign (direction).
7. State conclusion in one line — e.g. safe/unsafe, stable/unstable, feasible/infeasible.
Applications & exam relevance
Design Principles appears in Java/C++ application development. In Indian it software curricula this topic is tested because it connects theory to classes, inheritance, and polymorphism.
GATE and semester exams often combine design principles with earlier units — revise prerequisites before attempting mixed problems.
Industry interview panels sometimes ask: "Where did you use design principles?" — answer with a lab, mini-project, or plant visit example if possible.
Common mistakes in exams
Students memorise the SOLID acronym without applying it, confuse LSP with simple inheritance, and mistake DRY for merging unrelated code that merely looks similar. Treating high coupling as acceptable because the code works today is a maintainability trap.
Quick revision checklist
Before attempting design principles problems, confirm you can:
1. SRP: a class should have one reason to change
2. OCP: open for extension, closed for modification
3. DIP: depend on abstractions, not concretions
2. OCP: open for extension, closed for modification
3. DIP: depend on abstractions, not concretions
Revise the solved examples in Programming in ANSI C / OOP with C++ — E. Balagurusamy and one previous-year GATE or university paper for this unit.
Worked examples
Try the problem first — open the solution when you are ready to check.
Applying the open-closed principle
Problem
A shape-area function uses a big if-else on shape type and must change whenever a new shape is added. Which principle is violated and how is it fixed?
Solution
It violates the open-closed principle. Fix it by giving each shape an area() method (polymorphism) so new shapes extend the system without modifying the existing function.
Conceptual check — Design Principles
Problem
In a OOP semester or GATE paper you are asked: "State the main assumption, the governing relation, and one practical consequence of design principles." What should a complete answer include?
📖 Standard books (India)
Programming in ANSI C / OOP with C++ — E. Balagurusamy
Read: Syllabus unit
Standard Indian classroom programming text
Explore related topics
See real it & software careers
After exams and interviews, see how engineers actually built careers — milestones and decisions from people in the field.