Hmmm. This makes sense but I'm finding I have to create a lot of
classes that do very little to get this to work. SRP is great, but it
seems the framework takes it to the next level.
The IWindowFactory implemenatation (that gets called by the
WindowManager to create the adapter) has no way to tell what kind of
adapter to create. So if I go on the principle that I create one
WindowAdapter per presenter (makes sense) I have a WindowFactory per
adapter.
With a single WindowManager, I have to pass it an IWindowFactory to
create it. So I'm going to have to new up my WindowManager each time I
need an adapter?
Here's what I see having to write to create my first presenter
(SplashPresenter):
IWindowManager manager = new WindowManager(new
SplashWindowAdapterFactory());
SplashWindowAdapter adapter = (SplashWindowAdapter) manager.Create(new
WindowOptions(true, 200, 200));
SplashPresenter presenter = new SplashPresenter();
presenter.DisplayIn(adapter);
presenter.Start();
Then I do it all over again for the ShellPresenter:
IWindowManager manager = new WindowManager(new
ShellWindowAdapterFactory());
ShellWindowAdapter adapter = (ShellWindowAdapter) manager.Create(new
WindowOptions(false, 800, 600));
ShellPresenter presenter = new ShellPresenter();
presenter.DisplayIn(adapter);
presenter.Start();
And I can't use IoC to resolve things like the WindowManager because I
have to pass it a different factory for each adapter I want. I almost
want to create an AbstractPresenterFactory that going to create all
this stuff for me, which seems somewhat complex. Am I off here or
there is something I'm missing?
>
http://thebeelog.com- Hide quoted text -
>
> - Show quoted text -