samedi 10 novembre 2018

Subject of Observer design pattern an interface or a super class?

I'm studying design patterns from a course at coursera. They have there course notes in which they define the Subject of the observer design pattern as super class as shown in the image and code below

UML enter image description here

CODE (SUBJECT) enter image description here

Now I think the Subject class is useless by itself until a subclass inherit from it and make any specific subject. In that case shouldn't the Subject be a java interface instead ? What is the reason that the Subject is not a java interface but the Observer is.

Is there any specific reason for that. I'm a little confused about this.

Thanks

Aucun commentaire:

Enregistrer un commentaire