Apr 28, 2010

Diamonds

What makes a great programmer? As the saying goes, It's hard to define, but I know it when I see it.


Clarity. Easy to read code. Classes that seem so trivial, but do something really complicated. The kind where you smack your forehead and say "Of course, why didn't I think of that..."

Code that is self evident. You know how it is: when a great programmer leaves, it's really easy for someone else to take ownership of their code. When a terrible programmer leaves, the code left behind is such a nightmare, everyone wishes the programmer was still there, so they didn't have to maintain their code.

Bad programmers get lots of inquiries to explain their code. Good programmers don't even know someone is using their code, cause no questions are asked...  The flip side of that is that bad programmers get to feel really important - they're needed when people use their code...

Minimal documentation. Documentation that does exist, explains why something is done, and not what is being done. If you need documentation to explain what is being done, the code needs fixing.

Meaningful method names and parameter names. Short classes and methods.

Good programmers are great communicators, as code is a type of communication.

Great code is elegant.

And then comes Joel and provides a wider view on Spagetti code, with his post: "Things You Should Never Do, Part I"
"Back to that two page function. Yes, I know, it's just a simple function to display a window, but it has grown little hairs and stuff on it and nobody knows why. Well, I'll tell you why: those are bug fixes. One of them fixes that bug that Nancy had when she tried to install the thing on a computer that didn't have Internet Explorer. Another one fixes that bug that occurs in low memory conditions. Another one fixes that bug that occurred when the file is on a floppy disk and the user yanks out the disk in the middle. That LoadLibrary call is ugly but it makes the code work on old versions of Windows 95."

So let me qualify and say that great new code is elegant.  Bad code isn't elegant even when it's new.

Feb 9, 2010

A Symphony in Color


The first time I saw a painting by Whistler, I was quite amazed.



There's something about his paintings that grows on you. At first glance, they're just a wash of color. Only at further contemplation, do the details come out. The bodies are strangely long. Most of the painting taken up by the clothing, the length of the dresses, or the cape. But the details... Just wow. The folds of the material, the draping of the cloth, the walls behind the model.


And the strange names. "Arrangement in Black", "Symphony in Flesh Colour and Pink", "Rose et or: La Tulipe" ("Pink and Gold: The Tulip"), "Arrangement in Black and Brown: The Fur Jacket", "Nocturne in Black and Gold: The Falling Rocket", "Arrangement in Grey and Black, No. 1: Portrait of the Artist's Mother". I couldn't understand why the color was the most important part of the name, or the music reference. It made me stop and reconsider how to view the painting. The color became the main emphasis. And from the color, a deeper understanding of the feeling of the paintings, of the music that they play. The portraits grew alive. I could almost see real live people standing in front of me.

What Genius!