Clay Dowling's Occasional Musings

I write code, build things, and occasionally lead teams. I also share my thoughts or things I've learned about them, so that others can learn from my mistakes.

Clay's Pie Crust Recipe

I've cobbled this recipe together from various sources, starting with my grandmother's pie crust recipe, and adding in things I learned from my mother and reading cooking magazines.

→ Read more...

2017/12/07 20:53 · clay

Makefiles for Test Driven Development

I'm a big believer in Test Driven Development. That's the model where you write a failing test, then you write just enough code to make the test pass, but no more. It sounds counter-intuitive,but experience has shown that I get a finished, deliverable product a lot faster, and I'm less likely to find bugs. Even more importantly, my customers are less likely to find bugs.

Setting up a Makefile to support test driven development adds some additional challenges to what I've shown in my earlier articles. It's probably necessary to keep source and test is separate folders just to maintain sanity. We'll probably also have an outside dependency on our test framework, and there's a good chance that we'll need to create test doubles for some of the dependencies. A hypothetical folder structure might look like this:

  project
    - mock        // Test doubles
    - src
    - system      // functions which interact with hardware
    - test
    - unity       // our test framework

Each of those folders contains its own Makefile. For all but the test folder, that Makefile looks very similar to what we've seen in previous articles.

→ Read more...

2017/11/25 13:39 · clay

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.

→ Read more...

2017/11/12 22:05 · clay

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.

→ Read more...

2017/11/05 11:38 · clay

Embedded Testing 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.

→ Read more...

2017/09/27 23:35 · clay