C++ Design Tip: Objects should not point back to an object that owns them

In today's post, we will be advising against storing back-pointers in objects. This is something that we can find in our code, and which unfortunately leads to bugs, decreased performance, code that is harder to reason about and cannot be used in generic algorithms such as the STL ones. We will first describe these numerous... Continue Reading →

Why template parameters of dependent type names cannot be deduced, and what to do about it

Following the presentation a type by any other name at the CppCon, a great talk that shows how to incrementally refactor code using tooling and type aliases, I got interested in one of the observation made by Jon Cohen: template parameters of dependent type names cannot be deduced. This short post aims at describing this... Continue Reading →

My CppCon 2017 Trip Report – 10 great talks to watch and learn from

The last edition of the CppCon 2017 just ended. As for the previous edition, it was a real pleasure to be there, discussing with talented and curious fellow developers, and watching great talks. In particular, I got the feel that the conference offered more diverse talks than the previous edition. Inspired by the trip report... Continue Reading →

Monoids: what they are, why they are useful, and what they teach us about software

Monoids are a pretty interesting concept in software development. Monoids are everywhere. Monoids are simple yet powerful. And Monoids have a lot to teach us about software, in particular about composition and building powerful abstraction. This post will take you through a small tour of what Monoids are and are for. We will first define... Continue Reading →

How to make a better polymorphic clone in modern C++

This short port is an answer to the blog post of @JoBoccara on how to make a polymorphic clone in modern C++ in the presence of smart pointers. The goal of this post is to explain in which aspects the solution of the OP is not really satisfying, and to provide what I believe to... Continue Reading →

A follow up of the study of 4 Money class designs: why not having currencies as type parameters?

In the previous post, we went through a comparative study of 4 different designs for a Money class that represents an amount of money. To do so, the Money class groups an amount with a currency (its unit) and implements a safe arithmetic which takes into account the currencies. This article received a quite positive... Continue Reading →

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: