Resisting marshmallows is hard. Adopting TDD, too.

We are not as rational as we think we are. Or as Dan Ariley might put it: We’re All Predictably Irrational. The other day I read “Die Kunst des klaren Denkens” (lit: The art of clear thinking) by Swiss author Rolf Dobelli. One of the common logical fallacies Dobelli describes in this book is the fallacy of Hyperbolic Discounting – the inclination to value immediate rewards over over delayed rewards. It seems to me, this human predisposition like no other lies at the heart of many mistakes in software development, including failed attempts adopting Test-Driven Development (TDD).

But first, let’s look at the research on Hyperbolic Discounting. The inclination to favor immediate rewards over long-term rewards is also observed in animals and is likely to be a remainder of our animalistic past. Animals, for the most part, do not show the ability to postpone gratification. One particularly famous example, illustrating our human struggle to deal with delayed gratification is the Stanford Marshmallow experiment. In this experiment children were offered a small, immediate reward (e.G. a single marshmallow) or a bigger, delayed reward (e.G. two marshmallows in 15 Min). Continue reading

An Odyssee of Android testing

A few days ago I started developing my first native Android App. Finally a green field project! Finally, an opportunity, to do things right! Finally, a project I could develop in a Test-Driven fashion without the weight of any legacy cruft slowing me down! Or so I thought…

With a lot of enthusiasm I bootstrapped a new Maven Project and sure enough there was an Archetype with something called “Instrumentation Tests” included. At that point I had no idea what an “Instrumentation Test” might be, but I thought, if it’s got the word Test in it, it can’t hurt, right?

When I checked the pom.xml file, I noticed there was no JUnit dependency and also the archetype did not generate the usual “src/test” directory sibling of “src/main”. Well, nothing I can’t fix. So I threw in my usual test dependencies and started out writing tests in “src/main”, ignoring the instrumentation project Maven created for now. In retrospect I should have seen the signs on the wall…

Continue reading

Resolving the Jenkins Xcode License Agreement Issue

When I set up a new Jenkins CI Server on OS X in order to build iOS Projects I ran into some trouble.

The combination of Xcode 4.3, the Jenkins Xcode Plugin 1.3.1 and the Jenkins CI Version 1.458 does not seem to play well together. Whenever I tried to build an Xcode project, the build failed with the following message:

You have not agreed to the Xcode license agreements, please run xcodebuild standalone from within a Terminal window to review and agree to the Xcode license agreements.
Build step 'XCode' marked build as failure
Finished: FAILURE

When I went to the terminal and entered the exact same build command from the Jenkins logs, the project built just fine. Weird. I googled for the error message, but did not find anything on the web.
Continue reading

Brilliant talks on Software Engineering

I love to watch talks on software engineering. To me, they’re a great source of inspiration and knowledge, I can just cram somewhere into a quiet evening on the couch.

I found it quite a discovery that so many videos of talks I deem absolutely brilliant are available on the web – for free! And now I would like to share with you some of these video gems I discovered so far – so without further ado, here’s a list of my favorite videos on software engineering, grouped by topic:

Agile Software Engineering


Agile/XP Overview (DDL)
Robert Martin shines a spotlight on the flaws of the “traditional” phase-oriented software development methods, before introducing a brief history and the key advantages of Agile methods and how they address the flaws of phase-oriented software development.

Continue reading

Slides: Writing Testable Code [Updated]

Painless Testing - Writing Testable Code SlidesI recently prepared for a presentation about “Painless Testing – Writing testable code” and I would like to share it with you. There is a Python Version and a Java Version of the slides available.

These slides will require an HTML5 capable browser such as any recent Mozilla Firefox, Google Chrome or Safari version. Press the right/left keys on your keyboard or click somewhere near the right or left edge of your browser window to switch slides.

The talk is based on this amazing guide by Miško Hevery (Google) and others.

Update: This is the 2nd complete revision of my talk, published on March 7th 2012, for my talk at the Java User Group Göttingen.