Bernhard FindeissTuesday February 25th, 2014
(Deutsch) Clean Code: Wie der Apple SSL-Bug mit einfachen Mitteln zu verhindern gewesen wäre
5 Kommentare zu “(Deutsch) Clean Code: Wie der Apple SSL-Bug mit einfachen Mitteln zu verhindern gewesen wäre”
Kommentar verfassen




Sieht nach einem Flüchtigkeitsfehler aus (versehentlich zweimal “einfügen”) gedrückt. Kommt davon, wenn man schneller schreibt (programmiert) als denkt. Kenne ich gut, gerade in “c”.
Dear Bernhard, rather than depend on good programming style, I would advise testing!
For an important program like this, every version should go through an automatic “regression” test. Such testing facilities should be designed into the system from the start. The total complexity of the test material should rival the program itself, since it should include practically all facilities and options. It must be maintained in parallel with the program itself, especially when the hooks used to automate it change.
Good programmers should produce these tests, (although runtime speed is less important).
Zum Thema “beim Standard bleiben”:
Dummerweise sind if-statements ohne geschweifte Klammern ja eben Teil des C-Standards. Wenn man es im Standard unterbinden würde, könnte man sanity checks ifür alten Code immer noch durch ein Compiler Flag oder Einführung eines #THIS_FILE_IS_STUPID pragmas abschalten 😉
— Andreas
On second thought, there is a serious bug elsewhere in this program. How can a superfluous “goto fail” produce such nasty results? It is wrong to carry on blithely, or try to correct things in a “fail” case. (“Correcting” things usually destroys diagnostic data and often makes things worse). The programmer either did not understand English, or had a strange sense of humour.
It is a pity that good experienced programmers get pushed into management or retirement. (Concerning “goto”, I agree with Knuth).
Hello Chris,
“rather than depend on good programming style, I would advise testing!”
This was also my first thougt – and it cannot be stressed enough !