In the Community is an ongoing series spotlighting members of the C++ / developer community. This week, meet Kate Gregory.
Kate Gregory has been using C++ since before Microsoft had a C++ compiler. She runs a small consulting company in rural Ontario, www.gregcons.com, writing code in C# and C++, advising customers on technological decisions, and writing books and courses on C++. Kate has been a Visual C++ MVP since 2004 and a Microsoft Regional Director since 2002.
Follow Kate on her blog, Facebook, Twitter (@gregcons) and Stack Overflow.
C++ in 140 characters or less?
Control, performance, control, productivity, control, RAII, control. Knowledge matters. We could use some more libraries. And it's your foot.
Because I can do some things in C++ that are impossible in other tools. Because I happen to know it. Because I unabashedly love it. I know other languages, but I don't love them. I do plenty of managed code, but for the non-UI part of the app, where performance rules, C++ has the edge. It opens the door to things like C++ AMP, leveraging the GPU for up to a 100x performance improvement.
What do you like most about C++?
Deterministic destruction. I often tell people that I will stay up late at night over a little too much red wine arguing about deterministic destruction. But come on, it's so cool! RAII is a terrible name, but it's the best way to write the majority of code
Some days I like the verbosity and the explicit way we write some things. Why use dot for everything? I like that . -> and :: mean different things (see this post). And then some days I am using function pointers or pointer-to-member-function or I get tripped up because I forgot to be explicit about everything and I momentarily wish it was simpler. Also, I'm jealous of the libraries some other folks have. That, at least, can be cured.
What advice would you give new C++ developers?
Learn from a very recent course or book. The minute you see char* or char put down whatever you are learning from and go find something newer. Similarly if an example uses printf(). Embrace the standard library; lambdas make it work. Auto is your friend. Heck, the compiler is your friend, since it finds your errors of thought long before run time and long before your users do.
Do you have any favorite C++ favorite authors or books?
Besides myself J? Herb, Scott, and Andrei: I'll read anything they write and watch anything they record. I'm also a Kenny Kerr fan.
Where are your favorite technical places on the Web?
StackOverflow. I learn something there pretty much every day. Also I'm getting used to stopping by isocpp.org pretty regularly: there is good content there that often is nowhere else.
What question should I have asked?
What is the best new feature in C++ 11?
And the answer?
Lambdas. I'm the world's biggest lambda fan. Mostly because suddenly I can use all of the standard libraries without writing one line functions and dealing with function pointers. I can use the PPL for concurrency, I can use C++ AMP for astonishing performance improvements and really all of this would be unworkably awkward if it wasn't for lambdas. Now I can write code the way the smart folks have been saying I should all along, and it feels great.
Best feature of C++ -> lamdas
Yeah. C++ programmers are thirsty of new features from newer and better languages.
C++ AMP with 100x speedup ? Maybe for 1% cases after heavy and complex optimizations.
C++ is wrong language for web, for UI, for database access. Good only for 'fast processing engines' operating on prepared data.
"Newer" is a bit funny when talking about lambdas ;-)
"Originally specified in 1958, Lisp is the second-oldest high-level programming language in widespread use today; only Fortran is older (by one year)."
A general qualification like "better" is completely meaningless as applied to programming languages; only specialized qualifications, like "better for X", "worse for Y", etc., make sense in this context.
For example, C++ is good for infrastructure software:
I also like this characterization by Michael Wong:
* C++'s niche, a very large niche
- applications with a significant systems programming component; often with resource constraints
- applications with components that fall into different application areas so that no single specialized applications language could support all
- Most of us do unusual things sometimes
- General mechanisms beat special-purpose features
-- Applications that don't fit into a classification
-- Collaborate with other applications
-- Evolve from their original narrow niche
Note that the J in the interview is a :) in Wingdings. Outlook (and probably Word etc.) replace :) automatically with the Wingdings smile glyph.
Great Q&A Kate! Always a pleasure to read your work or hear your talks. Also the AMP thing is spot on. People who don't know the uses just, well, don't know what they're missing. AMP is a game changer.