Talk given at MusterIt 2015. I'm trying to show here the difference that DDD makes, by describing knowledge that was available when the DDD was created and that has been used as a foundation of all DDD patterns and practices.
3. Entity
Examples of reference objects might include:
Customer, Account, Telephone Switch, and the like.
They are often complex and large and may be
referred to in lots of places. They usually have a rich
state and any change from any place needs to be
visible to other objects that refer to it.
Reference objects are compared based on their
identity, although you may see IdentifyingAttributes.
You don't usually see muliple copies of a
ReferenceObject in one address space.
Source: https://web.archive.org/web/20010717202923/http://c2.com/cgi/wiki?ReferenceObject
Reference Objects
Martin Fowler
4. Entity
Keep behavior with related information.
Don't make any role too big.
Distribute intelligence.
Keep information about one thing in one place.
Source: http://www.wirfs-brock.com/PDFs/A_Brief-Tour-of-RDD.pdf
Hints from RDD
Rebecca Wirfs-Brock
5. Entity
Source: https://domainlanguage.com/ddd/patterns/DDD_Reference_2011-01-31.pdf
In DDD Context
When an object is distinguished by its identity,
rather than its attributes, make this primary to its
definition in the model. Keep the class definition
simple and focused on life cycle continuity and
identity.
…
The model must define what it means to be the same
thing.
(aka Reference Objects)
6. Value Object
Source: http://c2.com/ppr/checks.html
CHECKS Pattern Language (Whole Value)
Ward Cunningham
…
Construct specialized values to quantify your
domain model and use these values as the
arguments of their messages and as the units of
input and output. Make sure these objects capture
the whole quantity with all its implications beyond
merely magnitude, but, keep them independent of
any particular domain.
…
7. Value Object
Source: https://domainlanguage.com/ddd/patterns/DDD_Reference_2011-01-31.pdf
In DDD context
When you care only about the attributes
and logic of an element of the model, classify it as a
value object. Make it express the meaning of the
attributes it conveys and give it related functionality.
Treat the value object as immutable. Make all
operations Side-effect-free Functions that don’t
depend on any mutable state. Don’t give a value
objectany identity and avoid the design complexities
necessary to maintain entities.
9. Ubiquitous Language
...
Revise the names of your objects to reflect their
ultimate roles. Words drawn from human relations
often imply much secondary meaning. Make sure
these align with the intent of your responsibility
allocations.
…
Avoid names that have confused or unfortunate
meanings in related domains. Consult a Thesaurus
and try the synonyms it suggests as you might use it
as a class name.
…
Your new names will lead you to an even deeper
understanding of your objects
System Of Names
Ward Cunningham
Source: https://web.archive.org/web/19961129215819/http://c2.com/cgi/wiki?SystemOfNames
10. Ubiquitous Language
Use the model as the backbone of a language.
Commit the team to exercising that language
relentlessly in all communication within the team and
in the code.
In DDD Context
Source: https://domainlanguage.com/ddd/patterns/DDD_Reference_2011-01-31.pdf