General note: all methods are described with comments other than Constructers, getters and replicated methods (in Article class). the main class includes code that outputs all the main requiered functionallities References: - Java Documentation Oracle • String • Time.localdate • Objects and classes • Reflection - YouTube (mainly Coding with John) - Stack overflow. First thoughts - I need some kind of memory and that couldn’t only be provided with objects o Arraylist - To mark books as liked my first idea was to use Boolean to mark the books if liked or not, but it was not later feasible with OOP and the following use for customer and getAllLikedBooks o Store liked books in a list for each customer and increase number of likes for a book Most liked books: first I implemented a method that returns the most liked book Problem: if two books has same count it returns only one Solution: a second method that gets all the books that has same likeCount as mostLikedBook Problem: if no books were liked it still returns a book with 0 likes (primitive) solution: if no books were liked return null Difficulties: Repetition in writing same methods for articles and books and for read and likes Is there more efficient implementation to avoid duplicated methods? Extension and interfaces? Possible improvements: - Add explanatory text to the (Boolean) returns - More exception handling - More efficient implementation of duplicated methods as described above -
Bassel Dib
authored