Skip navigation.

Archives

Chapter 2. Test-Driven Development with Objects

We are now publishing chapters of our book, Growing Object-Oriented Software Guided by Tests in a separate section of the site. We will publish news about new content in the blog but will not include the entire contents of each chapter as blog posts.

We have updated Chapter 2, Test-Driven Development with Objects in response to feedback from blog comments and the discussion group and improved some of the diagrams. More comments are always welcome.

RubyCocoa (etc.) podcast

I forgot to mention that I did a podcast with Daniel Steinberg:Brian Marick on Ruby Cocoa and TestingWho’s smart enough to program?Brian Marick talks to Daniel Steinberg on a wide variety of topics. Brian asks, who’s smart enough to program?, and describes how he met Andy and Dave at the Agile Manifesto summit. He talks [...]

Python - Counting Items In A List

Counting items in a list...

Lets say you have a list like this:
foo = [1, 2, 1, 2, 1, 2, 1, 1]
... and you want to count the items in the list, ending up with a dictionary full of items (dict keys) and counts (dict values), like this:
{1: 5, 2: 3}

TotT: Testing Against Interfaces

To quell a lingering feeling of inadequacy, you took the time to build your own planetary death ray, a veritable rite of passage in the engineering profession. Congratulations. And you were feeling pretty proud until the following weekend, when you purchased the limited-edition Star Wars trilogy with Ewok commentary, and upon watching the Death Star destroy Alderaan, you realized that you had made a bad decision: Your planetary death ray has a blue laser, but green lasers look so much cooler. But it's not a simple matter of going down to Radio Shack to purchase a green laser that you can swap into your existing death ray. You're going to have to build another planetary death ray from the ground-up to have a green laser, which is fine by you because owning two death rays instead of one will only make the neighbors more jealous.

Both your planetary death rays should interoperate with a variety of other bed-wettingly awesome technology, so it's natural that they export the same Java API:

public interface PlanetaryDeathRay {
  public void aim(double xPosition, double yPosition);
  public boolean fire(); /* call this if she says the rebel
                            base is on Dantooine */
}

public class BlueLaserPlanetaryDeathRay
    implements PlanetaryDeathRay { /* implementation here */ }
public class GreenLaserPlanetaryDeathRay
    implements PlanetaryDeathRay { /* implementation here */ }

Noob lessons for Software Testing

Raising Defects can challenge even the best of testers, as the tester at ClicheQuest Offices found out to his peril. Lessons this cartoon has to teach us about raising, or not raising, defects - ed: 'so we should say "lowering" then?' (sorry, I couldn't resist):"All we want are the facts ma'am" as Joe Friday would [...]