Skip to content
Sharp

Software Architecture · interview question

In a Builder pattern implementation, how can you ensure that an object is not constructed in an invalid state?

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

Correct answer

B. By adding validation logic inside the build() method.

Why

Adding validation logic inside the build() method ensures that any constraints or rules are checked before the object is constructed, preventing it from being in an invalid state.

Test yourself on Software Architecture

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

Start free test
All Software Architecture questions →