Skip to content
Sharp

Software Architecture · interview question

How does the Builder pattern help in validating the legal states of the constructed object?

Multiple choiceMediumchapter-13-curatedpremiumsoftware-architecturebuilder-pattern
Choose one answer
Answer and explanation

Correct answer

B. It centralizes validation logic in the 'build()' method.

Why

The 'build()' method is where the construction process is finalized, making it the ideal place to centralize and enforce validation logic. This ensures that only valid, well-formed objects are created.

Test yourself on Software Architecture

A free test with instant, explained results. No account needed.

Start free test
All Software Architecture questions →