RSSAmplifier

Blog

Fluent C++

Jonathan Boccara's blog

fluentcpp.comRSS feed ↗10 posts

Latest posts

Usage First, Implementation After: A Principle of Software Development

You know when you work on various projects, and you use various tricks and techniques, and they all seem independent from one another, until the big picture jumps at you and you realize it s all connected? I experienced this kind of aha moment, that emerged from several (apparently) independent topics I wrote about, a guest [ ] The post Usage First, Implementation After: A Principle of Software…

Design Patterns VS Design Principles: Factory method

Let s examine another design pattern in our Design Patterns VS Design Principles series, where we relate design patterns to design principles. Today, we focus on the Factory method design pattern. We ll see the various forms the Factory method design pattern can take, the differences with the Abstract Factory method, and to which design principle the [ ] The post Design Patterns VS Design…

How to Store an lvalue or an rvalue in the Same Object

There seems to be a problem coming up every so often C++ code: how can an object keep track of a value, given that this value can come from either an lvalue or an rvalue? In short, if we keep the value as a reference then we can t bind to temporary objects. And if we [ ] The post How to Store an lvalue or an rvalue in the Same Object appeared first on Fluent C++ .

Copy-Paste Developments

Amongst the many tasks a programmer does, one of them is to add a new feature in a location of the application where there are already many similar exising features. The temptation is then to warm up very specific muscles of our left hand: the pinky muscles that will press on the Ctrl key, the [ ] The post Copy-Paste Developments appeared first on Fluent C++ .

Design Patterns VS Design Principles: Abstract Factory

In the Design Pattens VS Design Principles series, we look at design patterns and relate them to design principles. In this episode, we examine the Abstract Factory pattern. Let s see how Abstract Factory works and what it is useful for, then relate it to a design principle. We will also see a C++ technique to [ ] The post Design Patterns VS Design Principles: Abstract Factory appeared first on…

How to Generate All the Combinations from Several Collections

Generating all the possible combinations from a set of collections and applying a function to each combination is a need that comes up often in programming. This is called a Cartesian product . For example, this kind of operation is necessary in the cartesian_product range adaptor, in the cartesian_product pipe, and in the killer feature of [ ] The post How to Generate All the Combinations from…

Code It Yourself: Generate All the Combinations from Several Collections

A Cartesian product consists in applying a function to all the possible combinations of the elements of several collections. For example, consider the three following collections: auto const inputs1 = std::vector int {1, 2, 3}; auto const inputs2 = std::vector std::string {"up", "down"}; auto const inputs3 = std::vector std::string {"blue", "red"}; Then (2, up, blue) and (3, up, red) are two of […

A Good Way to Handle Errors Is To Prevent Them from Happening in the First Place

Error handling is a tricky part of software programming. It s tricky in several aspects: it s difficult to get right, and it can make code less expressive. But it doesn t always have to be that way. Sometimes asking the question how can we prevent the error from happening in the first place? can avoid the need [ ] The post A Good Way to Handle Errors Is To Prevent Them from Happening in the First…

Design Patterns VS Design Principles: Visitor

In today s episode of the series Design Pattens VS Design Principles , we re focusing on the last behavioural design pattern: Visitor, and see how it relates to the High Cohesion design principle. The GoF meets the GRASP If you re just joining the series, The GoF meets the GRASP is about relating each of the GoF design [ ] The post Design Patterns VS Design Principles: Visitor appeared first on…

Which Programming Paradigm Gives the Most Expressive Code?

Warning: this post gets into a very opinionated subject. You may agree with some points, you may disagree with others, it may trigger controversy, and you may be tempted to seize your keyboard to tell how you have a completely different view on programming. This is exactly what I want you to do. Rather than [ ] The post Which Programming Paradigm Gives the Most Expressive Code? appeared first on…