this post was submitted on 07 Aug 2023
0 points (NaN% liked)

Programming

16996 readers
93 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
top 1 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 1 year ago

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.