Re:

Wim van Gool <[email protected]>
Newsgroups gmane.comp.programming.domain-driven-design
Message-ID <CAKqMafwY_p+YSwx773DCO2t6_LNmWVO9GGRkXL49aduHj=p3Zw@mail.gmail.com>
I love Tiny Types. In fact, ever since I've learned the basics of
OO-programming I always thought you should hide as much primitives as
possible by encapsulating them in custom types that have a direct meaning
to the domain they belong to (not necessarily a DDD Domain Model, but in
any piece of software). They're like the foundational types of your system
on top of the primitive types the platform(s) offer you. If I can, I even
tend to create custom types for identifiers, names, search-strings, etc. It
does require a bit extra boilerplate code, but this occurs only once (when
you implement them), and they tend to be very testable by nature. And other
then making certain domain concepts more explicit, they allow you to
perform sanity checks/validation, change the underlying storage/primitive
type implementation or extend them in just a single place. In other words:
just a few more lines of code where they can really add value in terms of
quality and maintainability as far as I'm concerned...


On Sat, Apr 13, 2013 at 1:22 AM, Edno Silva <[email protected]> wrote:

> **
>
>
> We use a lot of Tiny Types in my Company. We have PhoneNumber, ZipCode,
> EmailAddress and so on.
>
>
> 2013/4/12 Dennis Traub <[email protected]>
>
>> **
>>
>>
>> Hi Fabricio,
>>
>> I think that's better than using too many primitives in your domain
>> model, which sometimes is also refered to as "primitive obsession".
>>
>> Using custom types even for simple values makes them much more explicit.
>> It helps enforce invariants: e.g. an email type could validate itself,
>> using a string instead would need something external. It also makes code
>> much more redable.
>>
>> Best
>> Dennis
>>
>>
>> --
>> Dennis Traub
>> Software Development Consultancy
>>
>> Am Bogen 7
>> 33178 Borchen
>>
>> Phone:  05293/73942-73
>> Fax:    05293/73942-74
>> Mobile: 0170/2842385
>> Mail:   [email protected] <[email protected]>
>>
>>
>> On Fri, Apr 12, 2013 at 4:35 PM, Fabrício Cabral <[email protected]>wrote:
>>
>>> **
>>>
>>>
>>> Hi everybody!
>>>
>>> What do you think about usage of tiny types as part of your
>>> domain model? Do you agree or disagree? What kind of benefits it
>>> put into your system's model?
>>>
>>> Some links about this subject:
>>>
>>> http://darrenhobbs.com/2007/04/11/tiny-types/
>>> http://martinfowler.com/ieeeSoftware/whenType.pdf
>>>
>>> Thanks for your attention!
>>>
>>> --
>>> --fx
>>>
>>>
>>
>
>
> --
> Sem mais,
> Edno.
>
>  
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.