1 - Design my entities, ie (in python):
class Account:
def __init__(name, author):
self.name = name
self.email = email
2 - Design my repositories: (as interface)
class AccountRepository:
def add(self, account):
""" @type account Account """
pass
def find_by_name(self, name):
pass
def find_by_email(self, email):
pass
# remove, and others...
Now, I can go two ways:
A: Design and implement my domain services:
class SignUpService:
def __init__(self, account_repository):
""" @type account_repository AccountRepository """
self._account_repository = account_repository
def create_account(self, username, email):
account = Account(username, email)
self._account_repository.add(account)
# other methods that uses the account_repository
B: Implement my Repositories Strategies:
class MongodbAccountRepository(AccountRepository):
def __init__(self, mongodb_database):
self._mongodb_database = mongodb_database
def add(self, account):
account_data = account.__dict__
self._mongodb_database.accounts.insert(account_data)
# and the other methods
Which is the correct order? and why? 1, 2, A, B or 1, 2, B, A?
Thank you so much!