In a system I have an Interface IVIew
for a View and a explicit Implementation TextView
. The TextView also implements the Observer Interface so it can be updated on changes in a Model. So now I can use IView
wherever I need a non explicit View. This might be a Controller which hold a IView
or an abstract Factory for platform independent views.
So now I'm confused if the interface even makes sense here. Except from method declarations like init() or setModel() there won't be functionality which will be called from somewhere else because the View gets updates implicitly from a model. I also thought about making IView an abstract class, implementing Observer with members every View should know. Any suggestions?
Since a view by definition needs data from a different data source in MV* patterns, I'd let IView
extend Oberserver
. This provides enough flexibility for changes and controllers can talk against a generic view, which is easily extendable.