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

Kate
Thursday, March 24, 2016 1:10:15 PM (Eastern Standard Time, UTC-05:00)  #    
# Monday, February 29, 2016

I’ve been hearing that the new search and browse functionality on Pluralsight isn’t working for everyone, and that the sheer volume of courses makes some hard to find. So I thought I’d make a list of my current courses in the hope of simplifying things for those who want to learn something specific.

Visual Studio 2015: Essentials to the Power-User

This is the most recent Visual Studio course and it starts at the beginning and goes well past what most people know about Visual Studio. I’m confident that even if you use Visual Studio every day, you’ll learn something in this course that will make you more productive.

What's New for C++ Developers in Visual Studio 2015 Preview

This course was based on the preview, but works well against the RTM version of Visual Studio 2015. It’s C++-focused and just shows you what’s new compared to Visual Studio 2013.

Using StackOverflow and Other StackExchange Sites

Most developers find StackOverflow results whenever they do a web search for a particular error message, or some API they’re having trouble using. Many of them tell me that when they try to sign up and actually ask and answer questions, they have an unpleasant experience. Often, it’s because their mental model of the site does not match the way it actually works. This course will show you how it works, so you can get the answers you need and not feel rejected or hurt by the way these sites work.

Learn How to Program with C++

This course is aimed at people who have never programmed before. If you’ve programmed, in any language, consider C++ Fundamentals instead. If you don’t believe anyone can learn C++ as a first language, I’m ready to argue with you. Modern C++ is a simple and useful language that a beginner can learn and use well.

C++ Advanced Topics

This course is for the material I couldn’t fit into C++ Fundamentals. It’s presented as a number of things I want you to do, or stop doing, when you write C++ today:

  • Avoid Manual Memory Management
  • Use Lambdas
  • Use Standard Containers
  • Use Standard Algorithms
  • Embrace Move Semantics
  • Follow Style Rules
  • Consider the PImpl Idiom
  • Stop Writing C With Classes

C++ Fundamentals  and C++ Fundamentals - Part 2

These courses were written in 2011 but hold up well. Here is where you’ll learn the basic syntax of the language and how everything works, including templates, pointers, lambdas, and exceptions. Watch both parts to learn the whole language, then dive into C++ Advanced Topics to round out your C++ knowledge.

I have other courses – on older versions of Visual Studio, for example, but these are the “big” ones for me at the moment. I hope this list helps you to find them. And remember, if you need a free trial, use this link. Click Subscribe, then Start 10-Day Trial, and you’ll be all set.

Kate

Monday, February 29, 2016 12:19:13 PM (Eastern Standard Time, UTC-05:00)  #    
# 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 arr[10];        
    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
PM>

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 ------
  stdafx.cpp
  ConsoleApplication1.cpp
  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?

Kate

Monday, December 07, 2015 1:54:57 PM (Eastern Standard Time, UTC-05:00)  #    
# Thursday, November 26, 2015

If you have an MSDN subscription, you know that it provides a number of benefits besides software licenses - you get Azure hours, you can use Visual Studio Online, and so on. Those are well worth the price of the subscription. But it also gives you access to a number of Pluralsight courses, completely free. If you have a Professional Subscription, you get access to 30 courses, and if you have an Enterprise subscription, you get access to 45 courses.  (You want one of the over 4500 other courses? You'll need a full subscription, but you can buy that at 30% off, which helps.)

And yes, my latest course, Visual Studio 2015: Essentials to the Power-User is one of the ones you'll get access to. So go, check it out!

Kate

Thursday, November 26, 2015 1:29:22 PM (Eastern Standard Time, UTC-05:00)  #    
# Monday, November 09, 2015

I have a new Pluralsight course on Visual Studio called Visual Studio 2015: Essentials to the Power-User. It starts at the beginning, so if you're new to Visual Studio it will help you get started, but carries on "to 11" as it were, covering things many everyday users of Visual Studio don't know. Here are the modules, each with their length:

  1. Getting Started (42:08)
  2. Projects and Solutions (13:23)
  3. Namespaces, Folders, and Files(27:03)
  4. Understanding and Personalizing Visual Studio UI Components (26:57)
  5. Exploring Relationships in Your Code(36:41)
  6. Using Search and Find Effectively(28:15)
  7. Letting Visual Studio Help You (46:28)
  8. Basic Debugging Features (24:04)
  9. Additional Debugging Features (44:30)
  10. Working with Designers (39:37)
  11. Useful Extensions (39:54)
  12. IntelliTrace and Code Map (25:57)

If you don't have a Pluralsight subscription, click the Author link over on the right hand side of this blog - click Subscribe, then Start 10-Day trial. That should give you a good idea of how valuable the subscriptions can be. (My company buys subscriptions for my staff, and I use my free author one all the time. It's a great way to learn a new technology.)

My main goal in this course was to have Visual Studio make sense to the learner. There are so many ways to do any action that sometimes when you learn something it seems pointless, and you quickly get tired of learning an endless parade of similar features. I worked hard to put these into an order that would lead naturally through the capabilities of the tool, and put things in context. If you watch all 12 modules, you'll know more Visual Studio than most developers - and you'll have a productivity boost to show for it that should be pretty impressive! Please do give it a try.

Kate

Monday, November 09, 2015 12:18:54 PM (Eastern Standard Time, UTC-05:00)  #    
# Monday, January 12, 2015

My friend (and fellow Pluralsight author) Kathleen Dollard is coming to town, and will speak at the East of Toronto .NET User Group on "What's New in C# 6.0".

The next release of Visual Studio includes some major language enhancements that every developer should be aware of. Get up to speed on forthcoming enhancements quickly with this user group meeting from Microsoft MVP and language guru Kathleen Dollard.

Join us at 6pm at the Pickering Central Library! Please register at the Meetup page. See you there!

Kate


Monday, January 12, 2015 6:10:01 PM (Eastern Standard Time, UTC-05:00)  #