TDD & type checking
2014-07-28 20:09:52.266346+00 by Dan Lyke 8 comments
TDD replaces a type checker in a dynamically typed language in the same way that a bottle of whisky replaces your daily problems
2014-07-28 20:09:52.266346+00 by Dan Lyke 8 comments
TDD replaces a type checker in a dynamically typed language in the same way that a bottle of whisky replaces your daily problems
comments in ascending chronological order (reverse):
#Comment Re: made: 2014-07-28 20:57:07.224687+00 by: spc476
Thank god I'm not the only one that thinks that.
#Comment Re: made: 2014-07-28 21:53:26.820345+00 by: Dan Lyke
Yeah, the more I work in untyped languages, the more I'm wondering why we've gone the other way from Eiffel and coding by contract and similar things. Although not Modula-3, that went too far...
Or maybe I was just young and inexperienced when I complained about its strictness of typing.
#Comment Re: made: 2014-07-28 23:40:35.753127+00 by: meuon
I find myself writing more tests than I used to, but more in terms of sanity checking the business logic and making sure it is really doing what I think it is doing. In many cases, the "test" isn't practical except on very specific data conditions which makes it only useful while working on that problem. Using it to test the variable types gets weirder.
It is important to "fuzz" all available inputs like a user or hacker might, and make sure things are what they should be. See way to many "de-tainting" that walks through the inputs in a loop and guesses if it should be a number or text or....
#Comment Re: made: 2014-07-29 01:29:48.605876+00 by: dexev
is there a language out there that can give me static typing without me needing to explicitly type &every_single_instance* of it?
If the code to fuzz my inputs in tests is easiser than to make the compiler's job easier, why choose the latter?
#Comment Re: made: 2014-07-29 05:11:41.658056+00 by: Dan Lyke [edit history]
I'm liking C++'s "auto" type: be the appropriate type for the rvalue. This with operator overloading clears up all sorts of iterator and numeric operation code...
#Comment Re: made: 2014-07-30 04:38:56.47082+00 by: dexev
I gave up on C++ sometime last century, but it's starting to sound that -- like javascript -- there are some 'good parts' that are worth knowing.
#Comment Re: made: 2014-07-30 15:13:41.821699+00 by: markd
(Apple)Swift has static typing along with type inference which reduces the muffin man effect of Objective- C. (https://twitter.com/jjustice/status/244038956449140736), along with tooling support so you can see the inferred types in the editor. A colleague calls it a language rage-created by disgruntled C++ programmers.
Unfortunately the language is still undergoing enough mutation to make writing anything real with it impractical, and to get the tool support you have to use Xcode. ugh.
#Comment Re: made: 2014-07-30 15:55:53.158289+00 by: Dan Lyke
Yeah, there are parts of C++ that can increase cognitive load, but... all languages can be abused, and with lambdas/closure-ish structures, auto
typing and a few other C++11 things there's really no other performance oriented cross-platform language.
And the stuff happening with Emscripten and Asm.js, C++ for code organization, JavaScript as a VM when you need it is a totally reasonable development path.