Design Patterns Tagged Pages

Page Image
Thursday, May 8, 2025
Sometimes you've got to convert between an enumeration and a string...
Often times in an application, you’ve got to convert between an enumeration value and a string. It’s generally best to wrap this in an object, so you keep all the details of the conversion contained in one place. It also makes the syntax of comparing objects a simple process of a == b or similar.
Read More...
Page Image
Saturday, May 10, 2025
Some ideas on how to keep code common that's used across libraries
It’s usually a good idea to maintain one place for common code that may be used across multiple applications or libraries. This code is often compiled into those items (i.e. not a library itself). Frequently, you’ll want to be able to define the device you’re compile the code for so-as not to have to include any more code than required. Below are some ways to accomplish this. They’re separated by compile time and run time options. The compile time options are less flexible, but offer no runtime impact and smaller compiled sizes. The runtime options are more flexible, but more computationally expensive and larger in compiled size. It’s best to start with compile time solutions until you actually need a runtime one.
Read More...