skull

Robert Tamayo

R
B
blog
skull

Fake Problems and Irrelevant Questions

I've written before about fake problems. Fake problems are those problems related only to the implementation of the solution; they are separate from the original problem being solved in the first place. A fake problem in programming might be tabs-vs-spaces, a company's disagreement over which IDE to use, or limitations and conventions of a framework. Regardless of what the problem is, it is an obstacle to reaching the real solution, and it only exists during the implementation of the solution.

Object-oriented programming is prone to this type of problem. Should a Dog class extend Animal? Should it implement Swimmable? Or should a dog just be an Animal class with an enum defined as AnimalType and have an Array of Ability objects including SwimmingAbility?  It's good to focus on these questions at the outset of a project and come up with the ground rules and basic guidelines. After the project is underway, it's better not to think of them too much. The grass is always greener, as they say, and you may be tempted to switch your style too often and hinder any real progress.

In the end, object-oriented programming class design should focused less on categorizing objects according to their real-world taxonomy and more for their actual characteristics as they relate to the solution. If you find yourself focusing too much on whether "something is a something or has a something", you are spending too much time on the fake problem. 

Is a hotdog a sandwich? Is a corndog a lollipop? Don't get stuck on these questions in code.
Comments:
Leave a Comment
Submit