Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Whereupon you can put tracing in to find out when the state was screwed up.

Singletons aren't bad, they're just misused a lot by bad programmers. It's like saying "Food is bad," and sure, people misuse food and hurt themselves, but that doesn't mean we should ban food.



It's more like saying "poison is bad", and losing the benefits of bleaching the bathtub, just because people keep killing their kids with it by accident.


Except it's nothing like saying "food is bad". If you don't ever eat food, you die. If you don't ever use singletons, some of your code has an additional parameter uglily threaded through it.


> Whereupon you can put tracing in to find out when the state was screwed up.

And then the problem magically disappears, but only when you trace it.


Tracing can be very lightweight. Not utterly non-instrusive, but pretty close. As a kernel / games dev, I'm quite aware of timing issues.

You get into serious trouble with "lock free" stuff, where pretty much any additional activity (even register operations) will perturb things and make bugs go away. Hopefully at this point you have help from the hardware. Then again, if you're doing LF, you're in a special place and probably have the chops to deal with it...





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: