Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Got a chuckle and wanted to share.

13 views
Skip to first unread message

Scott Johnson

unread,
Apr 27, 2013, 4:51:27 PM4/27/13
to
I was brushing up on some debugging techniques and ran across a page
with this quote that made me chuckle.

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it." - Brian W. Kernighan

The Natural Philosopher

unread,
Apr 27, 2013, 5:06:11 PM4/27/13
to
that makes a LOT of sense to me..

After revisting code I had written months before I thanked heaven I had
written it for any damned fool to debug, cos frankly I couldn't
understand or remember how on earth I came to write it in the first place!



All I can say is that working under extreme pressure I was on some sort
of coding planet...

--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.

Arno Welzel

unread,
Apr 28, 2013, 4:36:03 PM4/28/13
to
Scott Johnson, 2013-04-27 22:51:
That's why peer programming and code review exists ;-) In our team code
*always* get's reviewed by someone else before it will make it to the
final production stage.


--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

Scott Johnson

unread,
Apr 28, 2013, 7:03:22 PM4/28/13
to
On 4/28/2013 1:36 PM, Arno Welzel wrote:
> Scott Johnson, 2013-04-27 22:51:
>
>> I was brushing up on some debugging techniques and ran across a page
>> with this quote that made me chuckle.
>>
>> "Debugging is twice as hard as writing the code in the first place.
>> Therefore, if you write the code as cleverly as possible, you are, by
>> definition, not smart enough to debug it." - Brian W. Kernighan
>
> That's why peer programming and code review exists ;-) In our team code
> *always* get's reviewed by someone else before it will make it to the
> final production stage.
>
>

Yeah but when you are the team, that is all out the door.

I understand what NP is saying though. I have revisited code I wrote
years ago. I know I must of been in 'the zone', because some of the
algorithms (some) where just short of brilliant and trying to figure out
what I was thinking without comments (kind of wipes out the brilliant
part I know), was like an outer body experience.

:)
Scotty

Doug Miller

unread,
Apr 28, 2013, 10:42:41 PM4/28/13
to
Scott Johnson <noon...@chalupasworld.com> wrote in news:klk9mf$ce8$1@dont-
email.me:

>
> I understand what NP is saying though. I have revisited code I wrote
> years ago. I know I must of been in 'the zone', because some of the
> algorithms (some) where just short of brilliant and trying to figure out
> what I was thinking without comments (kind of wipes out the brilliant
> part I know), was like an outer body experience.

And that is why I *always* comment code whose purpose is not immediately obvious: self-
defense. Even with a large applications group, you still wind up maintaining a lot of your own
code, maybe years later: "Hey, who wrote this module? Doug did? OK, Doug, you get to do
this enhancement." Never mind the fact that Doug is now the sysadmin, and hasn't worked in
apps development for five years... Naah, that'd never happen... Would it?

The Natural Philosopher

unread,
Apr 28, 2013, 11:45:08 PM4/28/13
to
I think what happens with me anyway, is that after a while I have more
or less the whole structure and design in my head, and coding is just a
matter of writing the mental picture in the language. The temptations is
to do that but IF the actual concept is flawed or its got lost in
translation its vile to debug without the comments.

Often I will write the pseudo code as a comment and see if the code
actually corresponds..
Message has been deleted

Richard Yates

unread,
Apr 29, 2013, 9:37:14 AM4/29/13
to
On Mon, 29 Apr 2013 04:45:08 +0100, The Natural Philosopher
<t...@invalid.invalid> wrote:

>On 29/04/13 03:42, Doug Miller wrote:
>> Scott Johnson <noon...@chalupasworld.com> wrote in news:klk9mf$ce8$1@dont-
>> email.me:
>>
>>> I understand what NP is saying though. I have revisited code I wrote
>>> years ago. I know I must of been in 'the zone', because some of the
>>> algorithms (some) where just short of brilliant and trying to figure out
>>> what I was thinking without comments (kind of wipes out the brilliant
>>> part I know), was like an outer body experience.
>> And that is why I *always* comment code whose purpose is not immediately obvious: self-
>> defense. Even with a large applications group, you still wind up maintaining a lot of your own
>> code, maybe years later: "Hey, who wrote this module? Doug did? OK, Doug, you get to do
>> this enhancement." Never mind the fact that Doug is now the sysadmin, and hasn't worked in
>> apps development for five years... Naah, that'd never happen... Would it?
>I think what happens with me anyway, is that after a while I have more
>or less the whole structure and design in my head, and coding is just a
>matter of writing the mental picture in the language. The temptations is
>to do that but IF the actual concept is flawed or its got lost in
>translation its vile to debug without the comments.
>
>Often I will write the pseudo code as a comment and see if the code
>actually corresponds..

My best commented code happens when I start by writing a complete
outline of the module with each line starting with // and then write
the code between the comments.

Doing that first exposes logic errors since I am thinking of the
overall flow without being bothered by little syntax details. It also
makes writing the code easier since the tasks are all broken down into
manageable and logical pieces. Then when it's done the code is already
commented as if by magic and i don't have to do that drudgery.

Of course, I don't always discipline myself to do it that way, but I
am always glad when I have done so.

Richard Yates
0 new messages