CodeSOD: A Commentary on Military Force

This post was originally published on this site

The Daily WTF

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

To read the full article click on the 'post' link at the top.