News for hackers. Stuff that matters.
Re:Those Who Say Code Does Not Matter by darrencauthon on Wednesday April 16, 2014 @01:03PM (#7598989)
His code example is:

if (error_of_fifth_kind)

    goto fail;

     goto fail;  
if (error_of_sixth_kind)

    goto fail;
The_truly_important_code_handling_non_erroneous_case

My question: If the "truly important code" is really that important, where are the unit tests to verify that it "handles" the "non erroneous case????"

Test. Your. Code.

Re:Those Who Say Code Does Not Matter by mikestew on Wednesday April 16, 2014 @03:42PM (#7600065)
Because Apple doesn't have a software testing culture. At least that's what I've been told by Apple engineers I know who used to work at Microsoft ("software testing is not the same respected discipline you're used to at Microsoft"), as well as when I interviewed with Apple and asked what kind of test team would be backing the product I would be working on (manual testing with no SDETs, apparently).

Take it as the quite anecdotal evidence it is, but to me it explains a lot.

Re:Those Who Say Code Does Not Matter by loumf on Wednesday April 16, 2014 @01:06PM (#7599013)
I agree that it's totally shocking that Apple did not have an example of each kind of bad cert. Even a rudimentary unit test of this code would have caught this bug. I bet they do now.
Re:Those Who Say Code Does Not Matter by leephillips on Wednesday April 16, 2014 @02:55PM (#7599753)
But rudimentary testing of critical code is not part of Apple's corporate culture. They have released versions of the Finder with amateurish bugs that delete files[1] and versions of Mail that randomly delete messages[2]. Several versions of Mail on iPhone, a couple of iOS versions ago, send hundreds of copies of a message when emailing a link from Safari[3]. They've chosen to hoard over a hundred billion dollars in cash rather than hiring more competent engineers and enforcing quality control.

The blame for these fiascos, and for the goto fail bug, getting out the door lies not with the programmers, who can not avoid making mistakes, but the with the CEO and other management, who decide how to allocate resources.

[1]http://tomkarpik.com/articles/massive-data-loss-bug-in-leopa.... [2]http://discussions.apple.com/thread.jspa?messageID=12758081&.... [3]http://lee-phillips.org/iphoneUpgradeWarning-4-2-1/

Re:Those Who Say Code Does Not Matter by loumf on Wednesday April 16, 2014 @06:05PM (#7600823)
The thing that kills me is that rudimentary unit testing of simple functions like this makes development faster. You have to run the code, right? It's easier to run it in a unit test than to set up an environment to run the result.

My pet peeve is code that is so broken that it has obviously never even been run.

Re:Those Who Say Code Does Not Matter by dragonwriter on Wednesday April 16, 2014 @06:56PM (#7601036)
> My pet peeve is code that is so broken that it has obviously never even been run.

Yeah...in my first support job I had to deal with a customer call that traced back to a install script for our company's (quite pricey, enterprise back-end) software dying with a syntax error.

Re:Those Who Say Code Does Not Matter by sparkie on Wednesday April 16, 2014 @01:30PM (#7599170)
Also: just because you can omit braces, doesn't mean you should. Stick to 1TBS and this kind of mistake shouldn't happen.
Re:Those Who Say Code Does Not Matter by Jtsummers on Wednesday April 16, 2014 @02:16PM (#7599479)
1TBS = One True Brace Style, had to look up that abbreviation [1]. Puts the `{` on the line with the `if`, `for`, `while` text and the `}` on its own line, and requires the braces even for one line blocks. (I knew the rest, just hadn't seen "1TBS" before.)

[1] http://en.wikipedia.org/wiki/Indent_style#Variant:_1TBS

Re:Those Who Say Code Does Not Matter by usefulcat on Wednesday April 16, 2014 @01:59PM (#7599351)
Agreed, but the author's point (indirectly, perhaps) is that requiring braces is an example of something that should be part of the language, and the fact that it's not should be considered a defect of the language.
Re:Those Who Say Code Does Not Matter by darrencauthon on Wednesday April 16, 2014 @02:00PM (#7599362)
This mistake shouldn't happen?

Mistakes always happen. Even if I dedicated myself to using braces everywhere, my mistake might be that a) I put the braces in the wrong place, or b) I forgot to put the braces.

Re:Those Who Say Code Does Not Matter by Jtsummers on Wednesday April 16, 2014 @02:18PM (#7599491)
Shouldn't != couldn't. In Haskell and the MLs, for instance, certain classes of mistakes shouldn't happen because of the type system and pattern matching, but a single wildcard could throw that off.