Live data from Hacker News

Rob Pike: The Best Programming Advice I Ever Got.

informit.com

11–20 of 142 posts

Re: Rob Pike: The Best Programming Advice I Ever Got.

#11
post #8

You are only so smart. Once the complexity of the programming model reaches a certain point a debugger is necessary to validate and discover the true nature of a system. Often that point is quite low.

This might be an argument for not going overboard with complexity in the first place, which is probably a view Pike and Thompson would subscribe to.

Re: Rob Pike: The Best Programming Advice I Ever Got.

#12
This is my method of debugging. I tend to think through code for a long time away from a keyboard before writing it, trying to understand corner cases, implications, and so on -- developing a mental model. Well, I wouldn't do this for everything, more for core aspects of a complex/somewhat-complex system.

Re: Rob Pike: The Best Programming Advice I Ever Got.

#13
post #8

You are only so smart. Once the complexity of the programming model reaches a certain point a debugger is necessary to validate and discover the true nature of a system. Often that point is quite low.

I disagree, you'd be surprised how many people have the mental model of various large code bases (think Linux kernel) in their minds. It's not as if you are some savant memorizing all the lines of code and it helps to differentiate between "complexity" and "a mess." :)

Re: Rob Pike: The Best Programming Advice I Ever Got.

#14
post #3

I think if you are just pushing through (brute force) to fix a bug "without thinking" then you will never figure it out. Also, "thinking before" as the article claims, without actually looking at the code or stack traces, that's just mental brute force. Pretty much it's a combination of both: you look at the code, you think about what's happening and what could go wrong, you look at the code again, you think some mor…

Actually, I think it's a bit more subtle than that. By using stack traces and debuggers etc, I can come up with a working and correct solution. But, by thinking through the problem at a deeper level I can come up with an improved design which may simplify future programming and avoid similar bugs.

Re: Rob Pike: The Best Programming Advice I Ever Got.

#15
post #8

You are only so smart. Once the complexity of the programming model reaches a certain point a debugger is necessary to validate and discover the true nature of a system. Often that point is quite low.

Not to mention a debugger to try to understand the "outside world", libraries, hardware, most of it with bugs that may affect you.

Re: Rob Pike: The Best Programming Advice I Ever Got.

#16
I think this might be an advantage of pair programming that isn't generally talked about.

The time to find a bug with a debugger has a much tighter distribution than the time to find one by thinking about the code. There are some problems that you just can't get to the bottom of by thinking.

By having one person take each path, you get the advantages of both. It might seem that a single programmer should be able to achieve the same by switching between the two approaches, but the cost of context switching is so great that it will be more like starting again each time. So it's really hard to know when to stop thinking about it and to get the debugger out.

The advice that once you find the bug you should work out what the problem really is definitely holds solid, though.

Re: Rob Pike: The Best Programming Advice I Ever Got.

#17
post #7
post #2

Ken Thompson said that never happpend; they didn't need to look at each others code, because they were all "pretty god coders": http://www.informationweek.com/software/operating-systems/qa...

Your link is discussing the development of Unix, which was before Rob Pike came on the scene. Rob Pike is discussing an incident that happened a number of years later when Rob would have been significantly junior to Ken. There is no reason that both versions of history can't be true.

On top of that, things would have grown in complexity since the early days.

Re: Rob Pike: The Best Programming Advice I Ever Got.

#18
post #14
post #3

I think if you are just pushing through (brute force) to fix a bug "without thinking" then you will never figure it out. Also, "thinking before" as the article claims, without actually looking at the code or stack traces, that's just mental brute force. Pretty much it's a combination of both: you look at the code, you think about what's happening and what could go wrong, you look at the code again, you think some mor…

Actually, I think it's a bit more subtle than that. By using stack traces and debuggers etc, I can come up with a working and correct solution. But, by thinking through the problem at a deeper level I can come up with an improved design which may simplify future programming and avoid similar bugs.

But one must also be careful not to fall into the trap of premature optimizations and building unnecessary complexity.

Re: Rob Pike: The Best Programming Advice I Ever Got.

#20
post #8

You are only so smart. Once the complexity of the programming model reaches a certain point a debugger is necessary to validate and discover the true nature of a system. Often that point is quite low.

I just want to point out that Rob designed much of the logging infrastructure at Google. Take from that what you will.
Post reply on HN