embUnit Translators for CruiseControl

Back home and time to get tech oriented again. Our CruiseControl and unit test practices are proceeding at steady pace, so I thought I will make our XSL translators for embUnit unit test framework public in this forum at this point. You can find them here (unittests.xsl and testdetails.xsl). If you are an embedded programmer like me, and do not currently know much about CruiseControl, and/or XML, I'll try to briefly explain how to set it up. If there is enough interest I will make a more detailed intro to it.

You need at least to have following installed:

  1. embUnit unit test framework and compiled libraries
  2. Java SDK. Remember to set JAVA_HOME environment variable to point to install dir.
  3. CruiseControl, of course
  4. Make tools. I recommend for Windows users the whole Cygwin installation to cut down the hassle

Now you can run the Cruisecontrol Ant built Java and JUnit sample, but before you can start cruising with your embedded C project with Make and embUnit framework you need to at least do following modifications:

  1. Build a simple C project which has makefile for automated build. Greate a CVS project and check your project out to your build server for CruiseControl (use Subversion if you are ahead of us, but you are on your own with this). Look at Driving on CruiseControl articles by Lasse Koskela for help.
  2. Modify our config.xml to suite your project (see my earlier post about it) and replace the file in CruiseControl root
  3. Replace unittests.xsl and testdetails.xsl files in CruiseControl folder ./webapps/cruisecontrol/xsl.
  4. Launch CruiseControl and start cruising...

And here are some screenshots on how it looks.

Here a test fails (purely for demonstration purposes of course). Details of failed test are displayed below.

Details of all tests are also available.

After a brief moment everything is in order again. I used the green bar to signal this.


Battery Charging and Reflection

Yesterday evening we arrived to Lappeenranta and lake Saimaa. I have to say it is a beautiful scenario for battery charging. Even while the city was offering a festival (in finnish), I decided to take a day off from beer drinking and - well - read about change.

My book of choise, Fearless Change, by Ph.D's Linda Rising and Mary Lynn Manns, is of great value for anyone trying to get innovation diffused in organization. The book describes 48 patterns for driving and sustaining change. Many of the patterns we have found out during our journey. Among them a pattern "Time for Reflection" in which doctors recommend:

To learn from the past, take time at regular intervals to evaluate what is working well and what should be done differently.

This is excatly what we need to do again after the vacation.


Small Countries Seem to be Aggressively Agile

Google trends has been used to map agile development interest in different countries. Jonathan Cogley started it with a search for 'How Agile is Your Country'. Dave Nicolette went on with revisited search term set, and got this google trend. By choosing the regions you find (at least I did at the time) Finland in 10th place. So it is no wonder agile conferences in Finland are packed.


Prisoners of Our Habits - Act Four

Prisoners of Our Habits. Act three. Executive manager enters.

Executive manager is reading an email from project manager
"Dear Sir, I overheard this developer, John Smith, saying
his technical solution may cause $1.00 increase
in bill-of-material."

EXEC'MNG: -"Stop the press. This John Smith starts
immediately to investigate alternative solutions,
what ever they are."

Product under development may have hundreds of relationships. Tradeoffs between these relationships are being made in hourly basis. When one of these issues gets taken away from the context, it may seem like a big deal. The big deal in fact is when a bad decision (based on bad information) like one above is made the project environment, a complex adaptive system (CAS), gets an unexpected input. What happens in CAS is totally unpredictable. Typically the system is pushed into chaos and disorder. This is why agile development blocks these inputs from the team for a certain time, and opens the window for these new inputs only frequently enough. Command and control is traditional way of managing projects. Developers have not been encouraged to self-organize traditionally.

And old habits are slow to die.

I know paradigm shift is extremely slow, and so does James Shore (see his Change Diary). I'll be on vacation for couple of weeks and after that it would be perfect time to reflect and adjust the course of this agile journey. I just hope couple of weeks is enough for the old batteries.


Prisoners of Our Habits - Act Three

Prisoners of Our Habits. Act three. A manager enters.

DEV -"We should try to learn new ways of doing thingies
around here. We could participate in action research
program, you know?

MNG -"Hmm, That sounds like a lot of money. We could buy
a lot of chairs in two-day course for that. Wouldn't
that be great?


There is a huge difference between being teached and learning. To start with there is a difference of acquiring existing knowledge versus creating new knowledge. Further there is a huge gap between action learning and a static content course which may have zero contextual relation with developer's current situation. I have seen the affect of these courses, and it does not impress me. It is just like many other mental models in this industry; a pretty model without connection to reality. But hey, traditionally developers have not taken part in action learning.

And old habits are slow to die.


Prisoners of Our Habits - Act Two

Prisoners of Our Habits. Act two. Project manager enters.

PM: -"You need to focus on project's
paper deliverables for the next two months

DEV1: -"Which papers you mean? For whom they are,
and for what purpose?

PM: -"I do not know, but reviewers know all the
buzzwords, so my ass needs to be covered.

DEV1: -"Eh, That does not sound so valuable and motivating?"

PM: -"It's not supposed to be. I fill in dashboards
which no one reads. You should have no problem
creating papers with no value.


