wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes best practises/patterns for gui development Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "best practises/patterns for gui development" Watch "best practises/patterns for gui development" New topic
Author

best practises/patterns for gui development

Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
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 ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
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 )


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Mark Sintrel
Greenhorn

Joined: Jun 29, 2004
Posts: 7
Check out the packages and tutorials on http://www.jgoodies.com

Their forms jar is pretty good.


<a href="http://www.amazon.com/exec/obidos/ASIN/0201310058/radikal" target="_blank" rel="nofollow">Effective Java Programming Language Guide</a> - probably the best book ever written for intermediate to advanced java programmers!
Rob Warner
author
Ranch Hand

Joined: Apr 22, 2004
Posts: 50
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.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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.


GenRocket - Experts at Building Test Data
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: best practises/patterns for gui development
 
Similar Threads
Looking forward to some interesting insight
spring: different Transaction issolation levels using programatic transaction
About Facade design pattern
need java application?
Question about Wrox book and the Exam Objectives