Skip to main content
InterviewHubPRO
Section Overview
Q37

Question 37 of 50

Part 3: Architectural Patterns & Enterprise Systems (25 - 35)

74%
Design Patterns (GoF) (50 Qs)•Part 3: Architectural Patterns & Enterprise Systems (25 - 35)

State Pattern vs Strategy Pattern: Structural similarities and behavioral differences.

mid LevelBehavioral

In Simple Words: Both patterns look structurally identical (a Context class delegating to an interface):

  • Strategy Pattern: The client configures the Context with a specific algorithm (e.g. FastRouteStrategy vs ScenicRouteStrategy). The strategies are completely independent and usually do not know about each other.
  • State Pattern: The Context transitions through a Finite State Machine (e.g. Order: Draft -> Paid -> Shipped -> Delivered). Concrete state classes know about other states and actively trigger transitions on the Context object based on method invocations.