• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown

Delegation in Composite MVC architectures

Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm working on my first GUI app in many years as well as brushing up on my Java and am getting a little stuck with some of the "plumbing". I'm following TDD to slowly grow the application and I think I'm making some mistakes with some of my refactoring choices. I'm having a very hard time even articulating my problem.

The bare-bones application is basically one master list with some sub lists. Selecting an entry from the first list populates the second; changes made to the second list (adding/removing items) should cause aggregate information in the first list to update. The application is likely to grow to require at least four separate "views" into the data -- while it might be possible to postpone my current problem by collapsing the Container->Containee relations to a single component for now; the code becomes less testable and I know it won't be easily maintainable.

My Model layer only has the unidirection links from container to contained. The model does not link to either the View or Controller components.

My Controller layer seems to currently be a hybrid Controller-dumb Model (called an Editor in some pattern write-ups?) that converts the rich Model to a more primitive representation for use by the Views as well as handling the "normal" controller functions. Currently they mimic the same Whole->part uni-directional references. The Controllers also have links to the appropriate Model and View.

The View layer however seems to have ballooned in a bad way. The views have links to their editors (so the View-Editor link is bi-directional for each component). Currently one of the sub-views has acquired a link back to the master editor as well. The overall construction of all model,view,controller elements has also gotten pushed into the constructor of the main window, because the controllers need the reference to their componentView pre-construction.

I come from a predominatly web-programming (scripting languanges) and am used to the view being as thin/dumb as possible so this ballooning is starting to smell to me, but I'm not sure if this is more normal in a stateful/GUI type application.

From my previous Java application experience I remember using a lot more Observers/Observable type constructions, but most of the "modern" tutotials I've been refreshing myself on seem to avoid that.

Can anyone offer any insight? Suggestions for good tutorials or books are appreciated, provided they are more detailed than the "trivial" implementations that most tutorials seem to present.

Thank you.

[ January 03, 2006: Message edited by: Eric Nielsen ]
[ January 03, 2006: Message edited by: Eric Nielsen ]
Don't listen to Steve. Just read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic