by bcoates · 14y ago · 0 comments
If you actually have a reason to believe you need a gold-plated general-case OS identification system then throwing all those patterns at it is no worse than the nested-if spaghetti procedural code that would be the naieve procedural solution.
But in both cases it's just a stupid answer to a stupid question ("How do I overengineer a string->string table lookup?")
Obviously truly complicated systems will need complicated solutions, and OO has some not-completely-insane things to say about solutions like that.
But the real world doesn't see things like that very often. Real world programming is made up of thousands of tiny problems not altogether unlike the hack shown here. And real-world OO nuts, faced with these real-world problems, tend to solve them badly.
So sure, "How do I overengineer a table lookup" is a dumb question, but that's not the question posed. The question is "How do I avoid overengineering a table lookup", and the answer is "avoid OO".