ConstructiCat Logo
CodeBust.
Browse section ▾

Divergent Change.

You find yourself having to change many unrelated methods when you make changes to a class. For example, when adding a new product type you have to change the methods for finding, displaying, and ordering products.

##Signs and Symptoms

You find yourself having to change many unrelated methods when you make changes to a class. For example, when adding a new product type you have to change the methods for finding, displaying, and ordering products.

class Order {
  void applyVat2024() {}
  void applyVat2025() {}
  void formatEuInvoice() {}
  void formatUsInvoice() {}
}

##Reasons for the Problem

Often these divergent modifications are due to poor program structure or “copypasta programming”.

##Treatment

##Payoff

  • Improves code organization.

  • Reduces code duplication.

  • Simplifies support.