Anyone else code GUI's this way?
Is it really that bad? Does other IDEs code swing better? or is it a common problem to IDEs generation code?
do you recommend hand code swing instead?
Originally posted by miguel lisboa:
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.
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 ]
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.