This is the third installment of “In The Community,” a series spotlighting members of the C++ / developer community. Today we meet Jeremiah Morrill, MVP, developer and community guy.
Jeremiah has been in the software development field for 14 years. Over his career, he has moved between languages, operating systems and products but likes to call C++ on Windows “home”. He has spent many years helping write custom video and media solutions professionally and loves sharing his knowledge through open-source projects. He has been awarded Microsoft MVP since 2010 for his contributions to Client Application Development and hopes to have some more valuable additions very soon to his blog.
C++ in 140 characters or less?
C++ is choice and control. It gives one the choice of being high level, or low. It gives you the power to control how your code executes.
I believe C++ exists, and continues to exist because there are many systems that simply require what C++ delivers. It may not be what some would use to write a line-of-business application, but it may drive the virtual machine it sits on top of. Media codecs can be written in higher level languages, but its tools like C++ that allow them to run on a wider range of machines. Many of these systems can be quite complicated so having something that not only lends itself to performance, but also maintainability, is critical. C++ isn’t always the best answer to all questions, but I have rarely, if ever reflected back and said “I wish I didn’t write that code C++.”
What do you like most about C++?
You can tell a lot about someone by words they live by or goals they set. That said, one of the tenants of C++ is, “You only pay for what you use.” That should not be confused with “all algorithms are equally efficient”. It does however mean that the standard generally should not add unnecessary overhead towards a problem you are solving. Efficiency is important in many aspects of software and with C++, I know with a level of certainty that I am getting it.
Raw performance is only part of what I love about C++ so much. After all, we can write high performance routines in assembly, but that is much more difficult to manage and finding developers that are proficient in it may be hard to come by. Maintainability and productivity aren’t usually attributed to C++, but they should be, especially when considering the new additions to C++ 11. Classes, templates, standard library, lambda, etc all come together to help you write powerful, well abstracted code…and a lot less of it due to how expressive it all becomes.
Resource handling is another great part of C++. When working with OS resources, whether it is a file or a GPU texture, it’s very desirable to control when you release them. Some languages push a pattern, such as IDisposable, where the developer must remember to run a Dispose() and sometimes even chain Dispose() calls with other classes, which is a well-known cause for leaks. With C++, this is never a problem with the RAII idiom. It’s just automatic.
I also have to bring up the compiler errors. Many of them seem cryptic or just plain unintuitive. Problems with your template could generate enough errors to fill a book. After working with a compiler long enough, you quickly pick up what the errors really mean and even then they may require some poking around. This is not an inherent problem with C++, but is quite common among compilers and tooling. It is getting better and some vendors are leading the way in making compiler errors not just friendly, but actually tell you how to fix it.
What advice would you give new C++ developers?
Come in without bias and a blank slate. C++ has a lot of built up stigma. Some it may deserve, some of it is wrong and a lot of it is outdated. Managing memory is not something you have to do, or generally should do. Heap corruption is not something you should ever get, unless you decided to manually manage memory. Pointers are no longer something you constantly work with, but constantly avoid.
At first C++ can seem like a monster. Don’t try to learn it all at once. Most of us live in a subset of C++ and that’s ok. The folks that use everything are called “compiler developers” and there are not a whole lot of them in the world. Learn about classes allocated on the stack versus ones on the heap. Learn the RAII idiom. Understand containers, like vector or map. Know if you use the “new” keyword without a smart pointer, you are headed for trouble or if you arbitrarily use the “delete” keyword you are already in trouble.
Do you have any favorite C++ favorite authors or books?
Anything by Scott Meyers, specifically the “n-amount of Ways to Improve Your Programs and Designs”. You can’t really go wrong either with anything from Herb Sutter or Andrei Alexandrescu.
Where are your favorite technical places on the Web?
I’m sure I’m not original in saying Stackoverflow. It is one of the best resources for finding help, or just learning something new about C++. Even interacting knowledgeable folks on Twitter can be beneficial. At the very least it’s a good place to vent frustrations.
What question should I have asked?
Why do you like working with video and graphics technologies?
And the answer?
I can be impatient and the pixels give me instant gratification.