Twitter Photos RSS Feed
 
 

Apr 09, 2006

 

How often do you have one of those moments when you read or see something that describes a way you do something, even though you never really realized that’s how you did it? When it comes to comptuerizing and programming, I find that happens a lot - more often than is probably good, if that’s bad to begin with. But when I was reading through one of my regular blogs, Coding Horror, I came across a post that talks about the “balance and elegance” of coding.

It references a book from an earlier time where a programmer was interviewed on the topic of balance and elegance of source code - the actual lines of code (text) that are then used to make the program go. The guy interviewed relates coding to sculpting in clay, where you have a ton of stuff but then must whittle it down to be something viewable and balanced.

It shouldn’t have one “if” that’s huge and an “else” that’s small.”

Amazingly enough, when I read that sentence I stopped a did a complete “holyshit, that’s how I code” - I couldn’t believe it. The idea that the visualization of the code makes any difference is sort of silly and really has no bearing on how the program works or functions - yet this is something I do instinctively when coding.

I can’t stand seeing off-balance code because not only does it look bad, but it just gives me this vibe like I did something wrong. Nine times out of 10 relationships between things need to be balanced, and when they’re not it’s usually a sign of inevitable doom or that it works for the now but not for the later.

To this day, on large projects I regularly print out the code and tape it all together in one long sheet and look at it on my wall. Then I look at it and find these place where the code looks wrong - where it doesn’t seem to flow with the rest, and I usually find that section of code can be redone or needs to be removed completely.

Maybe some of this is the “artist” in me, I dunno, but now that I’m conscience of this thing I hope it doesn’t throw me off when I catch myself doing it.

 
Apr 09, 2006 | The art in coding |
 

3 Comments

  1. Big G says:

    I picked up a C++ textbook the other day. Remembering all of the little syntax stuff is going to be the hardest part for me. I’ve got a pretty good handle on the logic, but I have always had to refer back to example code to be able to get it pieced together right.

    I took an older PC that I had and threw a bare bones install of Slackware Linux on it (no GUI, just commandline for now). I’ve got the gcc compiler on it to be able to compile my code and the example programs that came with the book on CD.

    I’m sort of excited to start coding something. Too bad I don’t really have any projects in mind for it right now.

    G+

  2. Brian says:

    Just make a simple program that serves no purpose but covers all the functions. Something like a book database or something.

    And believe, me don’t start to “know” code until you’ve been doing it. 99% of the time you find what you want on a site, copy it, tweak it, then just copy-n-paste it everytime you need it - you don’t have to know code, just how it works. Then over time the more you see it the more you remember it.

  3. Big G says:

    I’m up to chapter 3 right now in my book. I know that doesn’t sound like much, but keep in mind that it’s a text book.

    The authors are Dietel and Dietel. So far, I really like this book. I’ve been able to just sit down and read it. It is writen such that it isn’t too dry to just read. It includes some case study projects too, that not only cover the coding aspect, but take you through the whole process of analyzing the project needs, drafting up the diagrams, planning the objects, and finally coding up the various objects.

    G+

Leave a Reply