strong_typedef - Create distinct types for distinct purposes--Anthony Williams

A common problem with a common solution made easier.

strong_typedef - Create distinct types for distinct purposes

by Anthony Williams

From the article:

One common problem in C++ code is the use of simple types for many things: a std::string might be a filename, a person's name, a SQL query string or a piece of JSON; an int could be a count, an index, an ID number, or even a file handle. In his 1999 book "Refactoring" (which has a second edition as of January 2019), Martin Fowler called this phenomenon "Primitive Obsession", and recommended that we use dedicated classes for each purpose rather than built-in or library types...

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.