jack: (Default)
[personal profile] jack
I think my brain is hardwired to solve problems in the most elegant way. This has good consequences (I got a good degree from Cambridge, am paid £n0k/yr to program, and can beat Tony at noughts and crosses generalisations) and bad consequences (I don't like asking for directions or other help, I find it hard to get on well with people, etc).

When I was young, it used to almost be a point of pride that I didn't comment my code. Now I do so quite well, or so I believe. But I think both stem from the same underlying trait. When I was young, I saw the problem as "Write this program." Now, the problem has evolved into "Write this program so it works, and solves a specific problem, and in the future update it with the least possible effort."

Date: 2006-05-11 08:43 am (UTC)
aldabra: (Default)
From: [personal profile] aldabra
I used to think commenting code was a waste of time.

Until my first assignment in my previous job was to learn C and take over maintaining 100,000 lines of home-grown system, whose writer had left, and whose comments were restricted to one-liners saying things like "Bet you can't see why I've done it like this!" and variables were called things like isnull and were true if it wasn't and false if it was.

Now I think the standard should be that *someone else* can update it in the future with the least possible effort, and you shouldn't necessarily assume that they've used the language before...

Date: 2006-05-11 08:53 am (UTC)
From: [identity profile] cartesiandaemon.livejournal.com
Yeah. If you optimistically assume coding is 99% of the time -- which it might be for a short purely technical personal project -- coding adds a lot. But nowadays almost all the time is working out what you should make things do, writing it is easy, so comments become *part* of the working out time.

"Bet you can't see why I've done it like this!"

ROFL.

Now I think the standard should be that *someone else* can update it in the future with the least possible effort

That's about right. As a matter of fact I tend to think of "myself, with no memory of this code whatsoever" which is often close to the truth.
From: [identity profile] cartesiandaemon.livejournal.com
This standard also avoids /* Add one to x, wraps at 2^n */ comments because it's obviously not useful :)

Date: 2006-05-11 12:19 pm (UTC)
From: [identity profile] feanelwa.livejournal.com
*applauds* hear hear.

Why yes I have been fixing other people's code for the last two days, why do you ask?