All posts in "Expressive code"

How Unit Tests Help Express Your Code’s Intent

Published November 3, 2017 - 2 Comments
unit test intentions

Guest writer Tim Scott talks to us about how to make unit tests express the intentions of a piece of code. Tim is a software developer and tester passionate about software quality and automation. You can find him online on DeveloperAutomation.com, his blog about increasing quality and developer efficiency through automation, or on his Twitter or […]

Function Aliases In C++

Published October 27, 2017 - 4 Comments

One thing that dramatically improves the expressiveness of a piece of code is respecting its levels of abstractions. It sometimes involves massive refactorings, but in many cases it just comes down to choosing good names in your code. Picking a name that is consistent with the abstraction level of the surrounding code can make a […]

The Results of the Expressive C++17 Coding Challenge

Published October 23, 2017 - 14 Comments
Expressive C++17 coding challenge

The Expressive C++17 coding challenge has come to an end after being open for three weeks, for submissions of the clearest code using C++17. It was a joint challenge between Bartek’s coding blog and Fluent C++, and its point was to learn collectively how to use C++17 to write clearer code. We’ll see the winner and […]

tee: Debug Info With Little Impact On Code

Published September 29, 2017 - 9 Comments
tee C++ debug log

I’d like you to meet tee, a little companion for retrieving targeted runtime info, with very, very little impact on the code. It’s simple, but I find it very convenient. You can put tee in your code wherever you need to know what’s going on, and tee will spy it for you. Its most basic implementation is […]

The Expressive C++17 Coding Challenge

Published September 25, 2017 - 13 Comments
Expressive C++17 coding challenge

The ink is dry on C++17! Actually it had dried a few times already. But the drier the ink, the sooner we get to use this new standard in production code. Now how do we learn all those new additions to the language? And how do we know to use them to write even more […]

A Summary of the Metaclasses Proposal for C++

Published August 4, 2017 - 17 Comments

A couple of weeks ago, Herb Sutter posted his proposal about metaclasses, triggering a wave of enthusiasm among the C++ community. And for good reason. His proposal gradually introduces the reader to the impressive potential of metaclasses, in particular to improve the expressiveness of current C++ idioms. I think everyone should be aware of the […]

How to Use Overloaded Functions With The STL

Published August 1, 2017 - 6 Comments

The latest challenge on Fluent C++ wasn’t an easy one. It consisted in finding the best way to use overloaded functions with the STL – or with any other context that accepts functions as parameters, for that matter. You guys submitted solutions that took very different approaches, and this is awesome. Let’s see in details […]

Do Understandable If Statements Run Slower?

Published July 25, 2017 - 6 Comments

Aadam, my esteemed teammate, walked down to me right after reading the last post on Fluent C++, How to Make If Statements More Understandable, with a question. In fact this post made quite a few people think and get back to me with feedback and questions, for which I’m very grateful. If it did just […]

How to Make If Statements More Understandable

Published July 21, 2017 - 10 Comments

If statements are necessary to build our code. Granted, some ifs are bad, like those that try to emulate polymorphism by testing a series of types. Those, you want to stay away from. But the ones that implement domain rules are good, and even an opportunity to make your code more expressive by showing how […]