5 ms·
Please tell me, do you write tests? I've learned that it's necessary. I do 100% code coverage and I'm enjoying TDD a lot.
by blumomo 9y ago
Please tell me, do you write tests? I've learned that it's necessary. I do 100% code coverage and I'm enjoying TDD a lot.
- virmundi 9y agoThe whole point of static type systems is that they give you the "type tests". 100% code coverage just to get what the compiler would give you is a waste of time. If python is supposed make developers more productive, this is just dragging them down.
- adwn 9y agoTime/cost to locate and fix a bug: at compile time < in unit test < in integration test < in production. Besides, tests cannot find all the bugs a good static type system can find, and vice versa. Tests, even at 100% coverage, are not a complete substitute.
- vog 9y agoIf you haven't already tried, I recommend to port [1] a Python program to OCaml, F# or Haskell. There are so many tests you can throw away, so many corner cases you don't need to test anymore. (I'm talking about tests that you can't even write down without getting a compiler error.) Not to mention the assertions within your functions that aren't needed anymore. And those little type annotations are so much simpler and easier to write down than corresponding tests. If you really head for 100% testing, not just code coverage, but also all corner cases, you will love the modern static type systems. (However, you should really use an ML type system, because doing the same with Java or C++ is cumbersome and not much fun.) [1] I did so for my mathematics diploma thesis, starting implementing my formalism in Python, having lots of trouble when refactoring, then moving all code to OCaml and then being able to refactor the code alongside the developing formalism in the thesis.
- VT_Drew 9y ago>I'm enjoying TDD a lot Meh, test are great in so far as they can help you not break things if you upgrade the framework, or langauge in the future. But other than that I have to agree with Kent Beck's sentiment of "I get paid for code that works, not for tests". https://istacee.wordpress.com/2013/09/18/kent-beck-i-get-paid-for-code-that-works-not-for-tests/ https://istacee.wordpress.com/2013/09/18/kent-beck-i-get-pai... If I had started out trying to learn Django using TDD as in this tutorial: http://chimera.labs.oreilly.com/books/1234000000754/index.html http://chimera.labs.oreilly.com/books/1234000000754/index.ht... I never would have learned Django. I would have given up with the ridiculous slow progress of results and functionality.
- jsd1982 9y ago100% coverage is meaningless with respect to correctness and the ability to prove facts about your code. 100% coverage only means that you've been able to exercise all relevant lines of code at least once, not that you've tested all possible execution paths through the code. The idea that you could somehow replace the utility of static type checking with a suite of human written tests is laughable. Static typing systems allow you to prove facts about your code which make reasoning about correctness much easier than with dynamic type systems which practically disallow this (unless gradual typing is allowed in your language).
- flogic 9y agoStatic types and tests check different things. Tests are for making things function as desired. Types are for making sure they actually connect sensibly where desired. Sometimes you can use them for the other purposes though that often produces ugly tests/types.