jeremyalan
jeremyalan

Reputation: 4786

Organizing GUI code

My question has two parts:


Thanks!

Upvotes: 11

Views: 2977

Answers (3)

Amanda S
Amanda S

Reputation: 3294

Some guidelines for the first question, from an OO perspective:

  • Break up large classes into smaller ones. Does that panel have a bunch of fairly modular subpanels? Make a smaller class for each subpanel, then have another, higher-level class put them all together.
  • Reduce duplication. Do you have two trees that share functionality? Make a superclass! Are all of your event handlers doing something similar? Create a method that they all call!

Second question. I see two ways of doing this:

  • Listeners. If many components should respond to a change that occured in one component, have that component fire an event.
  • Global variables. If many components are reading and writing the same data, make it global (however you do that in your chosen language). For extra usefulness, combine the two approaches and let components listen for changes in the global data object.

Upvotes: 7

Noel Kennedy
Noel Kennedy

Reputation: 12258

You should definitely look at Jeremy Miller's guide to rich client design. It is incomplete, but I believe he is writing a book on the subject.

Another blog you should check out is Rich Newman's. He is writing about Composite Application Block which is a MS best practice guide on how to structure rich clients.

You can also read this book which is only a very light read but gives you some good ideas.

Upvotes: 0

Reed Copsey
Reed Copsey

Reputation: 564441

If you're using WPF, you might want to read the Composite Application Guideance for WPF.

It discusses many of these topics (as well as many others). The main goal of that guideance is to make large scale applications in a flexible, maintainable manner.

Upvotes: 3

Related Questions