User: Password:
|
|
Subscribe / Log in / New account

How to ruin Linus's vacation

How to ruin Linus's vacation

Posted Jul 19, 2011 22:33 UTC (Tue) by neilbrown (subscriber, #359)
In reply to: How to ruin Linus's vacation by dgm
Parent article: How to ruin Linus's vacation

Yes, it is a great quote. But experience shows that it is wrong ... so where is the flaw?

I think the reality is that writing really clever code actually makes you smarter - by solving a difficult problem you can learn something useful. So having written (or just read and understood) really clever code, you become smart enough to at least make an attempt at debugging it.

Maybe.


(Log in to post comments)

How to ruin Linus's vacation

Posted Jul 19, 2011 22:55 UTC (Tue) by dgm (subscriber, #49227) [Link]

Maybe. But when you find yourself hunting that bug that makes no sense, you should question if you were as clever as you thought when writing the code.

How to ruin Linus's vacation

Posted Jul 20, 2011 0:26 UTC (Wed) by neilbrown (subscriber, #359) [Link]

I have a lot of experience hunting bugs that make no sense, sometimes in my own code and sometimes in other people's. I usually find it harder to find those bugs in my own code, and it certainly isn't because my code is particularly "clever".

The common pattern that I find in "bugs that make no sense" is that I am believing something that isn't true. Once I identify and challenge that belief, the bug becomes obvious. The reason that these bugs are harder to find in my own code is because I believe my code is correct (in general, and in lots of specifics), so I don't question it so closely. When I'm reading other people's code I have less belief that it is correct, so less hindrance to finding the bugs.

Put another way: finding a bug in my code is both a success and an admission of failure. Finding a bug in someone else's code is pure success. This sounds like a strong case for pair-programming!

How to ruin Linus's vacation

Posted Jul 20, 2011 2:25 UTC (Wed) by elanthis (guest, #6227) [Link]

This is the same reason why authors of prose have editors. Your internalized assumptions make it so your eyes can pass right over "obviously" bad constructs and not notice.

It's also why "check your assumptions" is the first rule of debugging I teach to new coders. :)

How to ruin Linus's vacation

Posted Jul 20, 2011 2:44 UTC (Wed) by jzbiciak (subscriber, #5246) [Link]

Indeed.

This is also why I find debugging with print and assert statements to be much more helpful than single stepping, in the vast majority of cases. Single stepping was more useful to me when I didn't necessarily understand all the language constructs. That was 20-25 years ago, though.

Nowadays, if I have some weird bug, it's because something I think is true is not, or some other "invisible-to-me" error. A judiciously placed print statement (perhaps guarded by an 'if' to filter out the noise) makes it easy for me to prove or disprove my assumptions about what's happening in the code, though, without disrupting any of the code around it. I can compare working cases to non-working cases easily and in a batch-wise manner after the fact. Very useful.

How to ruin Linus's vacation

Posted Jul 21, 2011 19:19 UTC (Thu) by nas (subscriber, #17) [Link]

This is way the "Rubber Duckie Test" is effective.

How to ruin Linus's vacation

Posted Jul 22, 2011 19:58 UTC (Fri) by smurf (subscriber, #17840) [Link]

IMHO you mean "This is *why …".

Please enlighten us what this test means; not everybody is damiliar with the idiom.

How to ruin Linus's vacation

Posted Jul 23, 2011 9:45 UTC (Sat) by smurf (subscriber, #17840) [Link]

*familiar. *grumble*

How to ruin Linus's vacation

Posted Jul 23, 2011 21:38 UTC (Sat) by neilbrown (subscriber, #359) [Link]

I hadn't heard of it either .. but search engines are our friends.

http://lmgtfy.com/?q=Rubber+Duckie+Test

Pick the wikipedia link on Rubber Duck Debugging.

How to ruin Linus's vacation

Posted Jul 25, 2011 18:08 UTC (Mon) by Lennie (guest, #49641) [Link]

I just knew the "janitor effect".

I presume the name comes from working late because you can not figure out a problem. Then the janitor comes and he can sees you are kind of frustrated and asks what the problem is.

You try to explain it to the janitor in simple terms and then you understand your problem and can fix it.

Then you go home happy I guess.

The ducky is just a way to try and induce that state of mind with an inanimate object where you are trying to explain the problem to someone else in simple terms.

How to ruin Linus's vacation

Posted Jul 21, 2011 8:34 UTC (Thu) by dgm (subscriber, #49227) [Link]

I have another quote for you:

"Oh Lord it's hard to be humble
when you're perfect in every way.
I can't wait to look in the mirror
cause I get better looking each day.
To know me is to love me
I must be a hell of a man.
Oh Lord it's hard to be humble
but I'm doing the best that I can."

-- Mac Davis

;-)


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds