State of mind for Writing Great Code

Taking Care

I hope the next big thing is a consolidation of what we have learned over the last forty years. I hope the next big thing is the realization that software is not about hours worked, but about care. I hope the next big thing is the gradual understanding that developing good software is not about man-hours and raw labor; but about creativity, inventiveness, and a drive for elegance and beauty. (Jeff Atwood, CodingHorror.com)

Making a mess is not faster

Fundamental dilemma. Bad code will fundamentally slow me down. But when faced with a deadline, we go ahead and write bad code anyway. Showed productivity vs time curve. As a project wears on you become less and less productive. The only solution is to clean up the code.

Possibilities:

* Grand redesign in the sky? o It will take forever
* Incremental improvement o Always check code in better than you checked it out. o Never let the sun set on bad code. o Test First! – Provides the necessary flexibility.

Refactor when you smell a mess (festering pile) not when you have a mess (as early as possible). So there is this fine balance be over-engineering and keeping your code clean. So clean it when it starts to smell and not before.

* Professionals write tests first
* Professionals clean their code
* Professionals know the only way to go fast is to go well
* Making a mess is not faster.

Technical Debt

“Technical Debt is a wonderful metaphor developed by Ward Cunningham to help us think about this problem. In this metaphor, doing things the quick and dirty way sets us up with a technical debt, which is similar to a financial debt. Like a financial debt, the technical debt incurs interest payments, which come in the form of the extra effort that we have to do in future development because of the quick and dirty design choice. We can choose to continue paying the interest, or we can pay down the principal by refactoring the quick and dirty design into the better design. Although it costs to pay down the principal, we gain by reduced interest payments in the future”

Robust apps (maybe a little bit exaggerated ;)

You want your compiler and your development environment to be as strict as possible; you want it to literally generate random return values for GlobalSize so that you don’t get into the habit of counting on something that won’t be there everywhere; you want to use French international settings on Chinese Windows 2000 with an absurd color scheme, DVORAK keyboard, trackball, 640×480 VGA mode, and huge ugly fonts on your development system so that you remember to bake in the code that adjusts for all these things. Then your application will be buff and strong and it will laugh in the face of wimpy problems like people who use commas instead of dots as the decimal. Ha. I eat commas for breakfast, your code will say, with a Russian accent. (Joel Spolsky, joelonsoftware.com)