Welcome to our continuing series of Code Project interviews in which we talk to developers about their backgrounds, projects, interests and pet peeves. In this installment we talk to Kate Gregory, long-time C++ developer, trainer and consultant.
Who are you?
I'm Kate Gregory, one of the two Gregorys in Gregory Consulting. My title is Founding Partner, but that doesn't tell you much.
We have two entirely different sets of clients: one set we help to be better developers (we mentor them, write courses for them, write books, do sessions at conferences and user groups) and the other set are not developers at all and we write software for them. Everyone in the company has a different split of their time between these two halves. I'm more in the "help you be a better developer" camp lately. I do all our public stuff like blogging, tweeting, public speaking, getting interviewed, getting on a plane, and so on. Somewhat surprisingly (to me), I like it.
For a little over twenty years, I've lived in rural Ontario, between Toronto and Peterborough, and for most of that time the office has been attached to our home. I love living in the country, staying out of rush hour, and being able to stop working to do a family thing any time I want — then work late to catch up from that without having to drive back and forth to the office. In fact, we chose our house based in large part on the availability of Internet access (dial-up, of course) in 1991!
What do you do?
I've written a lot of courses for Pluralsight: Windows 7 development, Extending Visual Studio, just plain Using Visual Studio, C++ (three courses on the language itself plus one on Windows 8 development), and there's more underway. Pluralsight has a list of my completed courses that you can check out.
I'm also writing a book on C++ AMP, which should be finished in the late summer this year.
I'm taking on speaking engagements and travel again this year after a deliberate slow spell, and with the renewed interest in C++ a lot of that speaking is on C++ topics. For example I'm doing all-day precons at both Tech Ed Europe and Tech Ed US to show what all the fuss is about and what's new and exciting in C++. I'm also speaking at the first meeting of the Toronto C++ User's Group in April.
I'm mentoring several local developers (mostly .NET, WCF, line of business apps) and I do pitch in on our coding projects when I can. I have another project underway involving the intersection of Microsoft's latest technologies and the new stuff in C++, but I can't talk much about it yet.
What is your development environment?
Right now on my desk there are two laptops and two extra monitors, one for each. My day-to-day laptop runs Windows 7 and has VS 2010 and VS 11, both Express and Ultimate. It also has Office, three kinds of browsers, various handy utilities I've been using for 20 years (honestly, Paint Shop Pro – says copyright 1991–1997 on the splash screen), Camtasia, and all that stuff you just kind of accumulate as you do your job.
The second laptop is much newer and much emptier. I chose it because it has a very good graphics card (for a laptop) and I needed that to give C++ AMP a workout. Moving your computations to the GPU is what C++ AMP enables, but you need a card that supports DirectX 11 and my day-to-day laptop didn't have one. I haven't installed much else on that machine. It dual boots to Windows 7 or Windows 8 and both boots have VS 11, but not VS 2010 or Office. I put Paint Shop Pro on both boots for screenshots.
Right now something really odd is happening in my life: essentially all my work is in C++. This hasn't been the case for a very long time — decades, anyway. Even before .NET we did some VB from time to time. But by coincidence or otherwise, I'm living in C++ in VS 11 almost all day, every day. I have the VS instances on both boots of the new laptop on C++ Settings, for example, and it's starting to feel odd when I see Solution Explorer on the other side on someone else's machine.
There have been two other important changes to my development environment.
One is having a Windows 8 machine. I brought a slate home from //build/ and I put Windows 8 on a lot of machines. Now they're all updated to the beta and I am really starting to like working on it, even for "lean forward" work like writing code, writing a book, or building a presentation. The changes on the desktop side have not gained much attention, but I do find it more usable, in many small ways, than Windows 7, which was already pretty great.
The other change is the hosted TFS preview. This is such a convenient way to collaborate with clients and anyone else who's not in my domain. We have a local TFS server for ourselves, but having a hosted one as well was so simple to set up, and saves all that misery of emailing things back and forth or telling people you've put something on the FTP site. I even find it a convenient way to get files from one laptop to the other — check in on one, get latest on the other. I think the ALM feature set in VS 11 is part of why I'm finding it useful. There has been a big improvement in usability there.
I'm diving so deep into C++ AMP I'm not totally sure anyone will follow me there. Right now I'm learning more than I wanted to about the hardware of a GPU and the way memory is laid out, processes are scheduled, and so on. I'm doing some Metro development in C++ and XAML for Windows 8 and really enjoying that a lot. I like the parallels to phone development, and I plan to port our phone app (written in C# and XAML) to WinRT soon. All of this is fueled by the changes in the C++ language itself. These days, C++ is much easier to write and to read, much safer, and of course still fastest at runtime of all the languages you might use.
What is your coding pet peeve?
As a consultant, you have to be able to adopt the coding styles and naming conventions that your clients use (if they have them), or be able to advocate a style if they don't.
I like my braces on a line of their own most of the time – the exception is in the new PPL continuations with lambdas where I tend to put }).then( on its own line or }); on its own line. I'm sure that looks insane if you haven't yet tried to read a chain of 4 or 5 then calls, but trust me, it makes sense in context.
I'm ok with Hungarian for controls (lblResult or btnEdit), but not for strings, counters and so on.
I take the Visual Studio defaults for indenting and if I meet someone who's really passionate about indents (tabs/spaces, 3/4, braces in or out), then I work hard not to have to sit with that person at lunch.
My pet peeve is this sort of thing:
result = foo(whatever);
if (result == true)
We've all seen it. When I'm mentoring people I explain why that's so useless. If I'm doing a code review I just replace it on the spot:
I also get pretty annoyed by Yoda conditions:
if (true == result)
Turn your warning level up and leave your code readable.
Other than those two I'm a level headed, patient, and tolerant person who can accept a wide variety of programming styles. It's just that everyone has their limits.
How did you get started programming?
I'm supposed to remember that? Ok, in 1976, we had a computer come and visit our high school. I think it was basically a calculator. You typed in expressions and got answers. Ill-formed expressions, or those with underflow/overflow answers, made it light up a sign that said TILT. (Will anyone remember a pinball reference? But that's what it said.) It was just the dorkiest thing ever. I had a try and it said TILT when I didn't expect it to and I was annoyed and decided I wouldn't do anything with computers.
I went to the University of Waterloo because my mum was a prof at the University of Guelph and my dad was a prof at the University of Waterloo, and those were my choices because I was 16 and they didn't want me to move away from home to go to university. I chose Waterloo and the math faculty, so I was one of those hundreds of first years learning WATFOR as part of an algorithms course. About all I remember from that course is my first programmer joke:
Why did the programmer drown in the shower? [hold up something like you're reading it] "Lather, Rinse, Repeat."
After a while I transferred to Chemical Engineering because I liked it a lot, and on my co-op jobs I was asked to program some simple things, and I did, and I liked it a lot. That was pretty much all Fortran.
I also learned PL/1 as part of another job and that was sweet! They had arrays as a built in type so you could say A=B instead of looping through the elements. Then, while I was a grad student (in the late 80's), I learned C++ so I could write some numerical integration to handle these multiple partial differential equations I was tackling. I've been a C++ person ever since, though I've still kept learning new things.
Community is a huge thing to me. I love meeting people in person at conferences and user groups. I love when people comment on my blog or engage on Twitter or my Facebook public page.
I am very active on StackOverflow and a pile of other StackExchange sites. I have a LinkedIn profile but I don't really do anything with it. I also monitor some of the Microsoft forums depending on what I'm working on — so I can solve my own problems or see what others are struggling with.
I've been surprised what a difference in my life Twitter makes. I feel connected to people I don't see often, I learn important information, and I laugh a lot. It's good.
What advice would you offer to an up-and-coming programmer?
Don't try to go it alone. If you're the only developer in your company, get to a user group and meet some local people. Go to conferences whenever you can. If you can't, wait for the sessions to appear online and then watch them. Follow folks on Twitter, read blogs, read articles. Have a routine with your morning coffee where you check in with what's happening in your industry. You are going to save that time back throughout the working day. If you have other developers on your team, pair with them sporadically. It's tremendously fun and productive to spend an hour just blasting through something and making it work. Then go back by yourself and tidy it up, sure.
Also, if there's a technology that you know well and that's working for you, don't feel obliged to drop it in order to pick up something new. Everything old seems to come around again after a decade or two, and you can be very valuable if you've stayed up to date in the old as well as the new. That's what I'm finding now. People who wandered away from C++ around the turn of the century have no idea what it can do now. They're hampered by their old knowledge of it. But people who stayed with it all along have got a skillset that is suddenly very hot.
Now don't get me wrong: I picked up the new stuff. I've written plenty of .NET code over the last decade, and it's been good and useful code. Don't be "all or nothing"in either direction.
(I know, that was two pieces of advice. But I'm in my fourth decade of being paid to program: I have a lot of pent-up advice.)