Hello, my name is Jonathan Boccara. I'm your host on Fluent C++. I have been a C++ developer for 6 years, working for Murex which is a major software editor in the finance industry. My focus is on C++ and particularly how to write expressive code. I'm happy to take your feedback, don't hesitate to drop a comment on a post, follow me or get in touch directly !
Jonathan Boccara's blog
Getting naming right is crucial to convey your intentions through code. Indeed, the compiler doesn’t care if your names are clear enough. It is just for the people who work with you. And that includes you.
The clarity of the names in a piece of code has a strong impact on how easy it is to work with that piece of code. And how easy it is to work with it has in turn a strong impact on how much time one needs to add a new feature or fix a bug in the code. Which has an impact on how profitable a software company is, and how happy the people that work for it are.
In this week’s video, you’ll see more tips on naming to avoid bad names and write good ones. They are meant to help readers of your code, including yourself, figure out what your code is doing.
In particular, we see how to avoid too big names, by cutting them down in a sane way. That is, by making them clearer.
Also, we get into what names are illegal in C++. Those are important to know because, even if the compiler will let you get away with them, your program may have undefined behaviour at runtime if you use them!
I drew some of those tips from the reading of Code Complete, I gleaned other from advice coming from people I’ve worked with, and have thrown in some more that I’ve found helpful in my code.
I hope those tips will be helpful to you. If you have other naming habits that you use to make your code clearer, don’t hesitate to share them and make other people benefit from them. The comment section below is all yours.