Functional Decomposition

This anti-pattern is about missing definition of object-oriented design. The approach are replaced with a list of functionalities that process data structure as an input. Such anti-pattern is commonly seen in Pascal, Fortran, or C. This is commonly at application level.

Consequences

  • Large libraries of functions.
  • Can be hard to maintain.

Symptoms

  • When functions' name starts with a purpose, e.g. calculate_interest, display_table.
  • Architecture so decomposed until each class/structure only has 1 function or 1 attributes.
  • Did not leverage class/structure's inheritance and polymorphism nature = a lot of duplicated class definition (Very hard to maintain).
  • No clear way of documentation.
  • Frustration and hopelessness by testers.

Causes

  • Missing proper architecture design / design was done by inexperience architect.
  • Lack of object-oriented programming paradigm (technical debt).
  • Lack of architectural enforcement.
  • Specified disaster.

Fixing Recipes

  1. Schedule refactoring time.
  2. Write a test suite to lock the current results and outcome.
  3. Design object-oriented architecture.
  4. Refactor source codes. Ensure the test results are consistent.