Conflict on how books are created and stored
Opened this issue · 4 comments
In the method createBooks
we are inserting new books in the hashmap by using its unique bookId
:
This doesn't match with the way books are stored in the method createAndAddToStorage
, where the key value is the bookTitle
:
A convention must be properly defined here, else we won't know how to correctly retrieve the already inserted books.
In this case, just in this case, this way is useful because we re-use the tag so we dont create new tags ... it is a memory saving. If we create 10.000 objects we dont need to create 10.000 tags (var ref).
I don't understand the latter reasoning. The issue is regarding whether we use the book's title or its ID as the hashmap's key, not about what's more convenient in a particular case scenario. The incongruence still exists, as there isn't a unique criteria for storing new books.
I see. I misunderstood... I will check it. Yes, both methods are not working as planned ... it s a copy/paste issue ...
I will check BookManager, thanks, Marc.