Pergunta

I have some simple app, that I have implemented with design patterns. On the way I have implemented it using MVC separation.

I have View - MainForm class, Controller - MainController class.

Controller is a singleton, so MainForm accesses it when it needs to. MainController has as a IMainFormView interface as a composition.

MainForm class implements IMainFormView.

So, when user clicks some button, then MainForm passes some request to MainController, that computes something and performs callback on IMainFormView member to update the MainForm.

Is there Visitor pattern: IMainFormView- IVisitor and MainForm - Visitor?

Foi útil?

Solução

I sense a Strategy Pattern here. A strategy pattern lets you select a particular algorithm, which in your case is an implementation IMainFormView, at runtime.

Outras dicas

I don't think so this can be considered a good example for visitor pattern. In visitor pattern, for each specific type you overload the method in the Visitor class. This visitor is then passed to these types to perform the operation.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top