Live data from Hacker News

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

news.ycombinator.com

41–50 of 77 posts

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

#41
It seems a lot of people here are talking about debugging in the context of automated tests and manually stepping through debugger loops.

For me debugging usually means "figuring out why we had an outage." This means looking at: 1) application logs, 2) server metrics, and 3) source code associated with the failed applications.

I recently had to ssh and run ngrep on 8(!) servers to see how groups of messages passed around and then look at timestamps to correlate what happened. It was very tedious. This could have been saved by better debug logging; we could have switched that on for 2 minutes, run the tests, and and the looked at everything in Logstash.

When this happens, I end up spending a ton of time tracking down errors. On a bad week, this can be half my time.

So to me, debugging is as much thinking about how you'll have to solve errors in the future and planning for it as it is writing unit tests and tweaking code.

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

#42
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. But then comes the part where I really struggle DEBUGGING. Rest of my time go in debugging stuff,

But I am not sure how can I improve myself. I am not sure whether anyone faced this but I feel like the starters really feel the same way.

All fun lies in debugging I sometime love it. I find funny bugs in my code. But it is so time consuming and I really want to reduce that. Not sure how. Any help will be thankful.

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

#43
Definitely not debugging.

I am working on an existing distributed system with many moving pieces, which is rather prone to outages. This is fintech, so outages mean a lot of money for a lot of people. So my job involves overhauling the existing system, as I upgrade bits of the system slowly: A full rewrite at once would be madness, but I suspect nothing in the current system will remain in two years.

The biggest time sinks are stress testing any of the newer pieces that I try to bring in, followed by incident remediation. There's an incident that requires a human hand to fix it every couple of weeks or so, and I end up spending about three days each time writing better error handling code, adding observability and alerts, and if something is really recurring, writing automation to make the problem fix itself.

This is a fact of life in any distributed system that was written fast: People are start happy because it works most of the time, but as you want the 4th and 5th nine, you need people hardening the system. This is something that is very hard to do as you build anyway: While unit tests are good, there are entire layers of behavior nobody will be able to spec properly by looking one piece at a time, so stress testing, gamedays and such are the only ways to make sure not that the system works to a spec, but that we can even come up with a spec that behaves the way we want in practice.

There's value in evaluating scenarios in your head, but I've also seen what happens when mathematicians use that as their only weapon in a distributed system: Months are spent making sure the system is correct, but then lots of effort is spent on scenarios that are more theoretical than practical, and other scenarios are ignored, even though they occur a lot in practice.

In this respect, it's not very different from entrepreneurship: Getting an MVP out the door and doing things by hand instead of using automation is going to beat spending a lot of time making a product without having any idea of what the market really wants.

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

#44
Of all the answers here that provide stats, I wonder what percentage of those have actually measured the time versus just giving numbers that 'feel about right'. If there is one thing I've learned about stats it is that 96.60% of people's gut feel is usually wrong ;-)

That said, about the question asked. I can attest to the fact that in general thinking and writing good tests greatly reduces time spent debugging. Also, adding judicious and useful logging for the critical / edge cases helps a whole lot.

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

#46
post #34
post #17

I'm not sure there's much than can be concluded by someone's ratio. I definitely wouldn't assume that someone who spent more time debugging was a "worse" programmer. There are certainly practices that reduce the amount of debugging, but it's all relative. Personally, the question for me is nearer something like; > When is the right time to let go of my current approach?

> I definitely wouldn't assume that someone who spent more time debugging was a "worse" programmer I believe that more time spent debugging, the worse the code you're debugging is. Now if you're spending most of your time debugging your own code, then likely you're a novice who hasn't learned the many ways to write quality code that "just works". If, on the other hand, you inherited a codebase from someone who did no…

I find myself doing the exact opposite. The time I get paid for is mostly spent fixing bugs in a codebase of variable quality that I've inherited. The hobby projects I get up to are entirely my own code and thus I get to spend the majority of that time implementing new features.

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

#50
post #30

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

Same here. I often spend time wondering if it's simply that this field isn't for me, 40hrs a week kills my drive, or if it's a bigger issue like depression.

Only thing I enjoy now are exercise and music.

Post reply on HN