Welcome back to In the Community, our continuing series focusing on members of the C++ and developer community. This week, meet David Cravey,
I cut my teeth on programming in BASIC (GW-BASIC/QBasic), but eventually wanted a language that could let me do more. My local library had a nice book comparing the major programming languages at the time. The book presented C++ as not only the most powerful language but also the most dangerous. As a teenager the combination of power and danger attracted me. But eventually I found that while the C++ language was only mildly dangerous, it was indeed very powerful. I am amazed at how C++ 11 has not only made the language more powerful, but also much easier and safer.
C++ in 140 characters or less?
C++ allows developers to quickly create innovative solutions, without sacrificing control or performance.
Productivity – Generic programming using templates enables C++ developers to write very reusable code. The new C++11 features such as variadic templates, initializer lists, and lambdas make generic programming easier and more rewarding than ever!
Safety – The static type system can be easily leveraged to create libraries that are difficult to misuse. This allows the programmer to focus on developing and testing the business logic. Additionally, new C++11 features such as user defined literals allow types to be easily associated with constants, further eliminating error.
Performance – C++ provides numerous performance benefits as it favors programming styles that both the compiler and the processor can optimize for. For example because C++ favors value types and contiguous blocks of memory, the processor can prefetch data when working through the block of memory. This also helps power the automatic vectorizer and parallelizer in Visual Studio 2012, because while the optimizer can determine what is safe across a block of memory, it can’t make very many assumptions on complex object graphs.
What do you like most about C++?
That’s an interesting question, as I have recently had to do a fair bit C# programming at work. As such I have had the opportunity to work in a very beautiful language (C#) that is often compared to C++. What I have been missing the most while using C# is how much work can be moved to compile time in C++. One small example is that I can’t ask the C# compiler to verify that a variable is never altered by using the const keyword as I can in C++. What is more frustrating however is how limited C# generics are compared to C++ templates. With templates my code would probably had been 1/3 the size, and more statically type safe (i.e. the compiler finds the bugs instead of the runtime).
Definitely the relatively small number of libraries available out of the box!
Some of this is being addressed as the C++ standard libraries are being expanded to include core concepts such as networking.
But probably most painful is that C++ is lack of a first class Desktop story for Windows. I am hopeful that Microsoft will address this soon, as I feel it is very important for both C++ and the Windows Platform.
What advice would you give new C++ developers?
Learn by doing! As with any other programming language it is important to find a good book with exercises and work through ALL the recommended exercises.
More specific to C++ I recommend new developers focus on developing a deep knowledge of the most commonly used language and library features. Doing this is very easy, just work your way through a good C++ primer book (with exercises) and stop and do more research any time you find something you don’t understand. It is better to spend a day working through a concept that you don’t understand than to press ahead hoping for the best. Every developer I know who has used this principal has been very successful.
Do you have any favorite C++ favorite authors or books?
My favorite authors include: Bjarne Stroustrup, Herb Sutter, Scott Meyers, and Andre Alexandrescu.
For new programmers I recommend starting with “C++ Programming in Easy Steps”. My 11 year old daughter has been very successful with this book, as it walks you through every step very clearly. Any time she does not fully understand something then she will turn to her references (which in this case includes her father).
For intermediate/advanced programmers learning C++, many people have found “Accelerated C++” to be an excellent book. After that I recommend reading Scott Meyers’s “Effective C++”, and the other titles from my favorite authors listed above.
Where are your favorite technical places on the Web?
ISOCPP.org is a great place to find new C++ information.
There has been increasing C++ coverage at https://channel9.msdn.com, in particular Stephan T. Lavavej has a lot of great shows about the STL and the Core Language.
For general references I frequent the MSDN, and http://www.cplusplus.com. If those fail then a Bing search usually takes me to Stack Overflow, the Microsoft Forums, or The Code Project. Finally, for more in-depth coverage both Books24x7 and Safari Books are always a great place to turn.
What community contribution have you done recently which are you most proud of?
I lead and present at the Houston C++ User Group and DFW C++ User Groups, both of which meet monthly. As such I do a fair bit of speaking on a variety of C++ topics including the STL, Lambdas, C++ AMP, TMP, Functional Style C++, C++ IX, and the new Casablanca Library. The last topic is interesting to present on as the Casablanca Library has been rapidly evolving on Dev Labs. Now that part of Casablanca has just been released under the Apache License at http://casablanca.codeplex.com as the “C++ REST SDK”, I am looking forward to studying the internals!
What question should I have asked?
In addition to more C++ libraries, what would you like to see in the future of C++?
And the answer?
While the biggest hurdle to learning C++ is probably lack of integrated libraries, I would like to see more tooling for C++ that can help developers understand what the code is doing. This is a complicated problem, but as C++ does more at compile time I feel this is an area that could be very rewarding!
So tell us the truth, developers – did the power and perceived danger of C++ attract you to the language? If not, what was it?