Tuesday, January 25, 2011

Nuggets of Testing Wisdom from Kent Beck on Software Engineering Radio

I really like this interview on Software Engineering Radio with Kent Beck by Martin Lippert: Episode 167: The History of JUnit and the Future of Testing with Kent Beck".  A few good tidbits:

  • Testing at different levels: In response to a question about the development of BDD (behavioral driven testing) in response to his TDD (test driven development), he mentions the importance of testing at different levels of code, from unit tests to behavioral or acceptance tests, suggesting that BDD is entirely compatible with and perhaps a refinement of TDD.
  • Flexibility and trade-offs: He recommends considering the cost or appropriateness of testing under different circumstances, an idea that again applies to testing at different levels.  Exploratory coding should probably not require a TDD approach, because short-term costs in exploratory coding are important.  I would argue this notion applies to creative processes in general -- brainstorming activities are more about volume than perfection.
  • Stories and DRY: He says of DRY (the principle don't repeat yourself), "I don't subscribe to [it] for test code because I want my tests to read like a story."  The story theme runs throughout the interview.

Friday, January 14, 2011

IOException with RecordStoreNotOpenException on RmsStorage.save() after RmsStorage.deleteAll()

If you see java.io.IOException caused by javax.microedition.rms.RecordStoreNotOpenException thrown while executing a save() in your J2ME Polish app, running for example in the Java ME emulator or also on real devices (BlackBerry, etc.), then you may be encountering the following problem.  Check if you have called deleteAll() previously.  RmsStorage (improperly, it seems) closes out the underlying record store when it performs a deleteAll(), so that subsequent calls to save() do not work.  If you do want to use deleteAll() to clear an old RmsStorage instance, the only solution I know of is to use a different instance after clearing the old one.
Copyright 2011 by William Cain