Share Scalars

A scalar variable or field is one that can hold only one value at a time; as opposed to composite variables like array, list, hash, record, etc. --Wikipedia.

User requests are processed by different layers of architecture by passing data to each other. Sometimes these layer do not share the types with each other, for example in decoupled domain model. When data has to cross these boundaries explicit mapping from one type to another is done. Our web application would not be implemented in a single programming module. The code for different layers would be separated from each in separate modules. These modules also have dependency on each other. The modules dependency defines what is the valid use of a type, as much as possible. For example we would define the modules in a way that repository objects are not used in view classes. It is useful to share scalar types between different layers and there should be known benefits to not do this.

Here we are referring to enumerations and primitive constants. In a decoupled domain model the scalars used by domain layer should be available to application and presentation layer. This means that the scalars should be defined in a different module than domain. This avoid unnecessary scalar types and mapping without any real benefit unlike the rest of domain model. External application interface in an exception to this for looser coupling with external systems.