Writing Untestable Code

| Comments

The Google Testing Blog has a great post about how to write code that is impossible to test. The list is a handy scorecard to compare your work to. I was happy to see my sentiments about evil constructors echoed in one of the items:


Heavy Duty Constructors - Make constructors that do lots of work in them. The more work you do in the constructor, the hard it is to create your object in a test fixture. And if your constructor can construct other things that are hard themselves to construct, that’s even better! You want the transitive dependencies of every constructor to be enormous. Enormous is hard to get under test.
blog comments powered by Disqus

About this Entry

This page contains a single entry by Aaron Oliver published on July 29, 2008 10:03 PM.

Maybe Gradual Change Is Dumb was the previous entry in this blog.

You Don't Work as Hard as You Think You Do is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Categories

Creative Commons License
This blog is licensed under a Creative Commons License.