Skip to main content
InterviewHubPRO
Section Overview
Q48

Question 48 of 50

Part 3: Enterprise Architecture, Package Design & Enforcement (25 - 35)

96%
SOLID & OOP Principles (50 Qs)•Part 3: Enterprise Architecture, Package Design & Enforcement (25 - 35)

Anti-Patterns Violating SOLID: Shotgun Surgery vs Divergent Change.

senior LevelSystem Design

In Simple Words:

  • Divergent Change (Violates SRP): When one class has to be modified in different ways every time different business requirements change (e.g. modifying OrderManager for shipping changes, tax changes, and PDF template changes).
  • Shotgun Surgery (Opposite of SRP): When a single business change requires making dozens of small edits scattered across 15 different classes. Indicates responsibilities are fragmented and tightly coupled.
  • Feature Envy: When a method in Class A spends all its time reading properties and calling methods in Class B. The method belongs inside Class B!