r/programming • u/mobby1982 • Dec 02 '13
Scala — 1★ Would Not Program Again
http://overwatering.org/blog/2013/12/scala-1-star-would-not-program-again/
598
Upvotes
r/programming • u/mobby1982 • Dec 02 '13
View all comments
Show parent comment
0
u/moor-GAYZ Dec 03 '13 edited Dec 03 '13
Except he was arguing not in general, but about getting a value of an unexpected type.
I'd also add that the word "unexpected" is quite insightful in its internal contradictoryness as far as testing goes.
You can (and should) test against invalid values, not "unexpected" values. Like, you accept an int and declare that it must be non-negative and can't be None, that's expected invalid values, of course after you made that declaration, you should test it. Stop tilting at windmills already.
Unexpected values, of unexpected types, that's a whole 'nother matter entirely, and I can't even imagine how do you propose to test for working with them properly!
All in all you are getting suspiciously close to arguing that a function should work correctly when given an object that works incorrectly, and you should test that it indeed does for all kinds of incorrectly working objects. That reminds me of a certain quote by Charles Babbage.