Agile2014 Demo – Week 1

Today will be 3 weeks of development on our Agile SW/HW Co-development demo. This is a recap of week 1. Week 2 to follow and then we’re all caught up!

We’ve decided on an application. We wanted something simple, visual, fun and familiar so that people at the Agile2014 conference would feel comfortable sitting down and giving it a try. To that end, we figured Conway’s Game of Life would fit the bill. If you’re not familiar with Conway’s Game of Life, here’s a screenshot from the opening of its wikipedia pageScreen Shot 2014-04-30 at 3.58.47 PM

Part of why I chose Conway’s game of Life is because I think it’s a pretty common problem people tackle in code retreats. I first saw it at a code retreat when visiting Intel last april and tried it myself a few months ago to familiarize myself with GoogleTest. So I already have a solution… which is another good reason for it being the application :).

My initial version is written in C++ and uses a crude graphical output based on the ncurses library. Nothing flashy (as you can see in the video) but considering my goal was to practice TDD and get familiar with GoogleTest, it did the job just fine.

[youtube_sc url=hLj6WgPu2Ik width=640 height=480]

First on the todo list for the demo was to rejig my original design so we can redeploy it to the ARM core on the development board. There wasn’t too much to this considering I think I did a reasonable job of keeping the interaction with the ncurses library clean. In place of direct calls to the library, I inserted a new class with an API that could be implemented as target specific. The first target specific implementation still uses ncurses (it’s pretty much the original code). A second implementation will be specific to the development board and the HDMI output (the board will be connected to an HDMI display). When we’re done, we should be able to build and run either.

One interesting thing I accomplished that first week was to convert my hand-crafted mock of the ncurses library into a new version that uses GoogleMock. I originally mocked a portion of the ncurses library so I could isolate and test my code. It worked but I didn’t want to pass up the learning opportunity so I made the transition. For comparison purposes, here’s a screenshot of a test that used my hand-crafted mock…

Screen Shot 2014-04-30 at 4.32.13 PM

…and here’s that same test with the GoogleMock…

Screen Shot 2014-04-30 at 4.31.47 PM

You can see the 2 are pretty similar. This is a test that makes sure the screen is properly refreshed when the drawing->refreshDrawing() method is called. One difference is the order where the GoogleMock sets the expectation before the method is called. The other is that I didn’t have to do much to build the mock :). Here’s what it looks like…

Screen Shot 2014-04-30 at 4.35.59 PM

So that was week 1… re-partitioning my original implementation of Conway’s Game of Life and inserting GoogleMock in place of my hand-crafted ncurses mock.

-neil

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.