Skip to main content
1 of 3

Few questions about Python project build in Domain Driven Design style

I'm trying to understand the DDD architecture pattern. I wrote a simple project in which I tried to use DDD arch. Here are my doubts after implementing it:

  1. Does it make sense to use an ORM for a DDD project? Maybe I should drop the use of Base class from declarative_base?
  2. Where should I define validators - in domain objects or in repository objects?
  3. Should SimpleService(session) take a session in the initializer or specific repositories that I will create in the main function? Now I create it here:
class SimpleService:
    """Creates simple service."""

    def __init__(self, session):
        self.session = session
        self.post_repository = PostRepository(session)
        self.comment_repository = CommentRepository(session)
  1. What should I change or improve in whole project? Please give me a quick review.