Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

what you think of GUI builders ?  RSS feed

 
mandlar suurla
Ranch Hand
Posts: 67
Debian Linux PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what you think of GUI builders, are they useful for your work or they just generate messy code. I thought to use NetBeans GUI builder to make my job easier, but that gui builder generates for me little bit weird code, should i go back and write code by myself or continue work with GUI builder. What you think? To you use them or write code by yourself ?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm kind of torn. On the one hand I get really tired of doing this:



over and over again. On the other hand, as you stated, most gui builders I've encountered create some horrendous code. Then again, do we really care about UI code? Should we care what it looks like? As long as we are seperating business logic from UI code and our business logic is clean, who cares what the UI code looks like?

I've tried to tell myself not to care about the UI code many times. And every time I come back to how much I hate the way it looks. Lately I've been using this:

http://code.google.com/p/javabuilders/

This API lets you define the UI in a YAML file. There are other API's like it that use XML instead of YAML but I tend to prefer this API. It's really new and in alpha stage so I wouldn't go all out with something production yet. But its interesting to use and very easy. It uses MigLayout, which is my favorite layout manager for Swing right now. It's very hand coding friendly.

Anyway, I empathize with your situation but I can't offer a concrete answer.
 
Rusty Shackleford
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I usually just do it 'by hand'. The time it takes me to figure out and clean up the code builders generate I could have done it myself.

Personally I don't think that anyone but people who are experts in whatever graphical framework you are using should use builders. You certainly can't learn it if a program writes it for you. To be able to properly tweak generated code you need to understand the framework thoroughly.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do care very much what my UI code looks like - after all, I'll have to maintain it, too, just as much as the other production code.

If you are tired of writing the same UI code again and again (and you should ), refactor the duplication into helper classes.

This can go as far as creating a domain specific language, making use of design patterns such as Builder, Composite, Strategy, Interpreter etc. pp. For example, in one project we have come with code along the lines of



This creates a JFormattedTextfield for a long value of 9 digits, makes it non-editable, gives it a custom background color and adds it to the panel, together with a JLabel. Works like a charm.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've always been burned in maintenance when I've allowed folks to use GUI builders on a project. If the app is in production a few years, don't expect the tools to still be available and working. You're going to have to edit the generated code at some point, no matter what.
 
Ted Smyth
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a big fan of GUI Builders, I've tried Matisse in NetBeans, it was cool for doing some screen mockups and prototypes, but the generated code is really ugly. Sure one could argue that once the UI code is generated we don't really need to look at it again, but I still prefer to do it by hand and implement resizing/constraint behaviour just the way I want it.

MigLayout is my preferred LayoutManager at the moment. Very slick if you ask me , especially compared to the horrific GridBagLayout, and it does pretty much everything you need it to.
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that anyone learning Java or Swing should avoid using code-generators since in my experience in these forums, it actively hinders the user's ability to learn and understand how Swing works. Eventually when you get beyond simple GUI's you will have to know this stuff, and better to know it at the get-go rather than later.

Later on, when you're comfortable and adept with creating GUI's then by all means use a code-generator if it will speed you up, but not til then.
 
moden maddy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is very nice to look forward to this site. I got more information about GUI builders. But heard that GUI builders generates little bit weird code.


================================


maddy

FSBO
 
Campbell Ritchie
Sheriff
Posts: 53720
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Moden Maddy, for the compliments, and welcome to JavaRanch
 
Yves Zoundi
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Starting without a GUI builder is better in my opinion, understand the platform and then avoid going through the same repetitive tasks. There are still many guys who can't write/fix a "hello world" style application without an IDE. 1+1=? ... hum... wait where's my calculator.

What Ernest Friedman-Hill said happens way too often... way too often.
[ October 02, 2008: Message edited by: Yves Zoundi ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!