The above is not a Dilbert strip. It is status quo in many development projects. Dashboards illustrating Gannts, PERTTs etc. are what we traditionally use for project management, and paper documents are what we traditionally use for progress monitoring and project quality assurance. So what the hell is wrong with that you ask? Again, it is a nice model, I really do like it. It has only one flaw; it does not hold in reality.

Then again working prototype, incremental release plan, Sprint backlog, or burndown chart are not used traditionally.

And old habits are slow to die.


Prisoners of Our Habits - Act One

I have been describing continuous integration for an embedded firmware project targeting a low-end microcontoller. Based on discussions I see a need for pointing out something about my view;

I do not mean that you need to apply continuous integration, unit tests running on both the host and target, etc. if you are writing a 200 LOC blinking LED application for 8-pin microcontroller for fun. This is a job for Solo-Virtuoso, and methods should be alike. The project I'm talking about, while targeting the low-end microcontrollers, will develop tens of thousands of lines of C source and will eventually be compiled into ten or so configurations for mass production. The configurations have some special areas where expertise is needed, like power management and wireless RF technology. This type of project cannot fit the Solo-Virtuoso category. Instead it requires a collaborative group of people - a job for an agile team and this team should adapt these practices.

Purely based on my biased participant observation, the trend of firmware projects is towards bigger and more complex so we are going to need these practices. The problem in firmware domain is that former electrical engineers (now programmers, or even worse, managers) are not willing to see this increase in complexity, but remain prisoners of their old habits. They are still in denial. My recent experiences manifest this very thing.

Prisoners of Our Habits. Act one. Programmer enters.

A colleague following our agile journey mentioned that based on his observations of daily Scrum meetings and collaboration we continuously run into problems caused by someone changing an interface and all of a sudden none of the configurations work. His obvious solution for this was; "there is a need for up-front designed interface contracts between modules". Problem solved, eh? We do not have full set of requirements, nor the freezed hardware architecture. For me iron-bound interface contracts seem pretty far fetched objective, but then again, it's just me. Still I would be amazed (but happily so) to find this wizard pulling out a comprehensive up-front architecture for us. Oh, and preferably delivered as a PowerPoint presentation I might add. If you happen to know this guy, ask him to drop me a line. I could use a good laugh.

I see these discussions about interfaces as a solution, not the symptom. It is good to see team members having courage to change things, to refactor when opportunity arises. These conflicts usually get solved easily after the daily Scrum at latest, so to me these are just short architecture meetings. In addition there is a huge difference compared to normal high ceremony architecture meeting: decisions get made and implemented immediately and feedback is available the next day. I have witnessed this working extremely well, and fast, even with programmers with junior skill level. This is just not the way it has been done traditionally.

Old habits die slowly.


Agile Business Conference - Program Draft Available

There is a program draft available for this year's Agile Business Conference in London. I have attended this conference for two years and I can recommend it. It is organized by DSDM Consortium and the title has word 'business' in it, but the agenda is about agile in general. This years highlight for me seems to be 'Agile and Embedded Systems' (Pekka Abrahamsson) . I'm also very interested in presentation by Mike Criffiths - 'Utilising Agile Methods Alongside the PMBOK Guide'. I see very little value in this balancing, but this is something we currently often need to live with and nevertheless we should always remember and reflect where we are coming from. This helps us to understand where we would like to go next (post-agilism).

Again interesting to see keynotes from Kent Beck, Sean Hanly, David Taylor and Polyanna Pixton. I really hope I'll be able to make it! If you are planning to be there, and are interested in agile [product] development, drop me a line and we will catch up.


Objects and Firmware - Inheritance

This is the third and last post (see earlier basic encapsulation and polymorphism) about object based firmware programming. This is about single inheritance, another important object oriented principle. This is also pretty much as far as I would go with the HW currently available for our embedded projects, low-end 8-bit microcontrollers. Anything further would require even more use of pointers, including function pointers, and I'm not really that comfortable with their heavy use.

The sample code implements a simple Level object type which has only two members, level and currentState. The first one holds a threshold value, the latter indicates wether the latest sample was below the level (currentState = 0), or equal/above (currentState = 1).

Next we have used Level as a parent for another object type, LevelWithOffset. The new object has the Level type as its first member, named super. This gives us possibility to use pointers to both of the object types in similar way. LevelWithOffset object type has an additional offset member. Value of offset is added to set level. In the example code we have two objects, one simple Level and one LevelWithOffset. Constructor is called for both setting the level to 2. The LevelWithOffset object is then further adjusted by setting the offset also to 2.

The main loop calls the notify method for both objects with values from 0 to 4 and outputs the state of both objects. We can see from the test run that the other object switches the state only after the sample is increased by 2 more steps (effect of additional offset).

You can go a long way with this object stuff in C. If you are interested then check out the papers listes below and start working on your skills and creating your own opinion.

Miro Samek, Portable Inheritance and Polymorphism in C, ESP (pdf)
Ron Kreymborg, Single Inheritance Class in C, Dr. Dobbs Journal
Matthew Curreri, Object-Oriented C: Greating Foundation Classes, ESP (part2)