Ubiquitous Language and Custom types

Posted by EdvRusj on Programmers See other posts from Programmers or by EdvRusj
Published on 2013-06-24T17:31:11Z Indexed on 2013/06/25 4:28 UTC
Read the original article Hit count: 256

Filed under:

Note that my question is referring to those attributes that even on their own already represent a concept ( ie on their own provide a cohesive meaning ). Thus such attribute needs no additional functional support and as such is self-contained.

I'm also well-aware that even with self-contained attributes the custom types may prove beneficial ( for example, they give the ability to add new behavior later, when business requirements change ). Thus, my question focuses only on whether custom types for self-contained attributes really enrich Ubiquitous Language UL

a) I've read that in most cases, even simple, self-contained attributes should have custom, more descriptive types rather than basic value types ( double, string ... ), because among other things, descriptive types add to the UL, while the use of basic types instead weakens the language.

I understand the importance of UL, but how does having a basic type for a self-contained attribute weaken the language, since with self-contained attributes the name of the attribute already adequately describes the concept and thus contributes to the UL vocabulary?

For example, the term person_age already adequately explains the concept of quantifying the number of years a person has:

class Person
{
       string person_age;
}

so what could we possibly gain by also introducing the term ThingAge to the UL:

class person
{
      ThingAge person_age; 
}

thanks

© Programmers or respective owner

Related posts about domain-driven-design