Saturday, June 17, 2023
From time to time I think it's wise to summarize the courses I have on Pluralsight. There is a link on the side you can use to get a free trial if you want to take any of these. Because I redo most of the courses each time a new version of C++ becomes widespread, there are quite a few courses with similar names. Here's a quick summary.
If you are using the latest version of a major compiler, you are on C++20. These courses have been updated for C++20:
- C++ 20: The Big Picture This is an overview covering "what is C++?" and "what is it used for?". If someone has suggested you learn it, start here to understand why you might want to. The title means that it's up to date to C++20, not that it only covers C++20. The actual content is equally applicable to older versions of the language.
- C++20 Fundamentals is more properly "the fundamentals of C++ including things that were introduced in C++20". This is an introduction to the ideas, syntax, and standard library. At seven and a half hours it can't cover absolutely every corner of the language, but it does cover what you need to call yourself a C++ programmer, and get started writing real code. This course assumes you already know how to program. If you don't, try Learn to Program with C++ 17 which will cover the building blocks of programming languages like loops, functions, and objects while teaching the C++ syntax and library. Afterwards, you can take Fundamentals to fill in any gaps.
- C++20 Algorithms Playbook again covers up to and including C++20, so plenty of things that have been around for decades, but it does have a lot of content that is C++20 only, because ranges made such a big difference here. If you're not on C++20 yet, take the C++17 version, listed below. Both versions are designed to convince you to stop writing raw loops and start using the many useful functions provided in the standard library. I demystify iterators and show you the benefits of using library code instead of rolling your own.
If you're not on C++20 and are wondering if you should be, try What's New in C++20.
It will show you what you have to gain by updating to the latest version of your compiler (and how to try things out if your compiler doesn't support something yet.)
If you're on an older version and can't move, you should still use the latest iteration of Fundamentals. There's very little C++20 only material in there, and it's all signposted, so you can just move past that part if you need to. For the algorithms course, Beautiful C++ 14: STL Algorithms
is the older version that doesn't have all the ranges additions.
Some of my courses are really not version specific, but apply to particular kinds of work you might need to do.
I plan to update everything for C++23 when the compilers have support for the new features. There are a few things coming I'm really looking forward to!
Friday, November 05, 2021
It's true! I helped to write a book! Another book! (Do not ask me what this brings the total to, I truly do not know.) This one is about some of the C++ Core Guidelines.
Opinions vary on when it will be available: maybe the last week of 2021, maybe early 2022. You can pre-order from the publisher if you can't wait. There will be both an ebook and a paper version.
It's Guy Davidson who wrote it really; I have been a sort of editor and suggester and inspirer most of the time. If you liked my CppCon 2017 talk, 10 Core Guidelines You Need to Start Using Now, you will love this book, and not just because it's three times as many guidelines. Guy has included explanations of the 30 guidelines we chose, along with plenty of examples, the occasional diagram, and stories that put them into context and show you why it matters how you write certain constructs and why you should avoid some aspects of the language entirely. We are delighted that both Bjarne Stroustrup and Herb Sutter, who edit
the Core Guidelines, reviewed the book, gave us helpful comments on the
text, and wrote a foreword and an afterword for us as well.
I learned things writing this. You will learn things reading it. It may well change the way you approach code. That is one of our goals. The other is to get you trusting the guidelines and dipping into them when you have decisions to make about how to implement something. If these 30 are useful and good (and they are!) then imagine what else is waiting for you when you're ready!
Please spread the word far and wide.
ps: the full title is quite a mouthful. We're thinking of RainbowFlower as a nickname for the book. What do you think?
Tuesday, November 20, 2018
My latest Pluralsight course is live!
I start by talking about strategy - what parts to update, what general approach to take, and so on. Then I present a number of specific tactics, like using the preprocessor less and the compiler more, actually using C++ instead of just C, and using C++ features that were added in C++ 11, C++ 14, and C++ 17. I show you code examples for the changes I am suggesting, and explain why specific changes produce code that is more readable, understandable, and maintainable.
As always, if you don't already have a Pluralsight subscription, feel free to click the large white box in the margin and start a free trial. I hope you like the course, and tell your friends about it too!
Tuesday, May 08, 2018
I had a very busy March and April, with travel and with preparing for those trips. So I forgot to mention that my latest Pluralsight course is now live! It's called C++ Fundamentals Including C++ 17 and it's an update of my C++ Fundamentals course. Here's what I changed:
- I made most of the demos a lot smaller, by breaking them into pieces or by putting some of the material on slides instead
- I made the slides less text-heavy, again mostly by splitting them up
- I added diagrams to explain things that needed them
- I added some C++ 14 and 17 content
- I switched to a consistent "const after" style (aka east const)
- I double checked every line of code for good style and consistency
I'm really pleased with the result. If you've already taken C++ Fundamentals you probably don't need to take it again, but I hope you'll recommend to others that they take the new one. I think it makes learning C++ less daunting than some other approaches do.
ps: don't have a Pluralsight subscription? There's a link over there -------> for a free trial.
Tuesday, February 13, 2018
The schedule for ACCU has now been released, and the Feb 20th early bird registration deadline is approaching, so I thought it was a good idea to mention my session there.
Simplicity: not just for beginners
Many people say that simple code is better code, but fewer put it into practice. In this talk I’ll spend a little time on why simpler is better, and why we resist simplicity. Then I’ll provide some specific approaches that are likely to make your code simpler, and discuss what you need to know and do in order to consistently write simpler code and reap the benefits of that simplicity. Code samples will be in C++ and some material will be C++-specific.
I'll be joined by dozens of amazing speakers and the topics will be wide-ranging. It's not all C++, and I'm looking forward to a little mind-expanding from some session I didn't expect to do so. The pub quiz and lightning talks will also be good fun. April 11th to 14th in Bristol - will I see you there?
Thursday, October 19, 2017
In 2016 I didn't speak at conferences because I was ill. I really enjoyed getting "back in harness" at CppCon this year (my Guidelines talk
has been uploaded already, if you missed it) and I am happily looking forward to my next two conferences.
In Berlin I will deliver one of the keynotes for Meeting C++
. It will be one of those opinionated talks with stories in it, plus code of course. I love giving those kinds of talks and they're typically well-received, so I am expecting to have a great time. This will be my first time at Meeting C++ and I know it will be a great conference.
The next week, I will be at the 2017 C++ and System Software Summit
in Beijing. 8 tracks and over 500 attendees; this is a big conference. I've never been to Asia before, so I am very excited to meet a lot of new people (and some I've known for a while, the speaker circuit is like that) as well as seeing new places and experiencing a new conference.
I'm still thinking about what I will submit to ACCU
for the spring. I prefer to do a new talk for each conference or at least to update existing talks dramatically. I will need to make up my mind before I leave for China!
Friday, July 21, 2017
I am happy to announce that my submission to CppCon has been accepted!
10 Core Guidelines You Need to Start Using Now
The C++ Core Guidelines were announced at CppCon 2015, yet some developers have still never heard of them. It's time to see what they have to offer for you, no matter how much C++ experience you have. You don't need to read and learn the whole thing: in this talk I am pulling out some highlights of the Guidelines to show you why you should be using these selected guidelines. For each one I'll show some examples, and discuss the benefit of adopting them for new code or going back into old code to make a change.
Beginners who find the sheer size of the language and library daunting should be able to rely on the Guidelines to help make sane choices when there are many ways to do things. Experienced C++ developers may need to leave some of their habits behind. Developers along this spectrum could benefit from seeing what the Guidelines have to offer, yet the guidelines themselves are just too big to absorb all at once. My examples will be chosen to be beginner-friendly and the focus will be on what's in it for you: faster code, less bugs, and other tangible benefits.
I am so looking forward to seeing "my tribe" again in Bellevue this year. I'm going on the field trip too! If you haven't registered yet, get on that!
Friday, April 29, 2016
I've started a C++ column in Visual Studio Magazine. I'm sure you've read plenty of C++ columns in your time - I sure have! I wanted this one to be a little different. So, here's what I've decided to do. For each column, I choose a guidelines from the C++ Core Guidelines, and then explain it. But the twist is that I'm not going through the guidelines from top to bottom - I'm picking guidelines whose explanations require a little language knowledge.
The first column just sets the stage and explains what I'm doing, and gives you a link to the Guidelines. The second, Don't Cast Away Const, explains the guideline, but also the consequences of const-correctness, a typical situation where you might find it hard to stay const-correct when you make a performance tweak to a running system, and the correct use of the mutable keyword. Not bad for explaining a four-word guideline!
I have a number of columns already written and plans to write more. Please check them out and spread the word!
Thursday, March 24, 2016
My latest Pluralsight course is live! It's called First Look: C++ Core Guidelines and the Guideline Support Library
and it introduces the guidelines and why you might want to use them, as well as some preliminary tool support. As always, if you need a free trial, use the link in the sidebar on the right.
Pluralsight courses now have trailers. This is my first course with one and it turned out a lot better than I expected. You don't need a subscription to watch the trailer - just go to the course page,
and over on the right side there are these downward pointing triangles next to time lengths. Click the one for Course Overview which is 1m 49s, and you'll see one entry under it that also says Course Overview 1m 49s.
Click that and the player will open and play the trailer. I did the voice recording, and some Pluralsight elves put together visuals (some are excerpts from demos) around it. I like it! Let me know what you think.
Monday, December 07, 2015
The first keynote at CppCon this year was Bjarne Stroustrup (who invented the C++ language) announcing the C++ Core Guidelines. They are on Github and once he announced them, as Herb Sutter reported in the second keynote the very next day, they quickly became a trending topic across all languages. Here is a description of the guidelines from there:
The C++ Core Guidelines are a collaborative effort led by Bjarne Stroustrup, much like the C++ language itself. They are the result of many person-years of discussion and design across a number of organizations. Their design encourages general applicability and broad adoption but they can be freely copied and modified to meet your organization's needs.
The aim of the guidelines is to help people to use modern C++ effectively. By "modern C++" we mean C++11 and C++14 (and soon C++17). In other words, what would you like your code to look like in 5 years' time, given that you can start now? In 10 years' time?
The guidelines are focused on relatively higher-level issues, such as interfaces, resource management, memory management, and concurrency. Such rules affect application architecture and library design. Following the rules will lead to code that is statically type safe, has no resource leaks, and catches many more programming logic errors than is common in code today. And it will run fast - you can afford to do things right.
To me, these guidelines are the key to getting across my fundamental message that C++ does not have to be hard, scary, complicated, or dangerous. The language may still say “it’s your foot!” but the guidelines, and the tools they can drive, are quite the opposite.
You probably know that Visual Studio has a static analyser built in. (You should, anyway, I’ve blogged about it.) It will catch things like this:
int* p = nullptr;
*p = 10;
But it doesn’t mind things like this:
int* p2 = arr;
Two lines, two violations of the guidelines – I’m not initializing any of the elements of arr, and then I am using its address as a regular old pointer. Now, there’s nothing wrong with regular old pointers – some people have got quite a hate on for them with the rise of genuinely smart pointers, but pointers are fine. Using pointers to control lifetime isn’t fine, because it’s impossibly difficult. But pointers themselves are fine. What’s not fine here is the “decay” of an array into a pointer – folks from other languages don’t expect that at all, and some marvelous bugs have hidden behind this simple bit of helpfulness from the compiler. So there’s a guideline that says don’t do that. Specifically:
(I’m giving you a picture of code because if you want to copy and paste you should go to the live, always updated, guidelines on github.)
This guideline is part of a “profile” – a particular set of rules that are designed to be enforced and that are supported by tools. Well, when I say tools I might be overstating the case a little. There’s just one tool at the moment, but that could be enough!
This tool, C++ Core Checker, is on the NuGet Gallery. You don’t have to get it from there though. You get it, and use it, from inside Visual Studio 2015. Any version will do. If you don’t use Visual Studio normally, just get and install the Community Edition, which is free and is ok to use for commercial purposes, from https://www.visualstudio.com/ . (Need the fine print? if you’re using it as a person, you can do whatever you like. If you work for a company with less than 250 PCs and less than a million dollars US in revenue, again you and up to 4 of your coworkers can use it for whatever you like. If you work for an “enterprise” company then any and all of the employees can still use it for learning purposes or to work on open source.) Note that Visual C++ isn’t part of the Typical install, so you’ll need to choose Custom and select Visual C++:
So once you have Community Edition or some edition of Visual Studio, make a console application and put in the two bad lines of code. Build it and then also run static analysis on it (On the Analyze menu, choose Run Code Analysis, On Solution.) You won’t get any warnings or errors. That’s your pre-guidelines life. You’re doing something inappropriate and nobody is telling you.
Now, add the checker to your solution. This is solution-by-solution, not a change to how Visual Studio does static analysis. On the Tools menu, choose NuGet Package Manager, Package Manager Console. In the console window that appears, type Install-Package Microsoft.CppCoreCheck and press enter. You will see output like this:
Attempting to gather dependencies information for package 'Microsoft.CppCoreCheck.14.0.23107.2' with respect to project 'ConsoleApplication1', targeting 'native,Version=v0.0'
Attempting to resolve dependencies for package 'Microsoft.CppCoreCheck.14.0.23107.2' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Microsoft.CppCoreCheck.14.0.23107.2'
Resolved actions to install package 'Microsoft.CppCoreCheck.14.0.23107.2'
Adding package 'Microsoft.Gsl.0.0.1' to folder 'c:\users\kate\documents\visual studio 2015\Projects\ConsoleApplication1\packages'
Added package 'Microsoft.Gsl.0.0.1' to folder 'c:\users\kate\documents\visual studio 2015\Projects\ConsoleApplication1\packages'
Added package 'Microsoft.Gsl.0.0.1' to 'packages.config'
Successfully installed 'Microsoft.Gsl 0.0.1' to ConsoleApplication1
Adding package 'Microsoft.CppCoreCheck.14.0.23107.2' to folder 'c:\users\kate\documents\visual studio 2015\Projects\ConsoleApplication1\packages'
Added package 'Microsoft.CppCoreCheck.14.0.23107.2' to folder 'c:\users\kate\documents\visual studio 2015\Projects\ConsoleApplication1\packages'
Added package 'Microsoft.CppCoreCheck.14.0.23107.2' to 'packages.config'
Successfully installed 'Microsoft.CppCoreCheck 14.0.23107.2' to ConsoleApplication1
This changes your project settings so that analysis runs this Core Checker for you. Repeat the analysis step and this time the new tool will run and you will get output like this:
------ Rebuild All started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
ConsoleApplication1.vcxproj -> c:\users\kate\documents\visual studio 2015\Projects\ConsoleApplication1\Debug\ConsoleApplication1.exe
c:\users\kate\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp(9): warning C26494: Variable 'arr' is uninitialized. Always initialize an object. (type.5: http://go.microsoft.com/fwlink/p/?LinkID=620421)
c:\users\kate\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp(10): warning C26485: Expression 'arr': No array to pointer decay. (bounds.3: http://go.microsoft.com/fwlink/p/?LinkID=620415)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
Where it says "type.5" and there's a link, that's to the specific rule in the "type" profile that this code breaks. And where it says "bounds.3", the same - I showed a picture of bounds.3 up above.
Isn’t that great? Come on, it’s great! The tool will add more rules as we move through 2016. I’m going to have a lot more to say about the Guidelines as well. But this is a great place to start.Why not point it at some of your own code and see what happens?
© Copyright 2023 Kate Gregory
Theme design by Bryan Bell
newtelligence dasBlog 2.3.9074.18820
| Page rendered at Sunday, December 03, 2023 12:05:28 AM (Eastern Standard Time, UTC-05:00)
On this page....
Pluralsight Free Trial