Live data from Hacker News

Ask HN: Do you spend more time coding or debugging?

news.ycombinator.com

61–70 of 77 posts

Re: Ask HN: Do you spend more time coding or debugging?

#61

debugging. because coding is the easiest part. when I am asked to build any feature. I take some time thinking on what and how should I do (around 10%-20% of my time). Once I feel like I have a good idea I continue to code (But sometime when I start to code I spend more time on thinking on designing code, like best practises etc.) so I think like 30%-40% of my time go to coding and thinking about best code practises.…

Like other commenters have noted, the more experience you get and the more you learn to improve the design of your code right off the bat, the less debugging you should have to do. Hopefully then the coding part becomes just as fun as the debugging currently is for you -- a lot of satisfaction can come from coding something really well and having it work just as you expected the first time.

Re: Ask HN: Do you spend more time coding or debugging?

#63
post #4

I used to spend the vast amount of my time debugging. Fast forward a few years - Experience, good programming habits, and the gratuitous use of assertions. Now I spend a negligible amount of time debugging, and it never ceases to amaze me how frequently things just work the first time. Edit: I guess I want to say that there is one, and only one, bottom line: the relentless, ruthless pursuit of quality . It takes time…

I remember the first time I wrote an entire controller and everything worked exactly like it did in my head. There was a lot of whooping and dancing to be had.

Not that it happens much.

Re: Ask HN: Do you spend more time coding or debugging?

#65
post #51
post #4

I used to spend the vast amount of my time debugging. Fast forward a few years - Experience, good programming habits, and the gratuitous use of assertions. Now I spend a negligible amount of time debugging, and it never ceases to amaze me how frequently things just work the first time. Edit: I guess I want to say that there is one, and only one, bottom line: the relentless, ruthless pursuit of quality . It takes time…

Agreed, but with the addition of some periodic, many hour, something-completely-unanticipated-happened-and-I-am-so-perplexed debugging sessions.

This but let's also define debugging. From reading some of the comments left throughout the thread it seems like people don't think that a test failing and you having to go back and fix code (or even the test) is debugging but IMO it is. There is a bug, you are going back, finding it and fixing it. It usually means it is easier and faster to find/fix, but it is still time spent "debugging".

I spend more time creating then debugging when I write the code from scratch, but I still say I spend probably at most 70% coding if it is a new project. The rest is in failing tests and finding those weird screwed up errors that take multiple days of a debugging session to find. For existing code I take over, it is probably usually more like a max of 50-60% coding depending on the original authors skill.

Re: Ask HN: Do you spend more time coding or debugging?

#66
Well, it's a fairly even split of both. But a lot of time is spent fixing projects that started as something really simple and immediately ballooned into some sort of bloated megaproject that ended up with no cohesive plan in regards to how anything would be tested.

Bonus points if the project started as one thing and pivoted to something completely different midway through development, and about 50% of the code is completely unused.

Re: Ask HN: Do you spend more time coding or debugging?

#67
post #62
post #30

Neither. I spend most of my time procrastinating and/or day dreaming.

On the other hand I bet your .bashrc and .emacs are amazing

> On the other hand I bet your .bashrc and .emacs are amazing

Nope, but my .vimrc is a work of art.

Re: Ask HN: Do you spend more time coding or debugging?

#68
Lately, it's mostly debugging. I rarely find debugging difficult (tedious at worst), and I like fixing real problems (vs building a new feature or component I don't see the reason behind) so that suits me just fine.

Honestly, I'm probably better at it than building new features anyway.

Re: Ask HN: Do you spend more time coding or debugging?

#69
Debugging.

I've sunk a lot of time into trying to change this. Among other changes, I've:

- Improved crash dump collection, to spend less time reproducing bugs and be more thorough in addressing them.

- Improved code debuggability - for example, writing scripts to inject call stack information into actionscript and java via disassembly, which I can then display on assert, especially on platforms where I have unreliable or incomplete debuggers.

- Learn and use defensive coding techniques to make bugs fewer in number, shallow, and caught more quickly and with more context.

- Write thorough tests to catch said bugs before I even run my main application, and more edge cases to input

- Learned more tools to catch bugs I might not even know exist - valgrind, address sanitizer, static analyzers, fuzz testers, ...

I spend much less time debugging my own code now. If I'm lucky, I'll work on projects where I don't have to debug my coworker's code all that much either. That still leaves debugging 3rd party libraries and tools - which I may lack the source to entirely - that I suddenly have more free time to really properly investigate and get to the root cause of.

Post reply on HN