I have seen this "premature abstraction" warning creep through our discourse lately, but I don't clearly understand it. I feel like I'm making calls all the time about when to introduce functions or classes that will save you time or effort in the future without forcing yourself to see the repetition before you do. Not only that but Hamming's advice has rung true in my career. Solving the general problem is often easier than solving a specific case and can be re-used for later instances, too.
[1] https://jamesclear.com/great-speeches/you-and-your-research-...
Abstractions are essential to productivity or you'll never get out of the "make it from scratch" trap
You can quickly make a prototype in Python, but it won’t be as performant as C. You can spend time profiling it and moving computationally-heavy parts into C extensions (I do this for fun and learning), but you’ll likely spend more time and get worse results than if you just rewrote it.
Docker is an abstraction over already-existing technology like cgroups. It provides an easy-to-understand model, and a common language. This is quite valuable, but it does allow one to not know about what it’s hiding, which is problematic when troubleshooting – for example, naïvely assuming that querying /proc in a container shows the CPU resources allocated to the container, rather than the host.
That’s how I view abstractions. They can be incredibly useful, but they usually have trade-offs, and those should always be considered. Most importantly, you should at a minimum be aware of what you’re giving up by using them, even if you don’t fully understand it.
You and the other person are both correct. What you're saying makes sense and it is what everybody is trained to do. However, it leads to a lot of useless code exactly because you're applying an abstraction that is used only once. That's why most codebases are bloated and have a huge number of dependencies.
The silly "only after # Times" type rules stolen from the DRY for DRY reasons is part of the problem and far from the solution.
"Abstraction" could be anything from keeping code in different but adjacent files to an entire anti-corruption layer etc....
The costs are different, as are the benefits.
It is horses for courses, not 'one rule that the government doesn't want you to know about'
There are exceptions. If you are implementing the language it is your job to write them. It is useful as a student to implement the basics from scratch. Your language may decide something is not allowed and thus not implement it (a doubly linked list is almost always a bad idea in the real world. Likewise you don't need to provide all the sorting algorithms)
Was it the Mythical Man Month book Maybe?
Things became much better after relatively recent improvements in generalist sorting libraries: when pattern defeating quick sort variants became norm, when mostly sorted cases got covered ...
Tbh I do have a case from 2013-16 when I regret not doing it for one AAA project on ps4.
This is the exact thought process that leads to unnecessary abstraction. This is the attitude that the article is criticizing.
A good rule of thumb is never abstract unless you genuinely have done the same thing twice already.
i.e. only write an abstraction after you've written the boring, simple, concrete, implementation twice and are about to write it a third time.