It seems obvious, but I constantly have to remind my peers to "Keep it simple."
But what do I mean when I say that? In the most general sense I mean that the solution should fit the problem. Often times I find developers trying to make the problem fit a solution that they like for some reason. Sometimes the solution is the new, cool technology that got released with the latest framework update. Sometime the solution is an out-moded way of programming that the developer is comfortable with. Sometimes the solution is a random technology that a peer is working with, and the developer simply wants to know more about. Sometimes the solution is a buzz-word that management or customers heard, and now they want their app to use it so they can seem hip or cool when they talk to their peers about their new solution. I have even seen developers try to implement solutions based on what would look good on their resume!
I should point out that "Keep It Simple" does NOT mean "Make It Dumb". Sometimes a complex problem calls for a complex solution. In these cases the "Simple" approach
IS the complex solution. Trying to solve complex problems with a series of IF statements is likely to be the most complicated and error-prone solution. On the other hand, a well-thought-out data-driven logic engine may be a simple and elegant solution.
The key to "Simple" is to solve the problem at hand. I cannot tell you how many times I have gone to help another developer work out an issue that has them stumped, only to have them stare at me like a deer in headlights when I ask what requirement(s) they are trying to satisfy. You cannot solve the problem if you don't know what it is!
Whether helping others, or starting new development myself, I always ask these questions:
- What is the problem we are trying to solve?
- Does the team have a defined pattern for this problem? If so, is there any reason not to use it here?
- What possible approaches could we take to solve the problem?
- For each approach, what other requirements/problems will it solve?
- For each approach, what other problems might it create?
- Which approach has the best +/- ratio?
Until you have at least thought through all of these questions, you should not even open the IDE.