Jonathan Boccara's blog

Design Patterns VS Design Principles: Factory method

Published June 5, 2022 - 0 Comments

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

Copy-Paste Developments

Published April 26, 2022 - 0 Comments

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

Design Patterns VS Design Principles: Abstract Factory

Published April 6, 2022 - 0 Comments

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

How to Generate All the Combinations from Several Collections

Published March 18, 2022 - 0 Comments

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

Code It Yourself: Generate All the Combinations from Several Collections

Published March 14, 2022 - 0 Comments

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

Design Patterns VS Design Principles: Visitor

Published February 9, 2022 - 0 Comments

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

1 2 3 45