You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my team's project, the classes AuthorList and MangaList both inherit from the generic ArrayList. The exact code used is of the format:
public class AuthorList extends ArrayList<Author> {
...
}
Is the method of representing this inheritance structure depicted in the referenced picture valid? If not, how else can we represent it?
Reference
In this diagram, MangaList and AuthorList are indicated as inheriting from ArrayList, but with notes stating "ArrayList" and "ArrayList". I think that, unless these two classes inherit from ArrayList (in which I think you should remove the notes), I believe that there is no inheritance to indicate?
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.
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 nus-cs2113-AY2425S1/tp#9 (comment)
The text was updated successfully, but these errors were encountered: