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.

Using the Filesystem Library in C++ 17

One of my favorite things about C++ is that it works exceptionally well cross platform. This is entirely to the work of library authors who put a lot of effort into putting a common interface on common tasks, each with a different implementation. The proposed filesystem library in C++ 17, based on the excellent boost filesystem library, in one of my favorite bits. Unfortunately it's not entirely obvious how to use it without some deep digging. Let me show you how to use it in your project.

→ Read more...

2018/06/07 00:28 · clay

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