CppCast - C++ Simplicity

Episode Date: May 3, 2018

Rob and Jason are joined by Kate Gregory to discuss her recent talk at ACCU, Pluralsight courses and include C++. Kate Gregory has been using C++ since before Microsoft had a C++ compiler, and... has been paid to program since 1979. She loves C++ and believes that software should make our lives easier. That includes making the lives of developers easier! She'll stay up late arguing about deterministic destruction or how C++ these days is not the C++ you remember. Kate runs a small consulting firm in rural Ontario and provides mentoring and management consultant services, as well as writing code every week. She has spoken all over the world, written over a dozen books, and helped thousands of developers to be better at what they do. Kate is a Microsoft Regional Director, a Visual C++ MVP, an Imagine Cup judge and mentor, and an active contributor to StackOverflow and other StackExchange sites. She develops courses for Pluralsight, primarily on C++ and Visual Studio. Since 2014 she was Open Content Chair for CppCon, the largest C++ conference ever held, where she also delivered sessions. News CppChat Design Patterns in Modern C++ Announcing a single C++ library manager for linux, macOS and Windows: vcpkg Conan 1.3.0 released March 2018 ISO C++ Meeting Trip Report (SG1 Concurrency and Parallelism) Kate Gregory @gregcons Kate Gregory's Blog Links Meeting C++ 2017 - Kate Gregory: "It's Complicated" ACCU 2018 - Kate Gregory: "Simplicity: not just for beginners" Meeting C++ 2017 - Kate Gregory: "5 Things I figured out while..." Pluralsight: C++ Fundamentals Including C++17 Sponsors PVS-Studio The Evil within the Comparison Functions Patreon CppCast Patreon Hosts @robwirving @lefticus

