Better Tests Through Mocking

If you have even a moderately complex application, writing tests can be a real pain. You either wind up writing complex, fragile tests, or you skip it altogether. There is a third path: fake out all of the parts that you aren’t testing in this test. You can examine the fake parts to see what has been done with them, and you can make them respond however you want to your program. »

Easy Makefiles

If you read my earlier article OMG WTF Makefiles, there was a lot of information to take in. And Makefiles built that way can get pretty overwhelming to keep up pretty quickly. In fact, unless I’m forced to use BSD Make, I use GNU Make and take advantage of some nice shortcuts. I’ll show you how to keep your Makefile building simple. Simple Dependency Management I hate having to update the Makefile every time I add a new class to the project. »

OMG WTF Makefiles

If, like many developers, you haven’t written a line of C or C++ since you left school, but suddenly find yourself needing to write in those languages, this article is for you. Or maybe you’re in school, but you need to write a moderately complex program (more than one file). This article is also for you. My Instructor Never Covered This It’s almost a given that your programming education didn’t include information on creating Makefiles. »

Embedded Test Suites

At Prairie.Code() I provided an example embedded project to demonstrate test driven development as part of an Arduino workshop. The example I gave used the Unity testing framework, but there are several others and they’re worth exploring. Unity I love Unity for its compactness, and how easy it is to use. It’s small enough to include the complete source in your project without bloating it. The examples in my presentations were all written with Unity. »

A Functional Conway's Game of Life

Conway’s Game of Life is an old standby for code retreats and coding katas. The game’s simplicity means that implementation complexity won’t get in the way of what you are trying to learn. A few months back in a code retreat a fellow attendee implemented the game in a functional language. My first thought was “why would anybody do that?” My second was “how could I do this in C? »