Plan, Execute, and be Flexible
Before you write a single line of code, have a design or plan. Plans come in all shapes and forms. You could have a formal design document, a UML diagram drawn on a cocktail napkin, or an idea you thought about for a few hours. Regardless of the level of polish, you need a plan.
Be flexible and not rigid. You may have spent ten days designing a complex and elegant solution that will not work. Why continue and try to implement this? You are wasting time and energy. This is why you must be flexible. If your plan isn’t going to work you should readjust your plan. Also, allow yourself to be flexible. You will always learn something new, and realize, “uh, that really is not going to work is it.” Go with this realization and adjust.
I saved the topic of execution for last, because it’s the most important of the three. If you have a good plan, execute it. I have seen beautiful design that are poorly executed or not executed at all. Execution is more important when you are on a team. Everyone on the team should play his/her role and not go lone wolf. Not executing the plan on a team is more devistating then coding alone.