3 ms·
There's nothing wrong with this kind of "indirection", I agree there are times when you might not want to do this but I would put it in terms of cognitive overl
by bcheung 7y ago
There's nothing wrong with this kind of "indirection", I agree there are times when you might not want to do this but I would put it in terms of cognitive overload.
By substituting a series of lower level concepts/tasks/procedures into a single keyword the reader can more easily think about the problem domain. That's a good thing. If they know the abstraction, it reduces the number of things the reader must keep in their head.
However, if the reader is not familiar with the abstraction they will need to spend time to familiarize themselves. This can break down when trying to understand an abstraction leads to the "endless rabbit hole" problem. Basically, you have to open another file to see how that abstraction works, then it uses some other abstraction which you need to open another file to read, and so on. If the depth is too great the reader will lose context and won't be able to fit the problem in their head.
To avoid this, pull more of the functionality into the function instead of outsourcing it to an abstraction. Favor writing code that reads sequentially rather than as a series of jumps through a bunch of files.
As always, this is largely a matter of taste so use your best judgement and balance abstraction with pragmatism.