All posts in "Expressive code"

On Using Guards in C++

Published February 20, 2018 - 7 Comments
guards C++

Early return statements are a controversial topic across many programming languages. Some people find that they improve readability because they avoid carrying a result variable down the end of a function. And some other people find they constitute a danger because they introduce complexity: with them, a function suddenly has several exit doors. Today I […]

The Right Question for the Right Name

Published February 16, 2018 - 0 Comments
naming

“What’s the right name for this variable/function/class/module?” As programmers, this something we ask ourselves multiple times a day, and that is also a question that comes up often during code reviews. In this video, I’ll share with the question that I use to determine a name for something in code. And often, the answer to […]

To RAII or Not to RAII?

Published February 13, 2018 - 17 Comments
raii

RAII is a central concept in C++, that consists in relying on the compiler to call destructors automatically in certain cases. Putting appropriate code in such destructors then relieves us from calling that code – the compiler does it for us. RAII is an idiomatic technique of C++, but can we use RAII for everything? […]

Lvalues, rvalues and their references

Published February 6, 2018 - 6 Comments
lvalue rvalue references C++

Even though rvalue references have been around since C++11, I’m regularly asked questions about how they work and how to use them. For this reason I’m going to explain my understanding of them here. I think this is relevant to the topic of Fluent C++, expressive code in C++, because not understanding them adds a […]

The Most Vexing Parse: How to Spot It and Fix It Quickly

Published January 30, 2018 - 8 Comments
most vexing parse

Everyone has their little defaults. You know, that little something that they do from time to time and that gets on your nerves, even though they’re otherwise nice people? For C++, one of these little annoyances is the most vexing parse, well, as its name suggests. I think this is a topic related to expressiveness […]

How to Emulate The “super” Keyword In C++

Published December 26, 2017 - 8 Comments
super c++

A derived class sometimes needs to call the code of its base class and name it explicitly. But for bases classes with a long name, repeating it in the body of the derived class adds a lot of clutter to it. And C++ doesn’t have a super or base keyword to designate “the base class”, like C# and […]

Why Expressive Code Matters

Published December 22, 2017 - 0 Comments
Why expressive code matters

On Fluent C++, we talk a lot about topics related to expressive code: writing expressive code, making existing code more expressive, and how to keep our motivation up and improve even when facing code that is not expressive. But WHY do we do this? Why is expressive code the main technical characteristic of code we […]

More Tips On Naming

Published December 15, 2017 - 0 Comments
More tips on naming

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

Make Your Functions Functional!

Published December 8, 2017 - 2 Comments
functions functional inputs outputs

A function takes input and produces outputs. Simple, right? If so, how come that a lot of functions in C++ code don’t look that way? And how to overcome those difficulties to make them look like proper functions and show a clear interface? This is the subject of this week’s video: Share this post! &nbsp&nbsp&nbsp&nbspDon’t […]

1 2 3 5