Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Avoiding silly programming mistakes

by NateTut (Deacon)
on Aug 20, 2008 at 18:15 UTC ( #705577=note: print w/replies, xml ) Need Help??

in reply to Avoiding silly programming mistakes

'Assembly of Japanese bicycle requires great peace of mind.' - Robert M. Pirsig from "Zen and The Art of Motorcycle Maintenance" Your state of mind is the biggest factor in your coding. Don't assume, check. Also don't worry so much about the mistakes that cost you 10 seconds to figure out and fix worry more about the design mistakes that can cost weeks, months or years.

Replies are listed 'Best First'.
Re^2: Avoiding silly programming mistakes
by missingthepoint (Friar) on Aug 21, 2008 at 11:07 UTC
    Your state of mind is the biggest factor in your coding.

    The second point also sounds wise, but that first statement resonates very strongly with me. Allow me to share an anecdote...

    One evening, back when I was learning C, I'd spent a hour or two reading Snow Crash by Neal Stephenson. Perhaps this primed my mind in some way for what followed. :)

    I sat down and began coding... but my 'state of mind' was singular. I don't think I've ever been that focused. I began writing a routine to convert strings containing numbers in arbitrary bases to their numeric values... in Perl terms, this was a super oct().

    I spent perhaps two hours total. My mind seemed very clear, and I thought through the problem in depth... I probably spent 20 minutes doing nothing but thinking between brief periods of typing. At the end - I hadn't yet heard of TDD, you see :) - I ran my code and started testing it. It worked the first time. Perfectly. Everything happened exactly as I expected. I made no changes to the code after that, because there were no more to make. My memory's a bit fuzzy, but I think I also had a routine to do the reverse operation, and that worked perfectly too. I was shocked.

    I know I've improved since then and today I could probably find an edge case or two to break that code. But at the time, it was an amazing, almost transcendent experience. I couldn't believe I'd produced what I had.

    So I concur - it's the biggest factor. This begs the question... What techniques do the monks have for 'focusing'? How do you enter 'deep hack mode'? Perhaps I should start a new thread. :)

    email: perl -e 'print scalar reverse map { chr( ord($_)-1 ) } split //, "ufo/hojsfufqAofc";'

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://705577]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2018-05-24 12:33 GMT
Find Nodes?
    Voting Booth?