Live data from Hacker News

You should write "without bugs"

korshakov.com

1–10 of 91 posts

Re: You should write "without bugs"

#6
The best way to write without bugs is to measure bugs, and react to them.

Airbrake, Rollbar, Datadog, New Relic mean nothing if you ignore bugs because you don't take the time to replicate them.

You also can't fix what you don't know, so you need some telemetry or reporting of not your happy path. You can't have a goal of bug free code if you don't measure bugs (that's not SMART goal because it's not measurable).

Unit Tests, Typing, Linting, a collaborative code review process are key to big free code.

Re: You should write "without bugs"

#7

> My “trick” during that final year was simple: I always tried to write correctly, not just when I was asked to, but all the time. After a year of subconscious improvements, I aced the exam. Practice makes permanent. Perfect practice makes perfect.

I'm trying this with learning piano, and I see the advice in a good number of places-- if I make a mistake in a phrase, I repeat the phrase 5-7 times correctly, instead of pushing through. It's been working out well so far-- I'm not 'burning in' my mistakes.

Re: You should write "without bugs"

#8
Most bugs that make it to production are either unknown corner cases affecting a miniscule proportion of users, or misunderstood/missed requirements. The first one is particularly great, because it usually devolves to "If you run this OS version, with this app installed, and you changed this particular setting that most users never touch, the three conspire and brick your machine under certain circumstances". (True story. Got a news write-up, too)

You can write code without bugs all you want, you won't sidestep those two.

I mean, yes, of course. Don't write obvious garbage code. Don't take obvious shortcuts. Value your craft.

But you'll still have bugs. (So did Telegram, btw: https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=telegram)

Re: You should write "without bugs"

#9
I don't think anyone says you should just casually ship bugs. Quite the contrary, most are ok with the idea that, if you see a bug, fix the bug. But, there can be no doubt that there is diminishing returns on chasing down every potential bug.

This reads to me like the idea that a rich person walking down the road wouldn't pick up a $20 they happen to see at their feet. Of course they will. Why not?

What they don't do, is waste time walking around looking for spare money that has been dropped. Because that would almost certainly be a waste of time.

Similarly, use your tools to write as efficient and bug free code as you can. Make it as flexible and allow for any future changes you can accommodate along the way. But "along the way" should be "along the way of delivering things in a timely manner." If you stray from that, course correct.

Re: You should write "without bugs"

#10
That was a nice read, and I'll try to incorporate it in the future.

Lately I've been victim of letting too much pressure from clients build and I ended up spending 5 days on a major feature (built on legacy messy code) and in the process of making it better and adding a new features I ended up breaking few things here and there, which didn't play nicely with my refactor. Which costed me another few days of work.

I guess I should've had an approach closer to what he describes, written few tests more before hand and taken more time to nail it without the delay.

I learned from that experience, but the mindset he talks about would've been more beneficial.

Post reply on HN