Given is the following package/class diagram of an implementation of java.util.List:
1. Which design principle is (most likely) hurt by the ArrayBasedList class?
In my opinion, the design principle that is hurt by the
ArrayBasedList class is the "Use inheritance as a Specialization" because the
ArrayBasedList is not (extends) only an Array (ArrayUtilites) but it has (implements) the methods from
ArrayUtilites as well.
2. What would be the preferred way to model this situation in a correct way (as UML)?
The preferred way to model this situation in a correct way using UML will be to make the
ArrayBasedList implement the
List and the
ArrayUtilites interfaces. [Link unrelated classes with has a capabilities.]
My solution was based on How should I have explained the difference between an Interface and an Abstract class?
What do you think about my approach?
Edit 13/01/2021: This question was part of an examination sheet in a Software related master program. I can understand that the question perhaps is a bit abstract but at the same time, after reading carefully the comment/response, I do realize that my solution approach seems to heading in the right direction.