For the past few weeks, I’ve been spending most of my time writing a new application in C++. Normally, my C++ work is on applications that have been around for a while, so doing something greenfield has been a refreshing change. Almost all of my C++ work these days is on Linux, but this new application initially needs to run on Windows. We want to move it to Linux eventually, and we like to do most of our development in Linux, so we decided to make the application cross-platform right away.
Based on this work, I have a few random observations:
Microsoft has come a long way on standard C++ compliance. I largely moved away from Windows when MSVC6 was current. At that time, you pretty much had to use something like STLport to get a remotely usable standard library implementation. With Visual Studio 2013, we haven’t run into any problems using the C++11 features we’ve wanted to use. For me, the first realization that Microsoft was getting serious was when they hired Herb Sutter many years ago. That change in focus has paid off.
Google Mock is pretty cool. For Smalltalk and Ruby, I’ve been following more of a Sandi Metz or GOOS style of TDD. In order to do that, you pretty much need a good mocking library. For this project, we decided to try Google Mock and it’s worked quite well. There are a few things it doesn’t handle; for example, you can’t mock a method that takes a non-copyable parameter (such as a
std::unique_ptr). That affects the design of the code a bit. It’s also possible to hit a deadlock in mock object destructors. This issue has supposedly been fixed for a while, but we’re still running into it.
POCO is a really nice set of cross-platform C++ libraries. I hadn’t heard of POCO before this project, but a colleague introduced it before I got involved. The more I work with it, the more I like it. It provides nice abstractions of all of the cross-platform features we’ve needed, including working with the filesystem, sockets, threading, etc. There is some overlap with Boost, but not much. They’re really intended to be used side-by-side. I’ve found a few little things I’d like to improve, and will likely submit some pull requests when I get some free time. Overall, though, I’ve been really happy with this library.
C++11 is a really nice improvement. I’m by no means an expert on all of C++11, but the parts I’ve been using are really nice. Lambda’s make it much easier to use the standard algorithms.
autosaves a lot of hassle.
std::shared_ptrmean I don’t have to bring in Boost just for some usable smart pointers. Uniform initialization syntax is very handy for easily initializing the standard collections. Even
std::to_string()saves having to use a
std::ostringstreamfor simple tasks.