2
Answers

OOP-question

Lars Persson

Lars Persson

12y
1.2k
1
I have an old project made i Java.

It is a library-system in which you can create book-objects and customer-objects.

You save the objects in a List.

Now when you are going to make a loan, here is how it worked in my old Java-project.

I had a class loan-handler. In that class I had a method where I sent a string ISBN (the book the customer would like to loan) a id string for the customer (the one to loan a book of course) a List of books and a List of customers.

In the method I would save the customer-object in a variable in the book-object so I know who have loaned the book.

The customer-object have a List in which you save the book that the customer would like to loan.

Hope I made it clear.

Is this good OOP-design? Is there a better way?

Should I have a loan-handler class?



Answers (2)