Hello, my name is Jonathan Boccara, I'm your host on Fluent C++. I have been a developer for 10 years. My focus is on how to write expressive code. I wrote the book The Legacy Code Programmer's Toolbox. I'm happy to take your feedback, don't hesitate to drop a comment on a post, follow me or get in touch directly !
Implementing comparison operators in C++ is easier said than done. Indeed, for most types, if we could talk to the compiler we would say something like: “to order them, use a lexicographical order on their members”. But when it comes to writing the corresponding code, things get more complicated. However, a classical technique using std::tuple makes […]
Fluent C++ reader Sam wrote to me asking how to make a template expression simpler. This is an interesting question and I’m grateful to Sam for bringing it up. We’re going to examine this case where template parameters became unwieldy, and see how to simplify them by using template template parameters. The case Let’s have a […]
Feeling like the codebase you’re working on is poorly designed? Wish you could focus on writing good code, rather than trudging through mud code all day long? Would life be easier if only the legacy codebase had a clearer structure? If you answered Yes to any of those questions, be aware that you’re not alone. […]
More than an exact science, designing our code is a craft (there is even a branch of software development that is called software craftsmanship). To guide us through this craft of designing our code we have guidelines that have been accumulated over the ages (or rather, decades) by software developers. 23 of them have been […]
By upgrading a compiler to C++17, a certain piece of code that looked reasonable stopped compiling. This code doesn’t use any deprecated feature such as std::auto_ptr or std::bind1st that were removed in C++ 17, but it stopped compiling nonetheless. Understanding this compile error will let us better understand a new feature of C++17: extended aggregate initialisation. The […]
Functions should take their inputs as parameters and produce outputs with their return types. This is the basics of functions interface design. This makes functions easier to understand just by looking at their prototype. It makes functions functional. But C++ only allows to return one value out of a function. What if we’d like to […]
Design principles are guidelines about how to organize and structure our code to make it manageable. They come through experience, in the general sense of the word. It can be one individual’s own trial and errors that makes them realize what options make code more simple. But in the more general sense, design principles stem […]
In order to write code that is understandable, maintainable and that stands the test of time, one of the crucial skills that we all need to have is design. What does code design mean? In my definition, doing code design means deciding which class (or more generally which component) is in charge of which responsibility. […]
Have you ever struggled to understand a codebase that was bigger than you? Most of us go through this experience more or less often in our career, and this is not a simple thing to do. Chances are you’re in this situation right now. During one occurence of the Software Craftsmanship meetup somebody was asking for advice […]
Defining a variadic pack of arguments of the same type turns out to be a deep topic as this is the fifth post and seventh technique we (I or guest writer Tobias in Part 4) discover on this topic. C++ variadic templates allow to define a parameters pack with any number of parameters of any […]