.. _domain:

============
Domain Layer
============

.. epigraph::

   A sphere of knowledge (`ontology <https://en.wikipedia.org/wiki/Ontology_(information_science)>`_), influence, or activity. The subject area to which the user applies a program is the domain of the software.

   -- Wikipedia [#Concepts]_

.. automodule:: acd.domain

.. _domain-Entity:

Entity
------

.. epigraph::
   An object that is not defined by its attributes, but rather by a thread of continuity and its identity.

   Example: Most airlines distinguish each seat uniquely on every flight. Each seat is an entity in this context. However, Southwest Airlines, EasyJet and Ryanair do not distinguish between every seat; all seats are the same. In this context, a seat is actually a value object.

   -- Wikipedia [#BuildingBlocks]_

.. autoclass:: acd.domain.Entity
   :members:


.. _domain-ValueObject:

Value Object
------------

.. epigraph::

   An object that contains attributes but has no conceptual identity. They should be treated as immutable.

   Example: When people exchange business cards, they generally do not distinguish between each unique card; they only are concerned about the information printed on the card. In this context, business cards are value objects.

   -- Wikipedia [#BuildingBlocks]_

.. autoclass:: acd.domain.ValueObject


.. _domain-Service:

Domain Service
--------------

.. epigraph::
   When an operation does not conceptually belong to any object. Following the natural contours of the problem, you can implement these operations in services.

   -- Wikipedia [#BuildingBlocks]_

.. autoclass:: acd.domain.DomainService
   :members:


.. _domain-DomainEvent:

Domain Event
------------

.. epigraph::
   A domain object that defines an event (something that happens). A domain event is an event that domain experts care about.

   -- Wikipedia [#BuildingBlocks]_

.. autoclass:: acd.domain.DomainEvent
   :members:


.. [#Concepts] DDD Concepts `Wikipedia <https://en.wikipedia.org/wiki/Domain-driven_design#Concepts>`_
.. [#BuildingBlocks] Building Blocks `Wikipedia <https://en.wikipedia.org/wiki/Domain-driven_design#Building_blocks>`_
