from Hacker News

Static Typing is not enough

by jdeseno on 6/20/12, 10:49 PM with 63 comments

  • by tikhonj on 6/21/12, 12:27 AM

    Yes, static typing is not enough. Which is why a good statically typed language like Haskell also has great testing facilities. So you don't just write well typed code, but you also write unit tests (HUnit) and property-based tests (QuickCheck). The really neat bit is that static typing actually makes writing tests easier--QuickCheck is much easier to use in Haskell than it would be in some dynamically typed language.
  • by nightski on 6/21/12, 4:53 AM

    Doesn't anyone view static typing as done in a language like Haskell as a form of documentation? I am not saying ALL Haskell code can be deciphered by its types - hell no. But a useful technique is to express the semantics of the program into the type system (as much as possible anyways) to communicate intent. This is a huge benefit over dynamic languages imho. So there is more too it than just verification, even if that is extremely nice.
  • by chipsy on 6/20/12, 11:59 PM

    This is as much a usability problem as it is a "getting it right" one. We could eventually "get it right" by plugging in raw machine code through switches or punchcards if that's really what it took, but what we're arguing over is the _price_ of getting it right.

    Static types are implemented and available for use at the language level, which isn't true of all of those features in most environments.

  • by carsongross on 6/20/12, 11:37 PM

    Neither static typing (nor any of the other stuff mentioned) is enough to ensure correctness. Never has been, never will be.

    However, static typing is enough for some sweet, sweet hit-dot-wtf-can-i-do-completion-refactoring-like-a-boss tooling goodness.

  • by ternaryoperator on 6/21/12, 12:01 AM

    Kind of a strawman argument, as no developer would argue that only unit tests and static typing are needed to guarantee quality.
  • by cageface on 6/21/12, 4:56 AM

    Yep, there is no silver bullet.

    But that doesn't mean all bullets are created equal.

  • by modarts on 6/21/12, 12:19 AM

    Yet another attempt to diminish the value of statically typed languages and the benefits that go along with them.
  • by gbog on 6/21/12, 12:23 AM

    In a conference 15 years ago I heard a guy say The problem with software is we don't know what it is. He meant that: we know what is a car or a bridge, we know why and how they do their purpose, not so much with software, which is a strange beast our minds are not ready to grab yet.
  • by qznc on 6/21/12, 7:35 AM

    You need formal machine-checked verification (Coq, Isabelle).

    Unfortunately, this is not enough. You need a consistent and complete specification, too.

  • by cpfohl on 6/21/12, 12:08 PM

    I'm really curious what Love Driven Development would look like. Is it kind of like TDD in that before you write a single line of code you write a sonnet about it?
  • by buster on 6/21/12, 7:57 AM

    Doesn't matter because, what really matters is Think-before-you-code, all that static typing will save noone from bugs.

    Also: <3 Love Driven Development <3

  • by tomp on 6/20/12, 11:55 PM

    Sometimes, I wish I could downvote stories...

    Accidentially, almost everything that the author suggests, except luck and user testing, can be provided by static type systems - e.g. Haskell's type system is Turing-complete, so you can make up any kind of contracts/tests and embed them into the type system...

  • by chj on 6/21/12, 1:42 AM

    Big take away: Love Driven Development Rules Them All.
  • by saraid216 on 6/20/12, 11:59 PM

    LDD ftw.