Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> "If I don't typically make a kind of mistake (like setting the wrong variables in a constructor), I don't test for it."

Hmm, that sounds like the old "You don't need to test , just be an awesome programmer duh!" argument.

The kind of mistakes you never anticipate making are probably the sort of stuff you should be testing for.

The amount of times I've had something fail on an edge case that turned out to be a typo in a var name on some edge case somewhere..



don't know why this has so many downvotes.


Your tests routinely fail because of typos?


I've seen production code fail because of typos after months in deployment (because that's how long it took that else { branch to be hit in practice).

The code in question was only subject to very high level smoke tests that looked like they were basically cherry picked best case scenarios intended to pass.

A unit test would have picked this up before it even got to production.


In dynamic languages? Sure they may. The PHP script you thought works crashes, the Lisp routine out of the sudden enters the debugger, things like that.


The question isn't what "may" happen, but what routinely does happen for you.

If typos are even a significant problem in your code then the solution is to type more slowly, have your IDE flag unknown symbols, use autocomplete, etc. As a solution to this problem, strong typing is both disproportionate and inadequate.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: