Safety In Types

Posted by    |      

Kevin Bourrillion, one of the creators of Guice, has written an excellent post on the subject of typesafety.

There's a seachange going on right now in the Java world that is taking Java, in some sense, in /exactly the opposite direction/ that people championing dynamic languages might expect. With language innovations like generics and annotations, we can now express so much more in a typesafe way, and get so many more benefits from static code analysis.

In pre-JDK5 days, we worked around the lack of support for a declarative mode of expression by embracing XML for all kinds of tasks, and convincing ourselves that this was a good thing: we were supposedly making our system more configurable. But, of course, we've now realized that XML is just code - or rather, that /code is just text/. And we've realized that by making too many things configurable, we merely make our system easier to break, and more difficult to change in meaningful ways. Our obsession with configuration crippled our refactoring tools.

The challenge now is to marry dynamic behavior with this new, typesafe, mode of expression, proving that systems that can be understood through static analysis need not be /too static/; that we need not pay for precision with tight coupling and verbosity.


Back to top