CPSA Designing Building Blocks 2 — Questions and Answers
Question 1: Which principle states that a building block should have only one reason to change?
- Open/Closed Principle
- Single Responsibility Principle (Correct answer)
- Liskov Substitution Principle
- Interface Segregation Principle
Correct answer: Single Responsibility Principle
The Single Responsibility Principle (SRP) dictates that each building block should encapsulate exactly one reason for change.
Question 2: What is the primary purpose of defining explicit interfaces between building blocks?
- To maximize code reuse across modules
- To enforce encapsulation and reduce coupling (Correct answer)
- To improve runtime performance
- To simplify database access patterns
Correct answer: To enforce encapsulation and reduce coupling
Explicit interfaces enforce encapsulation by hiding internal details and reduce coupling between building blocks.
Question 3: In iSAQB terminology, a 'building block' is best described as:
- A physical server or virtual machine
- A named, self-contained architectural element with defined responsibilities (Correct answer)
- A database table or schema
- A third-party library or framework
Correct answer: A named, self-contained architectural element with defined responsibilities
A building block is a named, self-contained architectural element with clearly defined responsibilities and interfaces.
Question 4: When should a software architect choose to split one building block into two separate blocks?
- Whenever the block exceeds 500 lines of code
- When the block has multiple distinct responsibilities that change for different reasons (Correct answer)
- When the block is accessed by more than three other blocks
- When performance profiling shows the block is a bottleneck
Correct answer: When the block has multiple distinct responsibilities that change for different reasons
Splitting is justified when distinct responsibilities evolve independently, aligning with SRP to reduce change impact.
Question 5: Which coupling type is considered MOST harmful to building block design?
- Data coupling
- Stamp coupling
- Content coupling (Correct answer)
- Control coupling
Correct answer: Content coupling
Content coupling, where one block directly accesses or modifies the internals of another, is the strongest and most harmful form of coupling.
Question 6: A building block's 'provided interface' is best described as:
- The set of services the block consumes from others
- The set of services the block offers to other blocks (Correct answer)
- The block's internal data model
- The block's deployment configuration
Correct answer: The set of services the block offers to other blocks
A provided interface specifies the services and operations that a building block exposes to other blocks.
Question 7: What does high cohesion within a building block indicate?
- The block depends on many other blocks
- The block's internal elements are strongly related and focused on a single purpose (Correct answer)
- The block has many public interface operations
- The block can be deployed independently
Correct answer: The block's internal elements are strongly related and focused on a single purpose
High cohesion means all internal elements of a building block work together toward a single, well-defined purpose.
Which principle states that a building block should have only one reason to change?