Eliminating Type Dependence in Observer Design Patterns by Generic Technology

Zhao ZhengXu,Zhang DengHui,Liu Tian
DOI: https://doi.org/10.3969/j.issn.2095-0373.2013.03.010
2013-01-01
Abstract:Observer design pattern is widely used in the user interface design.Although the coupling between subject and observer gets lower in the traditional implementation of observer pattern,the subject still needs to know the type of the observer,i.e.,the observers have to be on the same inheritance system.To introduce observer pattern to the third party library,the usual practice is to use multiple inheritance which is not conducive to the decoupling between objects.For some object-oriented languages,support to multiple inheritance is limited.This paper proposes a container in the strongly typed language which eliminates the type dependence using the generic technology while not changing the object structure,and let any class have an ability to act as the observer.This method is used to refactor the Space Visual Remote Operation Subsystem,which improves the scalability and reusability of the system.
What problem does this paper attempt to address?