Dev Blog: Lessons from Limitations and Play

“Necessity may be the mother of invention, but play is certainly the father.*”  –Roger von Oech

One thing I’ve found is that limitations frequently lead to improvements.  An interesting note on that point is that deliberately imposing limitations on yourself can lead to surprising improvements, but it’s even better if it’s combined with play.

I’m sure I have much more to say on the topic, but for now I want to mention one major improvement that came out of a non-self-imposed limitation:  good assertion messages.

I worked for a company that had horrendously slow unit tests.  Even running a single one could take a full minute or more, because they actually spun up full in-memory databases for everything.  I quickly learned that it’s really nice to be able to just look at the test runner window and read exactly why the test broke, instead of seeing generic and cryptic error messages.

When you write unit tests, if you frequently have to debug why unit tests fail, write good messaging.  Even better, if you write classes that help you test certain things, like the TestRenderer class I mentioned before, then you can have dynamic messages that can reference member variables as well arguments passed into the containing method.

A simple idea, but it’s definitely saved a lot of time–even working on my own projects, where the tests run fast, it saves time debugging into the lower layers of the code.

*If you haven’t read any of Roger von Oech’s books, I certainly recommend them.  Your creativity will thank you.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s