Since joining Atomic, I’ve primarily worked with the latest languages, tools, and frameworks. My current project has been quite an interesting change in that I’m working in a 34-year-old language: C++. It’s been almost eerie to pick up my CS 130 C++: An Introduction to Computing book and find the material still relevant. That’s not to say that things haven’t changed a little since I last fired up a g++ compiler.
Did you know there was a C++ 2011? I had no idea! There are also 2014 and 2017 specs underway. C++ 2011 adds a variety of new features and performance updates. I was most interested in some of the usability improvements:
- Support for lambda functions and expressions.
- Type inference, so that your variable declarations don’t need to repeat types on both sides of the assignment.
- “foreach”-style looping for simpler iteration over iterable types.
- Standard threading support (finally).
- Improved regular expression support.
- The spec allows for garbage collection! In C++!
None of these features are particularly original, but they do make life a little more pleasant for a Java or C# developer going back to C++.
googletest, googlemock, and cucumber-cpp
We take test-driven development pretty seriously at Atomic Object, so I was interested to see how our usual approach of unit and integration testing would translate to the C++ world. In my previous “embedded” projects, TDD was unheard of, and we really had no TDD frameworks to speak of. I was very pleased to find a full set of testing tools in use in our C++ projects.
- Googletest is basically an xUnit framework for C++.
- googlemock is (as you have guessed) a mock library to go along with Googletest.
- Cucumber-cpp allows us to write Cucumber/Gherkin integration tests for our C++ applications, which is really nice.
Taken together, these tools can help bring a nice sense of order to the potentially chaotic world of pointers and memory allocation.
Our project uses the Qt widget library as a base for the user interface, and there have been some interesting changes there since my last Qt project.
- Qt Creator provides a fairly decent C++ IDE. I’ve found it to be quite helpful in navigating through source, jumping to definitions, and searching for content. The auto-completion and auto-correction tools are quite nice. The IDE also has integrated support for running CMake, launching and debugging.
- Qt Designer provides graphical layout tools. While I normally haven’t been a huge fan of these tools, I am finding that given our long build and deployment times, Qt Designer can be a time saver. Previewing UI changes immediately rather than iterating through code/build/deploy cycles has been a big plus.
Overall, I wouldn’t say that C++ has become a joy to program in compared to more modern languages. However, updates to the core language features, testing libraries, and tooling available have made the transition back to C++ a bit easier than I expected though. Maybe it’s time for me to check out the latest Fortran!