Jonathan Boccara's blog

How to Define Comparison Operators by Default in C++

Published August 23, 2021 - 0 Comments

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 […]

Don’t Let Legacy Code Make You Suffer. Make It Suffer

Published August 4, 2021 - 0 Comments
legacy code refactoring

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. […]

Extended Aggregate Initialisation in C++17

Published July 17, 2021 - 0 Comments

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 […]

How to Return Several Values from a Function in C++

Published July 9, 2021 - 0 Comments

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 […]

Minor, Major and Overarching Design Principles

Published July 1, 2021 - 0 Comments

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 […]

GRASP: 9 Must-Know Design Principles for Code

Published June 23, 2021 - 0 Comments

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. […]

5 Tips to Find Your Way Around A Legacy Codebase

Published June 15, 2021 - 0 Comments
understand legacy code

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 […]

1 2 3 42