3 ms·
Yes let's waste our companies time and money by writing tests for things the compiler could guarantee for free!
by nightski 9y ago
Yes let's waste our companies time and money by writing tests for things the compiler could guarantee for free!
- pmontra 9y agoNot for free. You have to think and write types, maybe add some code to cast values between them or implement the same function twice for two different type signatures. Sometimes it still gains time, sometimes it doesn't. Anyway, I doubt that a VBA replacement would need types. The use case is small scripts.
- nightski 9y agoPython is strongly typed. You still have to think about the types. Except now you have to think about them every time you work with the code, not just the first time.
- pmontra 9y agoI work with Python and Ruby (some Elixir.) They are strongly typed in the same way. I hardly think about types. The code just works. The only scenario in which I have to stop and think is when I get some input, for example some JSON. Is that value I have to add to this counter a string or an integer? I can cast it to integer and that's it. To be fair, sometimes an integer gets where there should be a string and boom. Still, I prefer that to having to write types again as I used to when working with C and Java. I fix the code and I don't write tests to check the types of function arguments. Maybe I could accept some type inference, but no more string, int, generics, etc.
- deleted 9y ago[deleted]
- Godel_unicode 9y agoYou have to think about the types for some small pieces of your code where those types matter. That's what hints are for. Python lets you, through type hints, only care about the typing in those small cases where it actually matters, and ignore them the rest of the time.
- bpicolo 9y agoMost of it is caught as incidentals of tests you have to write either way. There's room for both paradigms - it's kinda silly to argue strict superiority of either because there's just no empirical evidence that having static typing or not drastically changes bug count. If you take a look at some of the studies out there that do exist (which there are, admittedly, few, and it's a fundamentally tough thing to measure), e.g. [0], it usually tends to be the case the both typed and untyped languages show up in the realm of "least likely to produce bugs" [0] http://web.cs.ucdavis.edu/~filkov/papers/lang_github.pdf http://web.cs.ucdavis.edu/~filkov/papers/lang_github.pdf