4 ms·
I wish people would have this saying in the Node.js and JavaScript community. I disagree with OP about this topic. Abstractions are like the foundations of a b
by jongjong 3y ago
I wish people would have this saying in the Node.js and JavaScript community. I disagree with OP about this topic.
Abstractions are like the foundations of a building. Imagine that you're building an apartment block and your job is to build the foundations but you're unsure about how tall the building will be.
If you build it on mud, that might be fine for a one story construction but once other builders start adding additional storeys on top, it will become totally unsuitable and the whole thing will have to be rebuilt from scratch. Not only that, the costs will begin to materialize immediately because those who build on top of your foundation will make all sorts of bad decisions because of your poor judgment; they might decide to build the walls out of cheap wood instead of bricks simply because it's lighter and they don't want the building to tilt and sink into the mud... Then because wood was chosen as the material, there may be a termite infestation and builders will have to apply a special varnish on the entire surface of the building... Then the varnish will turn out to be toxic and will need to be removed. Every inch of the building will have to be polished with sandpaper and painted over... And when the next storey will need to be added, they will be forced to make it out of cardboard... Then the tenants on the top floor will want their money back and the whole building will need to be destroyed anyway; all that back and forth will have been nothing but a waste of time. You would have saved an entire decade and millions of dollars if the foundation had been laid on solid bedrock in the first place. Just one small sub-par decision which triggered an avalanche of terrible decisions.
I think duplicating code makes sense and can be a wise decision early in the project because it's essentially a refusal to lay the foundation until there is more clarity about the scope of the project. It's a lot easier to refactor and combine duplicated code into a new abstraction than it is to refactor one abstraction into a different abstraction. Not to mention that developers become very attached to abstractions (including incorrect abstractions) and it tends to upset people once they're invested in it.