You can’t hear DC

Recently one of my team members found a bug in some old code while doing a code review.  Our application was generating a sine wave to be rendered by the audio hardware.  The sample format isn’t important except to note that it is an unsigned value between 0 and MAX = 2*FS_AMP.  The bug is…

4

The Rules of Code Optimization

Steve Rowe recently talks about who you’re really writing for when you write code.  The argument he makes is essentially that your primary audience is not the compiler, but rather your primary audience is other developers.  This is something I believe strongly. Steve also makes a point about premature optimization, and how it affects readability. …

3

My program is the most important thing on your system, same as all the others.

Raymond had a really good post yesterday about programs that grab your attention inappropriately.  I recommend reading it.  The comments have some good examples of programs, mostly updaters, that take too many liberties.  Of course, I completely agree that popping something up in my face completely unrelated to the task I’m performing is among the most annoying…

4

Feature request for the compiler team

I want to preface this by saying that the MS compiler team have worked wonders in improving developer productivity over the years, and can’t be thanked enough for turning the C++ language into an enterprise quality platform that has lasted more than a decade. That said, “C2259: ‘CFoo’ : cannot instantiate abstract class” is probably one…

5

Honesty as a code metric

Of all of the programmers I’ve worked with over the years, I can name three who really stick out as the best.  These people have earned my respect, and I will always listen to their opinions, even when I think they’re completely off their rockers.  I currently have the honor of working with two of…

0

If you assume your users are criminals, they will be.

A friend recently purchased for me a copy of a game, let’s call it “Society III”, that he knew I’d like.  I had been an avid player of Society and Society II, and Amazon was having a $9.95 special.  The game arrived in a standard manufacturer box, with a stamped official-looking CD.  It’s a legit…

7

Interface Design and the Law of Leaky Abstractions

Programmers are always trying to make things simpler, usually by making them more complex.  Interface too complicated?  Need a bit of extra functionality?  Want to work closer to the problem?  Add a layer of abstraction to the code.  As most programmers know, this is, ironically, usually the right solution.  Abstraction is critical to breaking a problem down…

5

The Dancing Bunnies problem and the need for application-level security

Raymond today has a discussion up about the folly of trying to set security with a granularity of per-DLL.  As he explains, the moment you let something untrusted run in your process space, you cannot trust anything in the process.  You cannot wall off a DLL or a section of code from the rest of the…

2