Quickstart¶
This guide walks through the core concepts of ascetic-ddd with minimal examples.
Core Concepts¶
ascetic-ddd provides building blocks for Domain-Driven Design:
Aggregate roots with identity management
Repository pattern for persistence
Specification pattern for query criteria
Saga for distributed transactions
Defining an Aggregate¶
from ascetic_ddd.seedwork.domain.aggregate import Aggregate
class Order(Aggregate):
def __init__(self, order_id, customer_id, items):
self._order_id = order_id
self._customer_id = customer_id
self._items = items
Using Specifications¶
Specifications allow you to express query criteria in a database-agnostic way:
from ascetic_ddd.specification.domain.lambda_filter.specification import LambdaFilterSpecification
active_orders = LambdaFilterSpecification(
lambda order: order['status'] == 'active'
)
See the Modules section for detailed documentation of each module.