All posts in "Expressive code"

Coding Styles With Exotic Constraints

Published February 25, 2020 - 0 Comments

This article is NWH, standing for Not Written Here. The concept of NWH is inspired from the NIH (Not Invented Here) syndrome which consists in refraining from using existing code from outside the company and reinventing the wheel every time. Just like it is good practice to look out for solutions developed elsewhere, we’re going […]

Virtual, final and override in C++

Published February 21, 2020 - 0 Comments

C++11 added two keywords that allow to better express your intentions with what you want to do with virtual functions: override and final. They allow to express your intentions both to fellow humans reading your code as well as to the compiler. However, as we will see, the intention of override is super useful, but the intention of final… […]

How to Combine Functions with Logical Operators in C++

Published January 31, 2020 - 0 Comments

In C++, most STL algorithms can use one function to perform their job on a collection. For example, to extract all the even numbers from a collection, we can write code like this: auto const numbers = std::vector<int>{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; auto results = std::vector<int>{}; std::copy_if(begin(numbers), end(numbers), back_inserter(results), isMultipleOf2); Assuming […]

The Shapes of Code

Published January 14, 2020 - 0 Comments
shape of code

Every piece of code we write is unique, or pretty much. However, there are things that are common in a lot of code, even across various codebases, and even across various languages: the physical shape that code has. Beyond the mere visual aspect of code, the shape of a piece of code can carry information […]

The Dangers of Coupling and How to Avoid Them

Published December 31, 2019 - 0 Comments

This article is NWH, standing for Not Written Here. The concept of NWH is inspired from the NIH (Not Invented Here) syndrome which consists in refraining from using existing code from outside the company and reinventing the wheel every time. Just like it is good practice to look out for solutions developed elsewhere, we’re going […]

How to Write a Condition With Interdependent Variables

Published December 13, 2019 - 0 Comments

Sometimes, the simplest requirements can be tricky to code in an expressive manner. For example, I recently had to code up some logic to determine if a transaction consisted in paying money or receiving money. To determine this, the transaction has two relevant parameters: the price of the transaction, that can be positive or negative. […]

Don’t Make Your Interfaces *Deceptively* Simple

Published December 10, 2019 - 0 Comments

Just because we can provide an interface doesn’t mean that we should. At least this is one of the takeaways that I got from from Howard Hinnant’s opening keynote at Meeting C++ 2019. In this impressive keynote, Howard made a presentation about <chrono> and the host of features it brings in C++20. But beyond showing us […]

NEW! Get a Mini-Ebook on a C++ Topic Every Month

Published November 26, 2019 - 0 Comments

There is just too much to know to master programming in C++. I’m not talking about putting together small programs in C++. I’m talking about mastering the skills that are required to create industry-level software. When it comes to the code itself, you need to master at least the following things: the core concepts of […]

1 5 6 7 8 9 20