this is a small scenario of a big system. i want to model this scenario in class diagram and then implement it in code
this is a scenario in book store.there is customer and books customer can buy books,search books by name,and read books
class diagram implemented in following ways
1.put all operations to the customer class because customer is the one who perform these actions
but buyBooks(),searchBook(),readBooks()
methods are not responsible for changing the state of customer class
(these methods are not working on data inside of customer class ) there for it violate basic oop principle encapsulation.
customer can buy,search,read 1 or more books therefore association marked as shown in image.
i have found lots of class diagrams draw this way when referring the INTERNET
2. put all operations to the customer class same as above. and mark each associations seperately, with three separate lines
associations
- customer can buy one or more books
- customer can search one or more books
- customer can read one or more books
3.in here put all operations to the service class because those methods are not responsible for changing state of neither customer,book class
and then mark association.
- among theses which one is correct class diagram ?
- is it acceptable to draw service classes in uml class diagrams ?