I downloaded Eclipe's Visual Editor today to see if it was any good. While testing it though I noticed something I found strange. Here is a code snippet
I prefer to handcode my GUIs in Java - I like the control that gives me. In my limited experience, GUI-editors almost invariably create much more complicated code, which makes it harder to maintain the GUI (which is the main work in software development!).
anyway now that i think of it, one does this program, then passes another 5 or so years making updates to it or fixing bugs or both ...
Exactly! If a program gets used, people will find things that can (and should) be improved. People will get ideas for new requirements. They will want to use it for new problems. Other people will want to use it, but they will have slightly different requirements. Etc. pp.
The very most important property of a software system is its maintainability. Whole companies go bankrupt because they don't consider this important reality.
The few times I developed a Swing client I started with Netbeans or IBMs Visual Editor which is now part of Eclipse. I allways ended up with hand-coding. Took some useful ideas how to strucutre the code from examples on JGoodies.com (Forms demo) as I am using their (or better his?) Look & Feels and Layout manager anyway. The Gui subproject at my current main customer uses self written code generation from xml files to build guis. Have some doubt, if they are not perhaps ending in lack of flexibility/messy maintainabiltity problems with this approach, though. Now Scott Delap new book on sourcebeat should contain some expedient guidelines to follow. [ May 01, 2005: Message edited by: Axel Janssen ]
If you're referring to this "lazy initialization" method, then yes I code my GUIs that way. It makes it easy for me to figure out where the initialization code goes for a particular component. If I want to know why my "Ok" button looks/behaves the way it does, I look for the getOkButton() method. I'm not saying it's the best way in the world, but it has worked well for me and makes maintenance quite easy.
Originally posted by James Carman: If you're referring to this "lazy initialization" method, then yes I code my GUIs that way. It makes it easy for me to figure out where the initialization code goes for a particular component. If I want to know why my "Ok" button looks/behaves the way it does, I look for the getOkButton() method. I'm not saying it's the best way in the world, but it has worked well for me and makes maintenance quite easy.
What we do in such cases is have a createContent method, which might delegate to a createOkButton method. Those methods are only called exactly once. Most often simply is no need for the increased complexity of lazy initialization, in my experience.
I don't know about the complexity of lazy initialization, but as I said I'm not saying it's the best way. It just works for me. I actually don't do much of that type of coding anymore. I wrote a class which allows me to specify my GUIs using an XML document (looks like HTML tables) using GridBagLayout. It even supports binding event listeners to the components. The event listeners usually just call methods on a controller object. This binding is all done using OGNL. That is how I usually code these days. It seems to be much simpler.
Post by:autobot
Please do not shoot the fish in this barrel. But you can shoot at this tiny ad:
a bit of art, as a gift, the permaculture playing cards