The biggest difficulty I am having is finding responsibilities of each object identified by me in the system or so called problem space. I am positing a very simplified description of a book reader.
This time I thought like which actions can be performed on an object and that action became the method on that object, later who is going to perform those action became the parameter of the message/method but I am not sure because in that way every message would have something as a parameter. I would like to constraint the discussion to this level so that I could get clear discussion and answers.
/*
A user should be able to search a book from a library
bookmark it, favorite it or rate it.
A Book
1. Can be favorited (by whom?)
2. Can be bookmarked (by whom?)
3. Can be rated (by whom?)
4. Can be added to a library?
5. Can be removed from a library?
A Library
1. Can be Searched
2. Can be modified?
a. Add book
b. Remove book
Relationship:
A library can have many book (o2m)
A library can have many users and an user can subscribe to many libraries(m2m)
A user can rent many books (o2m) needs a new model (rent)?
*/
interface Book {
void bookmark(User user);
void favorite(User user);
void rate(User user);
}
interface Library {
List<Book> search();
int add();
boolean remove();
List<Book> all();
}
public class Main {
public static void main(String... args) {
System.out.println("Starting application");
}
}
This is the high level view and I would like to know if this approach is correct?