Software Design Principles Flashcards
7 cards from real CPSA practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Software Design Principles flashcards as text
Interface Segregation Principle (ISP) recommends that clients should NOT be forced to depend on interfaces they do not use. What is the PRIMARY design remedy?
Answer: Split large interfaces into smaller, role-specific ones
ISP recommends splitting fat interfaces into multiple focused, role-specific interfaces so clients only depend on the methods they actually use.
Which term describes the degree to which elements within a module belong together and relate to a single purpose?
Answer: Cohesion
Cohesion measures how closely related and focused the responsibilities of a single module are — high cohesion means all elements serve a common purpose.
Preferring composition over inheritance is recommended primarily because composition:
Answer: Avoids breaking changes when parent class internals change
Composition avoids the fragile base class problem — changes to a parent class cannot break subclasses because composed objects are accessed through interfaces, not inherited directly.
What quality attribute is MOST directly improved by applying abstraction in software design?
Answer: Modifiability / maintainability
Abstraction hides implementation details behind stable interfaces, making it easier to change internals without affecting dependent components, directly improving modifiability.
Which scenario is an example of 'feature envy' as a code smell related to design principles?
Answer: A method that uses data and methods from another class more than its own
Feature envy occurs when a method accesses another object's data far more than its own class's data, suggesting the method may belong in the other class.
In the CPSA (iSAQB) framework, which concept describes the degree to which software components can be understood, changed, and tested in isolation?
Answer: Modifiability
Modifiability (maintainability) refers to how easily software can be understood, modified, extended, and tested, which is a primary goal of good design principles.
Which of the following BEST illustrates a violation of the Dependency Inversion Principle?
Answer: A high-level business logic class directly instantiates a specific database class
When a high-level module directly instantiates a concrete low-level class (e.g., a specific database), it creates a hard dependency on implementation details, violating DIP.