• 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 ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

best practises/patterns for gui development

 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I know its a Gregg Bolinger topic, but as we have Java-gui-book author here, I might ask this question again.
I have much more problems with developing gui-clients than putting together some dhtml pages connected by some flow organized through some kind of a servlet-controller (be it with framework like struts or webworks2 or not).
My gui clients allways end up in some messy bloated collection of business calls, gui-widgeds definition, layout-management things, some thread-management stuff and even some state-holding variables. This is difficult to understand next day.
O.k. I factor business logic to business objects. I do allready know and use observer pattern.
But there must be a better way. Rob, you know some book, website or even open-Source project, which you consider as a good example for inteligent separation of concerns in a gui app?

regards Axel
[ July 08, 2004: Message edited by: Axel Janssen ]
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the exact same problem -- I know of the Mediator pattern, for example, but my GUIs always (well, I've only written a couple of small "personal" apps) end up being a jungle. So, I would also love to hear about any helpful resources. I think I asked the same question a couple of months back when a Swing author was promoting but we got no answers back then ( looks like my this week's question will end up the same way )
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out the packages and tutorials on http://www.jgoodies.com

Their forms jar is pretty good.
 
author
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't seen a book dedicated to this topic, although many of the patterns books talk about it. One thing I've found is that if I at least design, and (even better) implement a command line interface for my GUI programs, the separation stays much cleaner. Besides, then the Unix folks love you

I realize that this won't work in every situation, but is more applicable than it might appear at first blush. For example, you might think this suggestion utterly inapplicable for an image editing program, but think about many of the functions an image editing program must perform. Convert among image formats? You can write a CLI for that. Apply some sort of effect to an image? You can write a CLI for that.

The trick, or course, is to make sure you're not writing two separate programs, and cutting and pasting code between them. Make sure you're using the same engine in both, and the interfaces (GUI and CLI) are just asking for and receiving input.

HTH.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a Gregg Bolinger topic. I think one reason why there is no definative answer to this question is because Sun has not provided one. They made the API, they should specify the correct patterns for building Swing apps. But as of yet, they have not.

There are appearntly developers who know what they are doing. I mean, look at IDEA and Netbeans. These are very robust responsive pure Swing driven applications. It would be nice if someone wrote a book on this topic though.
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rob, I think you just made a convert of me

Just yesterday I was thinking about an internal training I'm arranging with a coworker of mine -- one for which we need a codebase to play with, preferably "tuned" to the particular training's purposes. Well, we came up with a couple of ideas for a standalone Swing application and I started to remember all those problems I'd had with my previous attempts at clean Swing code. Guess what -- I also thought about just starting out with a command-line interface! (although I did abandon the idea as too "absurd"...) Now, I think I'm going to try and see what that approach leads to.

Thanks for the inspiration!
reply
    Bookmark Topic Watch Topic
  • New Topic