In The Community: Meet Kate Gregory

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.

Control, performance, control, productivity, control, RAII, control. Knowledge matters. We could use some more libraries. And it's your foot.

Why C++?

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

Least?

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.

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.

"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.

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.