Transcript
Discussion (0)
Starting point is 00:00:00 Episode 148 of CppCast with guest Kate Gregory recorded May 3rd, 2018. This episode of CppCast is sponsored by PVS Studio. One of the most powerful static analyzers for C, C++, and C-sharp source code, PVS Studio will let you detect errors and potential vulnerabilities at the earliest stage. Try the demo version today at viva64.com. In this episode, we talk about C++ package managers. Then we talk to Pluralsight author and consultant Kate Gregory.
Starting point is 00:00:49 Kate talks to us about how to make C++ developers by C++ developers. I'm your host, Rob Irving, joined by my co-host, Jason Turner. Jason, how are you doing today? All right, Rob, how are you doing doing okay and uh we'll talk more about this next week but we might need to change that intro right well i was gonna say yeah are we keeping that intro or not we were told to keep the intro i think yeah so for listeners who don't know what we're talking about um cpp chat which uh was previously just a youtube show that john call would do with you know people in the c plus community um it hasn't been active in quite a while uh i think their last episode was like six months if not more ago something like that yeah uh but they
Starting point is 00:01:59 have decided to restart the show uh phil nash who's going to be joining us next week is is helping john out with the producing of the show and they wanted uh jason and i to go on that first episode for their reboot so that's already out live on youtube and and uh they're now going to be doing it as a podcast too yeah and since you just heard that phil's going to be on the show next week don't bother sending in questions for for Phil because we're actually recording that much sooner than by the time this airs. Yes, because next week you and Phil will both be busy at C++ Now, right? Yes. Okay. Well, at the top of our episode, I'd like to read a piece of feedback.
Starting point is 00:02:38 This week we got a comment on the website. Last week we had Kevlin Henney. We were talking about C++ patterns. And Dimitri Nustrik, who was a previous guest of the show, put out a shameless plug for his book. He said, speaking of patterns, and he put in a link for his book
Starting point is 00:02:56 which is Design Patterns in Martin C++. And I hadn't heard of this book, but it was available on Amazon. It was published by A-Press. And I think he made an Udemy course based on the book as well. Oh, I don't know. I also wasn't aware of the book. Well, if we want to do a follow-up patterns talk,
Starting point is 00:03:17 after talking to Kevlin last week, maybe we could do another one with Dimitri sometime. Well, yeah, here we go. So Dimitri's book was just made available Aprilil 19th okay so it's really new yes okay well we'd love to hear your thoughts about the show as well you can always reach out to us on facebook twitter or email us at feedback at cpcast.com and don't forget to leave us a review on itunes joining us again today is kate gregory kate has been using C++ since Microsoft had a C++ compiler and has been paid to program since 1979. She loves C++ and believes that software
Starting point is 00:03:51 should make our lives easier. That includes making the lives of developers easier. She'll stay up late arguing about deterministic destruction or how C++ these days is not the C++ you remember. Kate runs a small consulting firm in rural Ontario and provides mentoring and management consulting services. As well as writing code every week, she has spoken all over the world, written over a dozen books, and helped thousands of developers
Starting point is 00:04:11 to be better at what they do. Kate is a Microsoft Regional Director, Visual C++ MVP, an Imagine Cup judge and mentor, and an active contributor to Stack Overflow and other Stack Exchange sites. She develops courses for Pluralsight, primarily on C++ and Visual Studio. And since 2014, she was the open content chair for CppCon and the largest C++
Starting point is 00:04:30 conference ever held, where she also delivered sessions. Kate, welcome to the show. Thank you. Great to be back. You have probably the widest ranging bio of anyone that we've had on here. The short form is I do stuff I like to do. Some of it I get paid for. So if you run a small consulting firm in rural Ontario, I assume most of your work is remote? Yes. The marvelous thing about remote people is that you don't have to go to meetings. Yes, that is true. Years and years ago, I was doing some stuff for Microsoft on some internal project of theirs.
Starting point is 00:05:09 And my guy phones me and says, I'm just about to go into a meeting and I forgot to ask you blah, blah, blah. He gets like three pieces of information off me. He rushes off. And he phones me back four hours later. He's like, okay, the meeting's over. We're all fine. There's no change in our status. You keep right on doing what you're doing.
Starting point is 00:05:24 And I'm like, at that moment, I knew I was living right. But yeah, we used to have some local clients and they would say, we want you to build us some software and we have this much budget, which was sort of maybe three or four days of developer time. And then they'd want to have about five meetings about what it was going to be. And it's like you're using up your whole budget on meetings. It's not going to be in time to write your little utility if they keep this up. So I discovered remote people are far more efficient that way.
Starting point is 00:05:57 That is, yes. It's one of the things that makes me think it would be very difficult to go back to a regular job. I would be a terrible employee. Because I have so many irons in the fire, you know that email you have to be in a good mood to answer or what have you. I put stuff off until I feel like I'd be good to work on it now. That's fine as long as you're saying I work two hours for you today and one hour for you today and whatnot everybody's happy but if i was supposed to do eight solid hours for one
Starting point is 00:06:30 person all the time they'd be what are you doing and uh i'm trying to get myself into a mood where i can be really good at your stuff leave me alone that wouldn't work so how long have you been running your own business, been independent now? So we started it in 1986, I believe. I was working. I had graduated, but they were going through a downturn, and they were going to lay people off for the first time ever, and there was a voluntary program. And I wanted to do grad work, so I thought, hey, I'll take this bribe, and I'll go do grad work.
Starting point is 00:07:03 But after you've been working, a graduate student stipend doesn't feel like a super luxurious life. So we started the consulting company to do stuff evenings and weekends to supplement that. So that was 1986, so more than 30 years now. And then how many years into being self-employed did you realize you were broken and could never go back to a regular job? That particular wisdom took me a little longer to achieve. I was probably a crummy employee before I realized I was a crummy employee. Okay. Well, Kate, we have a couple of news articles to discuss. Feel free to comment on any of these and then we'll start talking to you more about your recent talks and your
Starting point is 00:07:43 Pluralsight course and all that, okay? Sure. Okay. So this first one is an announcement from the Visual C++ blog, and we've talked a couple times before about VC Package, but now they are announcing that VC Package, their C++ library
Starting point is 00:07:59 manager, is available on Linux and macOS as well. Yeah. Yeah, pretty exciting. And it says that this was like their most requested feature from users of VC package. And I guess now that they have Visual Studio Code to enable developers to use Visual Studio on Linux and Mac, this kind of makes sense as the next step
Starting point is 00:08:22 to give them VC package support. So just to clarify for the sake of our listeners i have not yet tried vc package you have not yet either rob no and kate nope although i have been in the room with people who have and who say really nice things oh that's good yeah um i i understand this is like not a solved problem. You know, the world of package managers is a world of pain and hurt. So anything that gets a little more consistent has got to be better. And I'm more motivated to learn something that's cross platform. Right. Absolutely. Yeah. Well, I asked that question as a bit of a segue into the next news article which is conan 1.3.0 has been
Starting point is 00:09:07 released right and conan i believe has always been cross-platform it has i have not yet tried conan have you rob no i have not yet tried conan and kate uh you haven't okay so we all agree that package management is a problem but none of us have actually tried them yet. Like, someone needs to use these. And people must be using them. You know, I think if you're, in my case, I'm in a company, and our code base has been established for a while, and we kind of figure out package management on our own,
Starting point is 00:09:43 so we're not really looking to change it over right now. I think it's probably more of a necessary thing if you're starting a new project and you want to, you know, maybe do things the right way. Yeah, I think that's definitely the case. I have a lot of clients with 20-year-old codebases. They figured out how to get the deployment problem solved and they put up with their pain. So to change it now is not really high on their list. But for the cool kids who are starting new things, I think they're going to want to do it from the beginning. I've been asking myself lately, since I haven't tried any of these yet, is if this is the kind of thing that I should be teaching as like best practices, like, oh, and by the way, you should be using a package manager, too.
Starting point is 00:10:25 I don't know. Yes, it's a possibility. It just means we have more stuff to learn so we can keep up, but that's our new normal, right? Right. I mean, I definitely, you know, if I might be starting some like little side projects soon, and if I do that, I definitely want to look into package managers if I find myself needing anything. Yes, the project that you talked about on CBP Chat, when was that going to air? Oh, it aired live. It did air live, yes. So you can go back and watch CBP Chat and see the project that Rob was talking about. I haven't started yet, but hope to soon.
Starting point is 00:10:59 Right. And, yeah, that's a good idea. You should use package management there and then report back to us all how well that went yeah yeah uh is there anything else we wanted to highlight with the the conan release or the or vc package i think the fact that another project from microsoft is on linux and mac os is in itself big enough news um oh the a number of packages on VC package really impressed me, just for the record. I looked for random things that I might use
Starting point is 00:11:29 in projects that I'm working on on the side right now and they were all there in VC package. The Conan release, I don't know. With VC package, they mentioned that when they first launched it, which was back at CppCon 2016, they had 20 libraries available,
Starting point is 00:11:47 and now they're up to over 900. So that is pretty impressive. Yeah. Okay, and the next article we have is a trip report from Red Hat, and this is for the March 2018 ISO C++ meeting. And this report focuses on SG1, which is concurrency and parallelism. And yeah, a couple interesting things
Starting point is 00:12:11 and perspectives in here. Talking more about executors, which Jason, I think we were saying we kind of would like to learn a little bit more about, right? Yes. Yeah. Go ahead. Oh, just looking at what things it says are barely possible for C++20.
Starting point is 00:12:31 Executors and networking. And then more likely for executors and networking is C++23. Was that Patrice's take on it as well? Did he commented on executors making it into c++ 20 i can't remember i don't remember either i'm sorry well i guess they're saying networking depends on executors so right yeah okay yeah because i remember asking patrice if networking depends on executors how
Starting point is 00:13:02 come we haven't seen more about executors yet? Something like that. Kate, you have any thoughts on this one? I just, I'm really, I'm trying to be patient because it's important to be right. But the current concurrency situation is kind of a sad one. And, you know, things would be a lot better if we had coroutines, if we had futures,
Starting point is 00:13:26 if we had executors. And then people sort of have to take a bet about how much, how close to reality any current experimental implementations are, those sorts of things. I don't want to teach threads and locks. I just don't think that's the right level of abstraction for this problem. But at the same time, what do you teach instead? Yeah. It's not so terrible maybe to find out what to use instead because you can say, I'm doing this for one project. But if you're going to teach a person and say,
Starting point is 00:13:55 this is how you do this thing, then that's potentially decades worth of decision-making right there. And I don't know what to say at the moment. Yeah, that's a really good point. Starting a new project and you want to use, yeah, manual threads and locks today, then you're, yeah, presumably you have better tools coming. Although we do have async and future, just not the async and future, I guess, that everyone wants at the moment. Well, that's the thing. So some people have some implementations. You can do coroutines, right, if you have Visual Studio, I believe. But will it be the coroutines that everyone else will end up doing? Or will you have to go and
Starting point is 00:14:35 change that code when it's official? I think coroutines will make it into 20. That's my gut. But that doesn't mean it's going to be exactly the way it is written right now. Right. Okay, well, Kate, last time we had you on the show, we were talking about the Stop Teaching C course, or talk you gave at CBBCom. Your most recent talk was at ACCU, and that was about simplicity.
Starting point is 00:15:03 What was the goal of that talk well i was very lucky with the stop teaching c course in that a number of people really took it to heart and did what i said and came back and told me that it worked and uh that was amazing i mean people who redid the way they were teaching and then said i was right which i mean i knew i was right when i was teaching it but it was it was delightful that it was it also worked for other people and so i wanted to do something like that where someone could come to me a year later and I knew I was right when I was teaching it, but it was delightful that it also worked for other people. And so I wanted to do something like that where someone could come to me a year later and say, you know what, I did what you said and it worked.
Starting point is 00:15:36 And I started thinking about how complicated a lot of C++ code is and how we're often pretty proud of that. Like, look what I did. Look how smart I am. I wrote this thing that no one else can understand. It's amazing. And I decided I was going to push back against that a little bit. So what kind of feedback did you get from the simplicity talk so far? Very interesting. Usually what happens is I'll have one small piece of advice and someone will come and say to me, that piece of advice is completely correct. Here's a horrible story about a nasty thing that happened and the solution was the opposite of that piece of advice is completely correct. Here's a horrible story about a nasty thing that happened
Starting point is 00:16:05 and the solution was the opposite of that piece of advice. And I'm delighted to hear that. And so far, I've gotten at least one horrible story for every piece of advice. So I think as a package, it is a good set of things to do. But it's as much about an attitude as it is about how many letters long your variable name should be.
Starting point is 00:16:24 Spoiler, not one letter long. But this attitude of I want someone who comes after me to know what this code does and why it does it, and I want to be transparent and obvious, and I don't mind that someone's going to say, is that all you've got? Which is something that happened to me. I made something way, way simpler and beautiful and amazing.
Starting point is 00:16:53 And someone said, wow, that's it? I thought this was a hard problem. Now, the flip side is the simple solution is not the easy solution, right? Necessarily. And so that's really what I'm digging into in this talk. So in November, in meeting C++, I talked about, you know, why complexity naturally happens. And especially, for example, why the guidelines are so darn complicated when they're supposed to help you write simple code, yet they're not the slightest but simple, which turns out to be a law of the universe and not a flaw in the guidelines.
Starting point is 00:17:22 But in this talk that I've been doing this spring, it's been really more about the mechanics of what makes simple code, readable code, understandable code compared to complicated code. So much more how to. Now, since you commented that variable should not only be one letter long, you also commented on the very long history of why we do that, right? Like, it goes back to Fortran, I believe you said. Yeah, so in Fortran, if a variable started with the letters I through N, it was an integer, and if it started with any other letter, it was a floating point.
Starting point is 00:18:02 And so calling something I made it into your N was an integer and everything in between. So, you know, it's easier to just use the letters and stick numbers after them if you have to, than to try to come up with a Hungarian notation approach to things. And I think a lot of us still do that. I mean, I still come across people who've got, you know, D1, D2, D3, F1, F2, F3 for doubles and floats. And they put like no thought into what this number represents at all. Yeah. So I can
Starting point is 00:18:29 take it too far. You know, I don't want your variable to be called total amount to be charged on this invoice including sales tax. Well, you know. Then I had someone who told me that he thought line lengths were a very bad idea, that you shouldn't restrict people to 80 characters,
Starting point is 00:18:46 because if you have 40 character variable names, then you'll naturally have over 80 character line lengths. And I can't argue with the math. Was he serious about making 40 character variable names? Yes. Oh, wow. Yes. And I can sort of see it for functions, sort of.
Starting point is 00:19:29 When functions get really long names, they're probably more than one function. But the alternative, of course, is to have a vague name, like process and update and that kind of thing. So if you want a crisp name, maybe it'll be a long name. But maybe it should be a shorter function with a short crisp name. Right. Now you just made me think about something I had not considered until, until this exact moment. If I'm writing a quick for loop and I do for int I, it's just always for int I, right? That's just what my fingers type. But if I'm not using an int, if I'm doing for size T, because I'm looping over a standard container or something, then I don't use I anymore. I type like position or something like that, or index. Like I actually type out an actual name in that case. Because you're breaking the automatic habits, right? Yeah. Sure.
Starting point is 00:20:00 So like I'm a const after person, but if you suddenly make me type code in the middle of a conversation, my fingers might type const before because they have a lot of practice doing that. I'm sure. Yes. So I think that's what's happening to you. As soon as the FOR starts, you're just on autopilot. Right. Going back to your simplicity talk for a moment, you have some exposure to other programming communities as well. And I was wondering if you thought C++ developers are more likely to create overly complicated code compared to some other programmers. Oh, sure. Because we have choice.
Starting point is 00:20:37 Right? So we can pass things by value or by reference or by const reference or by address. And we can decide that there's meaning in all of those things. I know people who say if you pass a pointer it's because it's a sink and you're expected to clean the pointer up and that's different than if I pass a reference, a non-const reference. There's layers of meaning in your choices and people from languages where you get what you get and you don't get upset, they don't have a choice. So they don't have to worry about what their choice signifies.
Starting point is 00:21:09 And some of our complexity is legitimate. So in the talk, I ask, is simple code faster code? And the answer is usually no, because that's why we make our code complicated is to make it faster. So we say, I'm going to take this by reference, maybe by const reference, to save a copy. Now that's a good choice if you're not in a copy of Lision Space,
Starting point is 00:21:29 you're taking a parameter or something. But now there's more punctuation in the call, right? In the declaration of the function. Or I'm going to do this to save that. And whatever I do, I'm making my code a little bit more complicated for a good perf reason. And as long as it is a good perf reason, I'm fine.
Starting point is 00:21:44 I don't want you to make simple slow code or simple code that doesn't do what it's supposed to do. But in other languages, you know, you don't have that option. So there's only one way to do it. So it's simple. In other slower languages. I had a Python person say, you know, everything you're saying to do is what we do in Python. And I thought, well, I don't know that's necessarily true. For example, I don't think in Python you have this rule like always call the standard library if you can.
Starting point is 00:22:13 But especially not the C standard library. But, I mean, that's one of the ways to make your code simpler, right? Instead of making someone muddle out what your loop does, call a function with a name, like accumulate or transform or copy unique. And that says what your code does better than someone wading through the loop by hand and figuring it out. Yes. So in your meeting C++ keynote, you talked about common, what we think of as common C++ idioms like RAII, and still running into developers who aren't familiar with them and aren't used to using the language
Starting point is 00:22:47 to write simpler code. It seems like you're building on a theme here over your last few talks. And do you still run into people that don't know like R-A-I-I and that kind of thing? Oh, sure. Absolutely.
Starting point is 00:23:00 And I was surprised that the reaction to my CppCon talk about the guidelines out of people who'd never heard of mutable, which is 25 years old. Any part of the language, there's people who've never heard of it. You can certainly find a ton of people who are not allowed anywhere near the algorithms header because the standard library, well, insert anecdote from 1993, like sometimes literally from 1993. And that's why they still can't use it okay that's
Starting point is 00:23:26 a tough life but i guess that that happens to people um for me part of the trick is you can't just use an idiom you have to use a well-known idiom you can't just use a library function you have to use a library function you can count on people recognizing and that's actually harder so it's reasonably difficult to do a Sean and say this is obviously a rotate but it's even more difficult to answer the question of hmm does my whole team know what rotate is or if I use a rotate here you know am I now doomed to drawing boxes on the whiteboard with arrows pointing out what it does for the rest of time so that's actually a trickier thing so that's an interesting question, because I've had conversations with some teams lately about how much documentation you should
Starting point is 00:24:11 put in your code. And I argue, well, okay, if this is something that is not a common idiom, then you should probably document why you needed to go outside the norm here. There should be a comment there. But I mean, like, are there teams where documenting that you're using RAII is something that needs to be done for future readers of the code in that company? Or is that now what happens in this situation? So I've definitely seen comments that say, no need to clean up the file lock handle connection. Destructor will take care of it.
Starting point is 00:24:49 I have definitely seen those comments in wild source code. And now do you think that that's necessary in some teams? Or do you think that's always overkill? Yeah. Don't you ever want to just get hold of people who wrote comments and just grab them by the shoulders? I need to know what was happening. It's like someone posted a picture about do not feed the bison hallucinogenics or something. And you're like, there's a story behind this sign. And so I read a lot of comments that I'm like, why did you need to say this? Was this like a
Starting point is 00:25:19 realization that you had yourself and you put it in here just because you thought no one else knew it? Or was there in fact someone maybe on a code review saying, well, this can't be right. You're not cleaning your stuff up. And so you put in this defensive comment. You know, we give birth to new idioms all the time. This immediately invoked lambda so that you can make something a const by initializing it with a lambda. That's a cool thing. Is it going to catch on i don't know but it's like being born this year kind of thing all the way back to decades old idioms that some people have somehow still not met
Starting point is 00:25:55 so there's always going to be that question of what's your team knowledge and going back to the stop teaching c rant if your team knowledge comes from people who had a five-day course on C++, three days of which was really C, and maybe on Friday afternoon they did exceptions, they're going to be missing some idioms. Yeah. And I can see this from my own personal experience. If I were to pick up a brand new language today,
Starting point is 00:26:22 the number of comments that I would put in the code just for myself would probably be five times what I would put in two years later or something using that same language. Right. Like implicit conversions or something, you might feel the need to, to highlight them or to lampshade them. And later you'd be,
Starting point is 00:26:39 of course that's what happens there. Yeah. Right. Have you been getting good responses from the It's Complicated talk? Yes. People have been a little less life-changing maybe than Stop Teaching C, but people have been saying, like, I've been in arguments with my team, and now I feel that I'm more confident that I'm doing the right thing.
Starting point is 00:27:01 They might not be, of course. The paradox of all of this is that, you know, one person's opinion of simple is another person's opinion of complicated. So we classically say, refactor that stuff into a function so it can have a name. But you can imagine an extreme where you look at a function and all it does is call five functions, and you look at the first one and it calls five functions, and you're how many many levels down you can't remember what anything does anymore it's over abstracted you know or someone who goes all architecture astronaut on us and everything is in directions and injections um i said abstraction is your friend so clearly that's what you should be doing um you know all of this stuff taken too far the
Starting point is 00:27:42 wrong direction is just as bad as not doing it at all. And my first exposure to object oriented programming was Java in 1997. Yeah, that's right. And I, yes, abstractions all the way down. And yeah, since then, like, I seem like I've been using fewer and fewer abstractions almost, from an architectural design standpoint. Yeah. Right. I mean, they're a tool to solve a problem. So one of the examples I gave back in the guidelines talk last fall was,
Starting point is 00:28:18 if you have a function that takes four integers, it's a challenge to remember what they are, what order they're in, and so on. But somehow, if that function takes a rectangle or two points, now life is much simpler. And you can keep it straight in your head. But if everything is an abstraction, and all functions just take one argument, suddenly, that's not so good either. So on that argument, are you in the strongly typed camp of like making more types so that our bits, it's harder to screw up our function calls basically. Mostly. Yes.
Starting point is 00:28:50 Definitely. If you're making a useful abstraction, like if you're doing something involving drawing on the screen, then abstractions like point and shape and rectangle are obviously useful and relevant. If you have a function that takes eight bools, would I rather that you made some sort of a struct with eight elements that got names? Yes, because no one's going to remember how to set the eight bools in the right order.
Starting point is 00:29:16 Right. But I'm not going to run around grabbing every time there's three parameters to a function and saying that must be a thing. Let's have a meeting about what those two integers in a string really represent. I want them to be useful abstractions. Okay. Makes sense. And the argument of, you know, eight bools on your parameter list, the C++20 named initializers
Starting point is 00:29:38 will really help with calling something like that also. Yes. Yeah. I think you've got to give them names. No one's going to remember that the fourth one is for verbosity and the sixth one is for whether or not you want the wide page or whatever like this. Just not. No. Yeah.
Starting point is 00:29:52 And inevitably you'll add something or remove something and then everything gets screwed up again. Yes. I want to interrupt the discussion for just a moment to bring you a word from our sponsors. Development of qualitative software is impossible without the use of static code analysis tools. These tools enable you to detect code vulnerabilities and ridiculous typos. By the way, many developers tend to underestimate the typos issue. That's why we suggest reading the article, The Evil Within the Comparison Functions.
Starting point is 00:30:22 One of the most powerful static analyzers is PVS Studio. This tool detects errors and potential vulnerabilities in the source code of programs written in C, C++, and C Sharp. It works in Windows, Linux, and macOS environments, and it conveniently and easily integrates into the Visual Studio IDE versions 2010 to 2017. Try the demo version of PVS Studio and find errors in the code of your project today.
Starting point is 00:30:46 So we had John Kalban a few weeks ago, and he announced all the CppCon pre-conference and post-conference speakers, and he said you'll be doing a pre-conference class along with Scott Myers and Andre, which sounds pretty exciting. Can you tell us a little bit more about that? I am really excited about this. First of all, it's not a C++ pre-con. It's a speaking pre-con. So the expectation is that speaking about C++ will be highly relevant because that's probably why we're all there. But it'll be about actually doing a good job on stage and focused on
Starting point is 00:31:24 the sorts of things that... It's a pre-con, so it's the day before. If your talk was the next day that you could act on what we were telling you. So it's not going to be how to write your abstract, because that's come and gone. It's going to be dealing with the sorts of things that we've learned to deal with between us
Starting point is 00:31:42 over however many decades we've each been doing this so it's a it's a fun team to be on i tell you it's a nice sentence for people to keep putting my name with both of theirs i'm happy about that and i think i think we're really going to have a good time so if you're giving your first cpp con talk this coming fall and you're a little nervous about it you should think about signing up for this pre-conference class to give yourself a little more confidence and some tips for the talk. Yeah, I think that's good advice. Or anyone who wants to speak and maybe wants to speak in a bigger crowd than they have been doing. I think if you want to speak, you know, there's a meetup out there that is dying to hear from you. You can speak to 40.
Starting point is 00:32:21 That's true. You can speak to 40 people next week. Like it's week. The problem isn't finding who wants to speak to you. They want you to come and talk. And there's meetups everywhere. Every time I turn around, there's a new one. It's amazing. So if you've done that a couple times and you're not sure whether you're any good or not, and you want to go to a bigger crowd, this is a good thing to come to and deal with. And also, some of the things we're going to talk about are things that don't apply in a small meetup, but that do apply in a big crowd. AV failures, for example, that kind of thing.
Starting point is 00:32:54 So I apologize if this is an obvious question, but this is a for-cost class like any of the other classes, right? I presume presumed that it's actually complicated about what's going to be announced and not, but certainly if you have money, you can take the class. That's for sure. Okay, if you have money, you can take the class. But it sounds like from what you've said, if you happen to be in the Seattle area
Starting point is 00:33:17 and you have no interest in CVPCon, you might still want to take this class because it's not about c++ it's about speaking absolutely yes okay absolutely so someone who's local and for some reason listens to this podcast is welcome to come and learn how to be a better python or ruby presenter absolutely yeah i'm sure there's at least a couple people okay uh next thing i wanted to ask about was include C++. So we talked a bit about this two weeks ago after it was announced. You're involved in that group, right?
Starting point is 00:33:52 I am, and I'm really happy with what I'm seeing. It started, and I'm not making this up, it started as a pun. Guy Davidson said there should be an inclusivity group for C++, and it should be called Include C++, ha ha ha. And I said, good idea, and then we made a group. So be careful what jokes you make on Twitter. But at first, the Discord server was supposed to be for us to talk amongst ourselves about how to do this initiative.
Starting point is 00:34:22 And it's a real initiative that's bearing fruit. I mean, people are pledging not to speak at conferences that don't have code of conducts, ourselves about how to do this initiative how and it's a real initiative that's bearing fruit i mean people are pledging not to speak at conferences they don't have code of conducts but also more in terms of making changes people are helping conferences get better codes of conduct and helping employers get better job ads and those sorts of things and that was sort of the vision for the discord server but then as whenever you get 20 C++ people together, whatever we're supposed to be talking about, we started talking about C++ amongst ourselves.
Starting point is 00:34:51 And then as people started to join the group, they were like, oh, this is a guaranteed safe and welcoming nice place to talk about C++ where people aren't going to tell you that you should go into another career or I can't believe you don't know that. And so there are actually a whole pile of channels now, you know, that are not about the work of trying to make our
Starting point is 00:35:09 industry more inclusive. They're just places where our industry is more inclusive. And I love that. So aside from the Discord server, what other resources do you have available for people who are interested in helping to make the community more inclusive? So on the website includecpp.org, there's a resources page, which is articles and videos, a wonderful series about unconscious bias, where you can learn that you are probably not as diversity friendly as you think you are, even if you are part of an underrepresented group. This is a lesson that I've had to learn. I spent a lot of time in the hospitals over the last couple of years. And when a man comes in the room, I always tend to think he's a doctor. And when a woman comes in the room, I always tend to think she's a nurse. And I'm usually wrong.
Starting point is 00:36:00 And I can't seem to learn from it. I'm still surprised. Like, oh, yes, of course you're a doctor. I should have actually realized that. So learning about unconscious bias can be highly enlightening. And as well, there are things like code of conducts. There are a whole pile of already written ones where you can scribble out the name of a group
Starting point is 00:36:19 and write your own name in in crayon, and ta-da, you have a code of conduct. Or just articles and blogs that people have written about, you know, how to be taking advantage of all the people that could be in our industry rather than just a fraction of them. So I have a question about that. So the code of conduct seems really useful. If you're running a conference and you're already kind of trying to do the right things
Starting point is 00:36:43 and you have a code of conduct, do you have any suggestions for trying to get more diverse guests? And I could also maybe apply this to the podcast where do you have any maybe suggestions on how we could find more diverse guests ourselves? I think the obvious thing to do is to whenever you happen to get someone who's out of the mainstream is to ask them if they could recommend some more like you know hey do you know any other brown people or whatever but that tends not to be the greatest answer partly because it's a bit of a burden um one thing i've discovered you know i have been in the minority for decades and decades and when i was a graduate student i was on all these committees because a woman engineer was so rare that the engineering committees all wanted to say we we have a woman on our committee. And the women committees, like the status of women and so forth, they all wanted to say, we have an engineer on our
Starting point is 00:37:31 committee. And so you get really burdened in this kind of volunteer work. And that includes, you know, the volunteer work of helping a conference find more speakers. There's a certain amount of, sure, I can recommend you my friends, but, you know, most of my friends are men because most developers are men. So I don't necessarily even know more women than than you two do however there are like twitter accounts and and people and organizations who are specifically keeping lists of women speakers of speakers of color of underrepresented people on a variety of different axes so you know you want to find some of those the callback women is the one that leaps immediately to mind but i know there are plenty of others and so you want to get your call for papers out to them
Starting point is 00:38:14 and um just spread the word that you know you're happy to hear from people and people will eventually believe you. Well, since... Oh, I'm sorry. Go ahead. Well, one thing I did notice when I was in Munich last week. Yes, that was only last week. April's been pretty busy.
Starting point is 00:38:41 I was in ACCU and I did three different things in England while I was there. And then I was in Munich and I spoke at a meetup and it was packed. was a waiting list it was delightful i was happy to see so many people but a number of people told me it was the most women they'd ever seen in the room oh wow so you know they it's probably not a wild guess that they came out to see a woman speak and so the it's no balls once you have lots of women speakers once you have lots of underrepresented people speaking lots of underrepresented people speaking, then other underrepresented people say, Oh, I would be welcome there. You know what, I think I'm going to submit. And that's a good thing. So you commented that it sounded like it can get a bit tiring, always being asked to do something like you said, you're on so many
Starting point is 00:39:20 committees and whatever. Is that something that we should also be sensitive of? Like, okay, well, I know that this particular speaker who's from an underrepresented group has spoken at the last, you know, 15, I don't know, panels, maybe we should give that person a break and not invite them on the next one or, or what? Like, yeah, it's a real challenge. You know, if there's only two of you in a group, do you just take turns being the X on the panel? So when you grill the committee, you know, grill the committee at any conference consists of whatever committee members happen to come to the conference, right? It's not like the committee gets together and decides who to send to the
Starting point is 00:40:02 conference to represent the C++ Standards Committee. Right. It's more a matter of John or somebody, as far as I can tell, wandering the halls and saying, who's here and who's free on whatever night he wants to do grill the committee? But then someone says, how come whenever we grill the committee, it's five or six old white guys? And the general response is like, have you been to a committee meeting? It's not like there are all these underrepresented committee members who are not getting chosen for the panel. But on the other hand, if someone says to you, like, if you don't come and sit up on stage, there won't be any women on the stage.
Starting point is 00:40:40 You kind of feel like you have to. And then also maybe some days it's tempting to feel like, well, good, it should look bad. You should try harder. And as you were saying, maybe having that one female committee member could inspire other females in the audience to become interested in joining. Right, right. I think the specific case of the C++ committee is a really complicated one because the majority of people are sent there by their employers and their employers fund it. And that's associated with a level of seniority, associated with a level of independence that it would be unusual to find in a 20-year-old of any gender. So, you know, there's a tendency that it's established people who have good seniority at large companies with big budgets. And that changes the demographic right there. Right, right, right.
Starting point is 00:41:31 You know, I can't join. Yeah. What is it? Do you even know what the process is for a Canadian to get on the committee? Like, it's different for each country, right? It is different for each country. And I believe in some countries that you have to pay. Yeah. Do you ask? I'm pretty sure you have to pay. Yeah, I think it's different for each country, right? It is different for each country. And I believe in some countries you have to pay. Yeah, the US I'm pretty sure you have to pay.
Starting point is 00:41:48 Yeah, I think it's free in Canada. But you certainly have to buy plane tickets. You have to take the time to read all those papers. And there's more and more papers all the time. And you have to have this week in which you do no office work at all, like they're 12 and plus hour days. So there's no way you're just going back to your hotel room and catching up emails or whatever. And that's four times a year.
Starting point is 00:42:09 That's four times a year. Exactly. So it's a pretty big commitment. And companies that make compilers, companies that rely on the C++ language for their entirety of their business, they'll invest in that. But Joe's software and small engine repair is not going to. Right. Well, I've thought about it as an independent, like, you know, it would be valuable probably to join the committee and or try to make it to regular committee meetings. But with my current travel schedule, I don't see how I could
Starting point is 00:42:40 add another four weeks of travel to my year. Well, more than four weeks by the time you include jet lag. Right. And in order to keep up on all those proposals, you're probably going to multiple conferences over and above the ones you're going to now because you can meet the authors and talk to them over an adult beverage about what they're really going to do. A lot happens over adult beverages it's the truth
Starting point is 00:43:08 uh kate we uh we asked our listeners if they had any questions for you and we did get one uh from nicole asking what has been your favorite course to teach huh so now that i do the plural site courses um i love doing them i love the reach but i don't get to see people's faces um back in the day when i was doing intro to c++ courses they were really also intro to oo you know we're talking about that time pre-java where people were working in c people were working in Fortran, whatever, there was no other object-oriented language for them to learn. And you could see them start to get objects on about Wednesday of that course. Just watch their faces as they got it, as a light
Starting point is 00:43:57 bulb went off. And I loved that day. That was always the day I went home so happy. And, you know, when you're just talking into a microphone, you don't know if they're clicking like that or not. I hope they still are. But, yes, in person, the Intro to Objects course is where people really get it. In terms of my online courses, the current algorithms course that I have on Pluralsight, it's generating me a lot more emails that say I'm thinking differently now. And that's really what I want.
Starting point is 00:44:32 I think there are lots of ways to learn the syntax of a for loop. I think if someone's going to spend some time with me and learn something, that it'll have an impact on the way they design, the way they plan, not just how they type their code. And the algorithms course, I think, does that. Does that one be subtitled How to Think Like Sean Parent? That's probably what it should be, yes. It's called Beautiful C++ and then Something Something Algorithms.
Starting point is 00:45:00 And the plan is that there will be other courses that start beautiful C++ where we'll tackle one specific subset, one corner, and talk about, from a point of view of elegance and simplicity and understandability, not just what's the syntax of while or what does the fall-through attribute mean. So when you said we, are you collaborating with other Pluralsight instructors, or did you mean we like in the royal sense? Actually, I would be really happy if there were other Pluralsight instructors who wanted to write something called Beautiful C++. Insert clever subtitle here. Yes, I think that would be great. Do you want to tell us a little bit more about your latest Pluralsight course? I can't remember now. The last six months have been a bit of a blur. You have gone to a lot of conferences in the last six months.
Starting point is 00:45:51 I think your most recent one is the C++ Fundamentals course, right? Oh, yes. I updated C++ Fundamentals. Thank you. It was really old. It was like six years old, and so much has changed about the way that Pluralsight puts courses together, but also about C++ itself. You know, in 2011, we had just got C++ 11. And we weren't even exactly sure about what you used for what. And so since then, we've had 14, we've had 17, we've had some, you know, fix ups of missing things like make unique. And so I updated the whole course to be, I think, easier to learn from. The old version of the course, there would be like a half-hour demo
Starting point is 00:46:30 and just talking with code on the screen and some really important points that weren't on any slides, which makes it hard to review later. So it's more visual now. It has more diagrams. It has more summaries of what you saw in the demo. The demos are shorter. And it's right up to date all the way to C++ 17.
Starting point is 00:46:47 So I'm really happy about that course. Before that I updated my Stack Exchange course. There's been a lot of talk lately about Stack Exchange and the atmosphere, especially on Stack Overflow itself of not welcoming new people, of the snarky comments that get a lot of upvotes. And the reason I wrote the course was exactly to try to tackle that problem. People who don't know how Stack Overflow works wade straight into it, like face first into a spinning fan blade, and then are confused when they get hurt.
Starting point is 00:47:20 So, I mean, people who come and say, I'm stuck using this dumb product from Microsoft, and I'm trying to do this, and it doesn't work, and I hate it, and someone needs to tell me why. And, you know, your audience of people who are going to tell you why are people who like that dumb product. And how have you motivated them now, right? You've just sat around insulting them and their product. So maybe they'll just move on to the next question, answer someone else's question. So I wrote a whole course about that, about how do you write a good question? How do you manage your question? What do you do when people leave your comments? What do you do when people downvote you? What do you do when someone says
Starting point is 00:47:58 your question is a duplicate? It's probably the lowest traffic, or second lowest. I think my Windows 8 programming in C++ is lower traffic. It's not a high traffic course, but I really wish it was because a lot of the perceived toxicity is a culture clash and it comes from really not understanding the paradigms that work. And so, for example, if someone says your vote,
Starting point is 00:48:23 your question is a duplicate, that feels like an insult. It feels like you're being told that you're stupid and you should have searched. And instead, they're really kind of giving you a gift, which is, hey, your answer's already here. You don't even have to wait for someone to answer you. Go look over here. There's five really great answers already. That should be a thrill, but I don't know anyone who's ever thrilled when their question is closed as a duplicate, including me. I mean, I have to learn that too. Right.
Starting point is 00:48:46 I see that your C++ course on Pluralsight, it's part of C++ Path. So there's a whole bunch of courses. It seems like about half of them are from you, Kate. I wish that we had more C++ authors. Honestly, all the other authors tend to get hired away. I think other companies are like, wow, that person knows their stuff. But as we previously mentioned, I would be a crummy employee, so I'm not going to get hired away. But the path is trying to take people from maybe having never programmed.
Starting point is 00:49:17 I have learned to program in C++ for someone who has no programming experience at all, up into more advanced things. So you don't start by taking the advanced course. You work your way up. And it's especially handy in enterprises where they just ask everybody to start at the appropriate place and know they'll all end up at the same place. Yeah, the other kind of prolific Pluralsight C++ course author seems to be Kenny Kerr,
Starting point is 00:49:41 and of course he's working for Microsoft now. Yes. You know, I'm glad he's doing that. I think he's done some really cool things. When you say, of course we had to extend the language, the things we wanted to do could only be done with language extensions. And Kenny comes along and says, I can do it with a library. That's pretty amazing.
Starting point is 00:50:02 And for the six and a half people left who want to write to target only windows but it you know just as a technical accomplishment to be able to create that mapping is a very impressive technique yeah okay is there anything else you wanted to talk about today, Kate? Let me just run through my head. I think I just want to encourage people to put themselves out there where they can. People literally come to me and say, I wish I could be a technical tweeter. And you're both on Twitter, right? There's no license. You know, nobody comes along and checks to see if you're allowed on Twitter, right? There's no license. Nobody comes along and
Starting point is 00:50:46 checks to see if you're allowed to have an opinion about C++. And just start tweeting stuff or start retweeting things and then chime in on the responses. There's plenty of people tweeting things that are really wrong. So even if you tweet something that's really wrong, you're just part of the crowd. You'll get better. Everyone gets better. I'm probably embarrassed by my old tweets if I was silly enough to look at them. So people keep asking me, how can they get started? And the answer is start. So I'll take this moment to say that. The biggest barrier to entry is usually your own kind of self-imposed barrier. I think we mentioned before when we had you on the first time, Kate, that you had several people going up to you and saying,
Starting point is 00:51:25 hey, I heard you on.NET Rocks. I wish there was a C++ podcast. And I was one of those people, and I just went ahead and started it. And look what's happened. It's amazing. And our community is growing, and it's growing because of people who are brave enough to do something. I'm glad you did. Yeah, me too.
Starting point is 00:51:43 Well, I'm glad we were able to have you on the show again today, Kate. Where can people go to find you online or to find what else you've been working on? My domain is gregcons, the first four letters of Gregory and the first four letters of consulting. I have a blog on gregcons.com, but I'm really bad about updating it. But my Twitter handle is also gregcons and I tweet most stuff that I'm doing. And if I do blog, I'll also tweet it. And if you search for me on Facebook, I think it might be something like kate.gregory.public, but you'll recognize it when you found it. And I do also occasionally share links there. Okay. Well, it's been great having you on the show today, Kate.
Starting point is 00:52:21 Thanks for coming on. See you soon. Thanks so much for listening in as we chat about C++. I'd love to hear what you think of the podcast. Please let me know if we're discussing the stuff
Starting point is 00:52:31 you're interested in. Or if you have a suggestion for a topic, I'd love to hear about that too. You can email all your thoughts to feedback at cppcast.com. I'd also appreciate if you like CppCast on Facebook
Starting point is 00:52:42 and follow CppCast on Twitter. You can also follow me at Rob W. Irving and follow CppCast on Twitter. You can also follow me at Rob W. Irving and Jason at Leftkiss on Twitter. And of course, you can find all that info and the show notes on the podcast website at cppcast.com. Theme music for this episode is provided by podcastthemes.com.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.