• 0 Posts
  • 3 Comments
Joined 1 year ago
cake
Cake day: June 19th, 2023

help-circle


  • Erm. Duplication of code is ok. Removing absolutely every duplicate function is just premature optimization imho.

    If you have two different customers with slightly different workflow then go ahead and create two mostly the same functions. When you will have 4 different customers with slightly different workflow, then its a time for refactoring, maybe extract basic same functionality into separate function/object, maybe introduce dynamic workflow using finite automata, maybe extract these functionality to separate modules… but never do it prematurily.

    Imho, sometimes ,removing of duplication very much increases complexity and code became hard to understand and hard to modify.