< B / >

Pulling Out Implementation is not Abstracting

So, you’re writing code

  1. You notice some sameness in the code you’re writing.
  2. You know what to do—cause you’re a good and responsible programmer!—you pull the sameness out.
  3. You call that ‘abstraction’, are happy with your life, and carry on.

Unfortunately, this is not the whole story.

Because sometime later someone (probably you) wants to add a behavior to one of the few functions you pulled that code out from. Turns out the code wasn’t similar for a good reason—it was only similar incidentially.

And now they (that is, you) got a problem—cause they want to you only named the function withData

  • pulling sameness out => This is something you should not do!
  • Say “Abstraction”

≺≻ Problems With WebDev | The Primagen