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
Which design principle states that a class should have only one reason to change?
Answer: Single Responsibility Principle
The Single Responsibility Principle (SRP) states that a class should have only one reason to change, meaning it should have only one responsibility.
In the context of software coupling, which scenario represents the LOWEST level of coupling?
Answer: One module passes a single primitive value to another
Data coupling, where modules interact only through simple parameters, represents the lowest (loosest) form of coupling.
Which principle guides you to 'program to an interface, not an implementation'?
Answer: Dependency Inversion Principle
The Dependency Inversion Principle advocates programming to abstractions (interfaces) rather than concrete implementations to reduce high-level module dependency on low-level details.
A software team notices that changing one module frequently requires changes in many other unrelated modules. This is best described as a violation of which principle?
Answer: Low Coupling
When changes ripple across many modules, it indicates high coupling โ modules are too tightly interdependent, violating the Low Coupling principle.
The Law of Demeter (Principle of Least Knowledge) primarily aims to reduce which quality problem?
Answer: Tight coupling between objects
The Law of Demeter limits object interactions to immediate collaborators, reducing tight coupling by preventing deep chains of method calls.
Which of the following BEST describes the concept of information hiding in software design?
Answer: Concealing implementation details behind a public interface
Information hiding means concealing a module's internal implementation details, exposing only a well-defined interface to reduce coupling and support change.
When applying the 'Separation of Concerns' principle, which outcome is MOST expected?
Answer: Each module addresses a distinct, well-defined aspect of functionality
Separation of Concerns divides a system so each module addresses one distinct aspect, improving maintainability and reducing complexity.