CodeSOD: A Commentary on Military Force

Once upon a time, Simon worked for a company making software for missile systems. This was serious work, with serious testing procedures, and important standards around documentation.

Shortly before a live-fire test of a missile system, Simon knew better than to make any code changes, but he did want to improve the documentation. Adding comments was pretty low risk, so he went ahead and did that. By the time he was done, the Turbo Pascal code that controlled the missile looked like this:

{ add demands for pitch, yaw and roll, y x and z for this duty cycle } phidem := phidem + phidemc; psidem := psidem + psidemc; rdem := rdem + rdemc / 2; { NOTE: ROLL THRUSTERS MORE EFFICIENT THAN EXPECTED, CUT IT IN HALF zcdem := zcdem + zdemt[q]; { Add gravity over predicted velocity, from the table } ycdem := ycdem + ydemc; xcdem := xcdem + xdemc;

Specifically, it was the "magic number" of 2 that Simon wanted to explain. There was just one problem: he didn't terminate his comment. So the comment continued until the next }.

When the missile launched, it erupted from the tube, and then traced a perfect parabola into the dirt five meters in front of the launch tube.

It's unclear which was louder: the "thunk" sound of the missile striking the ground or Simon shouting an expletive when he realized his mistake.

[Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.

This post originally appeared on The Daily WTF.

Leave a Reply

Your email address will not be published. Required fields are marked *