tag:blogger.com,1999:blog-34927953.post7585119353809156910..comments2023-07-09T02:39:33.734-07:00Comments on Jack Cough on Software: Testability vs. EncapsulationJosh Coughhttp://www.blogger.com/profile/04509343962912103631noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-34927953.post-18362844864618447472007-11-24T18:50:00.000-08:002007-11-24T18:50:00.000-08:00Sure seems like I have a lot of reading to do.Do y...Sure seems like I have a lot of reading to do.<BR/><BR/>Do you think some of the type systems in other languages were built with testability in mind, or do you think it was that testing came for free given a very solid type system? Or maybe a combination of both?<BR/><BR/>How much do language designers consider testability? I know you've said before that the only reason that Java has so much testing is that the language is poor to begin with (maybe you didn't say that, but I'm pretty sure you did), and I don't really agree with that. If I were to start writing code in any other language, I'd still want to start with unit tests. <BR/><BR/>In fact, if I were to start writing code in a new (or new to me) language, I'd probably want to rely on my unit tests even more than ever. <BR/><BR/>And I'm sorry if you didn't say that, but if you did, can you give some examples of how you could use considerably fewer tests in another language, and explain why?Josh Coughhttps://www.blogger.com/profile/04509343962912103631noreply@blogger.comtag:blogger.com,1999:blog-34927953.post-15073320290114763602007-11-23T18:08:00.000-08:002007-11-23T18:08:00.000-08:00C++ has this - the friend keyword. The Java people...C++ has this - the friend keyword. The Java people obviously thought it added too much complexity.<BR/><BR/>I have no problems with weakening access specifiers for testing in Java. That's mostly because I think that the whole Java access specifier system is shit, though, together with the one class=one file=one namespace thing. A lot of languages let you declare a module namespace with explicit exports, and then let any code put itself in that namespace or import things that aren't exported. Your test code can do this, without worrying about coupling across the interface definition, because it's yours. <BR/><BR/>Even a jvm language like Scala has companion objects that can access private things in its associated object. <BR/><BR/>Since you're so into testing you might be interested in Lazy Smallcheck, which exploits partial application of functions to quickly test properties without having to test all the possible inputs. There's lot of truly mindbending things that people do with the Haskell type system that could be exploited for increased testability , and of course the type system itself, being something better than the dog's breakfast Java gives you, gives you a lot of that for free.slshttps://www.blogger.com/profile/02960366964501502795noreply@blogger.com