News for hackers. Stuff that matters.
Re:Why Learning to Code Is So Damn Hard by nsomaru on Wednesday February 04, 2015 @03:14PM (#8999404)
I'd rather know when something is incorrect, rather than pushing to production and finding out later because someone else took that code path.
Re:Why Learning to Code Is So Damn Hard by DougWebb on Wednesday February 04, 2015 @04:34PM (#9000033)
If you rely on your compiler to tell you that your code is correct, there are whole classes of bugs that are waiting to surprise you in production.

I think that many years of developing large applications in Perl were really good for me. Perl is compiled when you run it, so you get the basic-syntax check that you get with other languages. But it's also very lenient, so you learn through experience to get your logic right, test return values, and do all of the things that help make sure that a program which executes is executing correctly.

Re:Why Learning to Code Is So Damn Hard by brianwawok on Wednesday February 04, 2015 @05:08PM (#9000307)
There is a difference from RELY on compile to catch 100% of bugs, vs having an awesome type system that can take whole CLASSES of bugs and make them impossible to get past a compile.

Is a statically typed language more likely than a dynamic language to work correctly in production, if both have 0 tests? Yes.

Is either ideal? No.

Can both be improved by adding a few tests? Yes.

Re:Why Learning to Code Is So Damn Hard by pdonis on Wednesday February 04, 2015 @11:31PM (#9001740)
> Is a statically typed language more likely than a dynamic language to work correctly in production, if both have 0 tests? Yes.

I'm not sure I agree. "Work correctly" does not just mean "compile correctly". I would want to see a lot of evidence to back up any assertion that programs written in statically typed languages are less likely to contain logic errors that compile and run just fine but don't do what the programmer (or his client) actually wanted.

I agree that neither is ideal and that adding testing can improve any code.

Re:Why Learning to Code Is So Damn Hard by dragonwriter on Wednesday February 04, 2015 @11:47PM (#9001787)
> I would want to see a lot of evidence to back up any assertion that programs written in statically typed languages are less likely to contain logic errors that compile and run just fine but don't do what the programmer (or his client) actually wanted.

As certain assertions related to logic can be encoded into static types (especially in a language with a type system more like Haskell's than, say, Go's), while static typing can't eliminate all logic errors, it can reduce the probability of logic errors escaping detection in the absence of testing, since compiling a statically typed program is, in effect, a form of testing (limited to those assertions about behavior which can be encoded into the type system.)

Re:Why Learning to Code Is So Damn Hard by pdonis on Thursday February 05, 2015 @12:33AM (#9001915)
> compiling a statically typed program is, in effect, a form of testing (limited to those assertions about behavior which can be encoded into the type system.)

Fair point. (Especially if, as you say, you are using a language with a type system like Haskell's, which to me is more like a program analysis engine than just a type system.)

Re:Why Learning to Code Is So Damn Hard by DougWebb on Wednesday February 04, 2015 @05:28PM (#9000439)
I agree with you on all points, but the parent sounded like he was relying on the compile-time checks to determine correctness. I was making the point that that is a bad idea.