andreslopezlu / snake-utils

0 stars 0 forks source link

Relation between Queue class and DoubleLinkedList class #1

Closed andreslopezlu closed 3 months ago

andreslopezlu commented 4 months ago

@ImMPrada

According to the given approach, we want the Queue class to have an attribute of type DoubleLinkedList, which corresponds to a simple association between both classes. But before that, it had been defined that the Queue class could inherit from the DoubleLinkedList class. I think both approaches contradict each other, so we would have to define which is the most appropriate to implement in this application.

ImMPrada commented 4 months ago

@andreslopezlu

Yeah, I agree; I think we should use this approach:

A Queue is a class not related to DoubleLinkedList; I mean it is not a child of DoubleLinkedList. Because the Queue won't expose or overwrite methods of the DoubleLinkedList, I think Queue must initiate a DoubleLinkedList in a private property and expose methods like add and pop, which will interact with the instance of DoubleLinkedList.

what do you think?

andreslopezlu commented 4 months ago

Yes, that sounds great