Logo

Blog


5 Things you and your C++ team can Do Differently

In the past months, I received requests from clients like:

  • "Our team needs to switch to C++ 17. We need a way to have them apply the new elements safely."
  • "We have a large code-base and plenty of developers. We are looking for a way to distribute the knowledge as well as do's and don'ts."
  • "We're starting a new C++ project. Can you recommend which standard we should use?"

The answers, of course, are highly individual. Especially if it comes to implementing new processes into your organization or coaching people, there is no single path to success. But there are a few things you can do.

These five resources may help you:

1. Find a communication channel that fits the needs of your team

I worked on various projects, and getting knowledge across teams was always hard.

Sometimes it helps to maintain a wiki. Sometimes a blog is the better choice. The critical question is: "Why would you or one of your colleagues look there for an answer?"

Let me introduce you to a project to see what knowledge management could look like. Abseil is a project run by Google. Mainly it is about a library of google, something I will not explore further. What they also do in Abseil:

They share what they call a "tip of the week" (abseil.io). They post one article per week, although there is no claim for them to publish a tip every week. But one tip per week is the maximum number of posts so that readers have the time to digest the information. They number these tips and use them in code reviews later to point out what can be improved and how. The main benefit is that the information is consistent.

The approach Abseil uses could be beneficial for your team, too. Everybody reads the same information. Whereas you also create a reason why colleagues should consult your documentation resource regularly. Newcomers will understand the requirements of your environment more easily. While less experienced developers can take the time they need to read and understand the situation and why they should do it a specific way. They also know where to circle back to if they approach the same situation again but are unsure about their solution.

A joint communication channel helps you to find out about your next steps. Once you start seeing that a certain item pops up very often in your code review, you could think about dedicated training sessions. Or you can decide that the item must be adjusted to the newly adopted standard.

2. Use your agile frameworks to improve your C++ code

Most of you work in an agile environment these days. You can use it for more than just managing a project. Nothing prevents you from dedicating one daily a week to C++, which is used to present a short C++ snippet. This can either be

  • a new API someone wrote;
  • about a trap somebody ran into this week;
  • a great piece of code someone discovered or wrote this week;
  • a new library that was added which solves X and replaces Y;
  • briefly explaining a new rule of your coding guidelines.

Having various people present different topics makes the daily more interesting and brings different angles into the discussion. We are developers, which means we love code. Nothing makes us happier than seeing a new excellent construct or a great solution to a problem. Interactive discussions work so much better than reading an email from the head of development telling you the same thing (at least in my experience).

Jonathan Boccara describes how dailies work in practice on his website Daily C++. You can also use this technique to present the same content to different teams.

3. Provide a recap of what happened this week

Over time you will hire new employees. Some will come back from maternity leave, others from a long illness.

They all have the same question: "What do I need to know." Make it easy for them to find the answer.

It can be beneficial to have a recap of what happened this week. Either for an individual module, over larger parts of the code-base, or even the entire code-base. It gives your employee who was out of the office the chance to catch up. Depending on your project, commit statistics can be helpful, much like a changelog. One example is the Linux kernel which provides them for each release, such as ChangeLog-5.10.

Be aware that filtering between important changes and noise like "fixed a typo" requires some fine-tuning.

Bigger features or changes can later be published in a blog or wiki entry.

4. How switching to C++ can work

I see a trend that companies make a switch from C to C++. Although C developers already have development experience, they are new to C++. Don't underestimate this.

It seems way too easy to switch from C to C++. But in reality, it isn't. C++ is not that simple, and it can be a nasty language. Try to mix teams and avoid having a team that consists only of C developers. A mixed team, even with less experienced C++ developers, helps both. Experienced C developers have valuable software development skills they can share with the less experienced C++ developers while learning about the C++ aspects.

5. Avoid the cost of losing ambitious developers by choosing the right standard

If you are unsure which standard to use: Choose the latest standard, which fits your organization and is fully supported by your compiler. Currently, only MSVC fully supports C++20. While all the major compilers support C++17. I think there is no reason why not to select C++17 as a standard.

Usually, compilers are not changed that often. If you have a long-running project, say +10 years, you will stick with that decision for +10 years. But in the meantime, your new employees may be educated in more recent standards, which means you cannot leverage their excellent university education because you have to train them down (not sure that is a term).

That comes with another cost:

Developers like new language features. This is what the developer folks chat about. Not being able to use them is, well, not pleasing.

Good developers may seek jobs where they can either apply or learn the latest standard features. By sticking to a very old standard, you risk losing good candidates. It goes without saying that the standard you select must support your environment and may drive your decision aside from all the above. But keep your people in mind.

Bonustip: E-Books

Thanks to ebooks, you don't need to provide much physical space for books. The electronic form makes it easier to search for a term quickly. Various authors I know switched over the last years to Leanpub, so you find a wide variety of C++ books there (including mine :-)).

I hope these tips gave you some new ideas on distributing knowledge within your team and your organization.

If you like, drop me a line, and we will talk about your situation and how we can improve it.

Andreas