Standard Types Expressed as Values
Definition
Standard Types are descriptive objects that indicate the types of things.
The industry lacks a standard name for this concept.
Also referred to as a Lookup or Type Code.
Examples
Phone Number Type:
Home
,Mobile
,Work
,Other
Currency Type:
USD
,CAD
,CNY
,EUR
,GBP
, etcMedication Administration Type:
IV
,Oral
,Topical
Standardization
Depending on the level of standardization, options for maintaining these types can include:
Application Level
Shared Corporate Database
National or International Standards
Implementation
Separate Bounded Context
For the sake of maintenance, it is common for Standard Types to reside in a separate Context from the models that consume them.
The would be modeled as Entities with a persistent lifecycle.
Attributes would include
Id
,Name
,Description
, and more.
Enum
Best to be biased towards an Enum for Standard Types
An Enum is very simple way to support a Standard Type
Provides a well-defined finite number of Values.
Lightweight
Side-Effect-Free behavior (not an Entity)
What about a description?
This is a User Interface Concern.
User Interface will often need to support localization. Localization is not an appropriate model concern.
What about the name?
Often the Name of the Standard Type is the best value to use.
What about when names change?
Use the Parallel Change Pattern
Aggregate
Think twice before you run with this.
Implement one instances of an Aggregate per Type.
Think twice before you run with this.
Standard Types should generally NOT be maintained inside the Bounded Context that consumes them
Widely used Standard Types should normally be maintained in a separate Context with carefully planned updates to consumers.
Instead, expose standard type aggregates as immutable consumer contexts.
Last updated