Newer
Older
General notes:
The project includes 7 Java Classes (Library, Article, Book, Customer, Validation, MetaValidation and Main) that solve the tasks given in task sheet 1.
- the source code can be found under: library/src/main/java/org/example/ , it follows the Maven Standart project layout.
- all methods functionalities are described with comments, apart from Constructers, getters and replicated methods.
- The main class includes code that directly outputs all the main requiered functionallities in the tasksheet
The rest of the Readme are References and other Difficulties and possible improvements (for presentation).
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
-> 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
-> 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?
Possible improvements:
- Add explanatory text to the (Boolean) returns
- More exception handling
- More efficient implementation of duplicated methods as described above
-