Factory pattern is another prevalent pattern that we need to know. The main principle about the factory is that it separates the creation from use. But what does this means? We design a factory entity that creates the objects we want depending on what we want. We do not use the constructors directly on the
Tag: C++
SOLID Principles in modern C++
When talking about patterns, one acronym seems to be the most popular, the SOLID principles. Yes, actually SOLID is an acronym that stands for: Single Responsibility, Open-closed, Liskov substitution, Interface Segregation and Dependency Inversion Too many strange terms, a little bit dry. I can think of two things that will help us go through. The
Observer Pattern in modern C++
We have started a series of posts trying to present ridiculous popular design patterns using examples in modern C++. Again, the inspiration came from the great youtube video series, ArjanCodes. This time we are going to talk about the observer pattern which is going to help us separate various modules in our code. The key
GitHub Actions and Conan
It’s always wise to use continuous integration (CI), even in our hobby projects. When working with C++, it might be painful to install the required dependencies, even for the most essential packages like the googletest for the unit tests or the spdlog for the logger. In those cases, using Conan package manager is a no
The Template Method Pattern and the Bridge Design Pattern in modern C++
Is developing software only good (or excellent) knowledge of a programming language? Of course not. There are many things, but one of the most important is to know patterns. It might be not obvious when you develop elementary apps at the beginning of your journey, but it becomes necessary when developing decent packages for professional
Continue reading The Template Method Pattern and the Bridge Design Pattern in modern C++
How to install Armadillo library, the easy way!
Back to May, we have written a post about the procedure we need to follow in case we want to use the Armadillo library in Ubuntu. It works, but in this post, I would suggest an even easier way to do it. The solution called Conan, the C/C++ Package Manager. It can be used for
Continue reading How to install Armadillo library, the easy way!
How to use pimpl idiom to hide the internals of your class declaration (and not only)
When we share the public interface of our library or API, we usually share the header files. In this case together, with the public members od our class there is also visibility of the private. The pimpl idiom which comes from the “pointer to implementation” is a programming technique that let us hide the internal
How to install Armadillo library in Ubuntu
Armadillo is a high-quality linear algebra library for the C++ language. The good thing is that it follows similar syntax with MATLAB. It provides classes for vectors, matrices and cubes. It is easy to install. There are three ways to do it: a. Install pre-build armadillo package First, we need to install the dependencies since
How to install clang 10.0.0 and use it with Clion
We enjoy coding using Ubuntu and advanced editors like CLion. The good thing apart from learning by practice (practice, practice) is to follow also the current developments. What better using the most recent LLVM clang 10.0.0 compiler? Yes, it’s very easy to do it. First you need to download it from the LLVV website official
Continue reading How to install clang 10.0.0 and use it with Clion
Sets in C++17 and a custom comparator
Sets belong to the associative containers family. This category facilitates very fast element search. Sets contain keys that are always ordered and unique. The class template for sets is like that: std::set<T, Comparator, Allocator> where T is the key type, Comparator is the algorithm with which we perform the ordering and defaults to std::less and