I want to design an online book reader. The first step is describing all the use cases which I have listed below:
- I should be able to search a book by title.
- I should be able to borrow a book.
- I should be able to bookmark a borrowed book.
- The system should allow one user per book at a time.
- The system should allow to add a new book.
- The system should allow to delete an existing book.
That said, I know now I need some Service Objects which would operate on Entities / Value Objects to get the thing done. I am deferring the database design / decision for now as its not considered a good practice. For the similar reasons Delivery mechanisms too is deferred.
After some reading I came to the conclusion that I would need the following:
Services (Algorithms without any states, depends on entities / values)
- SearchBook (Takes a title and gives the result back)
- BorrowService (Checks if a book can be borrowed)
- Member service (Enroll/Unroll members in a library)
Entities (real world mutable objects with unique ID)
- Book (ISBN number as a UID)
- User (Email as UID, it can be author or reader)
An author can have many books under his name, a user can only borrow one book at a time. A library can hold many books at a time, it can have many members too.
- For simplicity there will be only single library / store.
- No two users can read the same book at a time.
- I am not able to find any value object till now or I am not able to recognize / find it?
- I have followed Clean Architecture for some time and helped to build a toy project before. What is the difference between this and DDD?
- Am I on the right track?