Let’s discuss the Abstract Factory pattern to continue our tour of design patterns in C++ . This is an interesting technique for maintaining coherence between objects, while allowing easy switching or swapping of object sets. This can be useful for allowing an application to use multiple UI toolkits (Apple vs. Windows), allowing different enemies with different capabilities in a game, using different submodels in a complicated simulation, and much more.
Month: May 2017
When to use it: color maps
I’m researching image processing techniques for my new job. I’m finding lots of things that I never took the time to understand, even if I had encountered them. One of them is color maps. Color maps are ways to convert a set of scalar values into colors. They can be used to visualize non-visual data, or enhance visual data.
When to use it: Singleton pattern
We’ll start the discussion of design patterns with the object creation patterns. First up is the Singleton pattern. Conceptually, this is used when you want exactly one instance of an object. A common example is a logger. Sometimes an application wants all its components to log data to the same destination. So, developers might create a Singleton logger, then all the components can easily get a handle to its instance and use its API. But the Singleton pattern has significant drawbacks, and there’s usually better methods for handling situations where you want a Singleton.