Open xenthm opened 1 week ago
Your notation seems OK (* good!). Not sure what the comment means specifically.
From UML specification:
*we don't cover this in CS2113; so you went beyond to learn the notation for generics inheritance. specifying the type in the UML note seems OK to me as a way to explain to the reader what it means.
However, I do have a comment to make:
Instead of extending from ArrayList, why not make it into a composition/aggregation where ArrayList
Thanks for the reassurance Prof!
Instead of extending from ArrayList, why not make it into a composition/aggregation where ArrayList is inside of a class that manages Author list?
As for this, we initially did exactly that. We had an ArrayList<T>
inside our AuthorList
class. But we found that it was troublesome to keep making trivial methods to add and remove items from the private ArrayList
(I think this happened when we wanted to create our second list class). So, we just made it inherit from ArrayList
so we could use its add and remove methods as-is. More complicated methods were then added to extend the functionality of the ArrayList
.
But then again, I guess having those trivial wrapper methods can help with method readability when using them outside. We were lazy at the moment 😃
Question
In my team's project, the classes
AuthorList
andMangaList
both inherit from the genericArrayList
. The exact code used is of the format:Is the method of representing this inheritance structure depicted in the referenced picture valid? If not, how else can we represent it?
Reference
_Originally posted in a comment in https://github.com/nus-cs2113-AY2425S1/tp/pull/9#discussion_r1821904048_