Factories are a very useful pattern in object oriented programming. They however require including and indexing all these classes at one place, requiring modification when a new creatable subclass is added. This trick allows to avoid this annoyance.
It often happens that a program needs to run a lot of short functions periodically, with various periods. An easy way to do it is to create a thread for each that performs the function and sleeps the rest of the time. This approach, however, doesn’t scale well. Here is an efficient and relatively simple solution to the problem in C++.
How to use a single command to perform an action asynchronously
Storing data in a non-human-readable binary format can be useful, because it takes much less space and parsing is easier and faster. It feels much more practical to access such a file like a vector rather than a file stream.
An ironic article how not to write code
A C++ library for saving objects into files usable with as little code as possible
Do you think writing code in C++ takes long? Here’s the story how I wrote a fully featured JSON library in C++ in two and half hours when using existing ones was inconvenient.