CowboyRobot writes: "Last week, a bug in high-frequency trading software from Knight Capital Group resulted in erroneous trades totalling almost a half-billion dollars.So what went wrong and how can they, or any other software developer, prevent something similar from happening again?In hindsight, it's clear that the developers did not verify the code under enough conditions.But the real issue is how these high-frequency trades work in the first place.Robert Dewar at Dr. Dobb's suggests the financial industry needs to take a page from the avionics rulebook, which has very strict guidelines about what code can be implemented due to the high cost of failure in that field."High-frequency automated trading is not avionics flight control, but the aviation industry has demonstrated that safe, reliable real-time software is possible, practical, and necessary. It requires appropriate development technology and processes as well as a culture that thinks in terms of safety (or reliability) first. That is the real lesson to be learned from last week's incident. It doesn't come for free, but it certainly costs less than $440M.""