This
post by Jimmy Nilsson reminded me of some conversations I've had recently about
abstraction. It's not a term that I like, not least because when it's used in relation to code I struggle to find real guidance in it. It's certainly a term thats used a lot in software, I wonder if we really have a shared understanding of what we mean when we use it?
Some words I prefer are '
readable' or '
understandable', these seem far more concrete (forgive the pun) and are things I can more meaningfully provide people feedback on (or receive it!). I don't think I've ever said 'hmm, you need to make this code more abstract'. Maybe what we are looking for is
generalisation - I do know that I've said 'if we make this code more general it could support these other types of order'
Surely it is ok to capture just enough shared understanding such that the code you are writing will do what your users want, and then stop right there, why make things any more abstract than that? In fact this isn't really abstraction, at least at the high level, there may be abstraction going on lower down (around creating a class to represent users, say) but at the problem solving level we are often engaged in
specialisation.
The counter argument might be reuse, if the code is too specialised we might not be able to reuse it. Here again I think generalisation is a better word than abstraction. Do you want a general framework for connecting to databases or an abstract one? Reuse needs to be considered carefully, a common trap in software projects seems to be spending a long time building an abstract framework instead of focusing on the specefics of a client's problem.
I think when people talk about abstraction are often trying to summarise the process of how we go from a problem in a particular domain to a solution that solves the problem, some people use the term '
knowledge crunching' one I personally find a lot easier to understand.
Finally I guess my dislike of the term might also be influenced by people taking it too literally, so from code no one understands to needing a week of workshops around 6 months worth of UML just to try to relate it back to the problem at hand, abstraction in software projects can often be a source of pain.