This Note isn't published yet.
It's at most half done, and it's probably confusing to read.
It might be a good idea to come back later.
Alternatively, you can prod me to write it.
It's at most half done, and it's probably confusing to read.
It might be a good idea to come back later.
Alternatively, you can prod me to write it.
Pulling Out Implementation is not Abstracting
Started 8 months ago
Last edited 8 months ago
So, you’re writing code
- You notice some sameness in the code you’re writing.
- You know what to do—cause you’re a good and responsible programmer!—you pull the sameness out.
- 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”