Howdy all, I'm a newbie .... why else would I be here.
Now my question: I figured the best way to learn this stuff would be to grasp the basics (I'm nearly there) and then dive in and migrate a small bespoke PB app that I wrote for a local IFA. What's confusing me is that when I look at all the books and online tutorials for the GUI aspect of things I very much get the impression that the intention (at least originally) is to that it should be done textually.
Is that right?
Do java guys, in reality, really design GUIs textually as opposed to using an IDE? [I should say I'm totally aware of the benefits of understanding the underlying code both from a learning angle and a development viewpoint. With PB there are times when it's far easier to go in and tweak things textually than fight the IDE]
One of the reasons I ask this is that, obviously, I'm trying to align my skills to maximize my chances of gaining new contracts whilst leveraging my experience. So, having determined that the main flavours of IDE seem to be Netbeans (which I'm using for some of my training) and Eclipse, I did some research (in the UK market) on JobServe. I found that Netbeans is very rarely a required skill and often AWT/SWING/GUI skills are mentioned with no reference to an IDE at all. This, coupled with the preponderance of tutorials and books to focus on the textual aspects of GUI development, led me to wonder if fully fledged java guys just used a textual approach. Hence the question.
Sorry if this seems a lame question but java's a big world and I'm having problems deciding where to concentrate my efforts.
I'm sure there will be more lame questions I'm afraid!
Regards and thanks for any insight you might give me, Phil.
Well, in fact, I do. I find that programming GUIs (in contrast to drag'n'dropping them) gives me more control and a lot of opportunities to remove duplication, which might be a bit more work to start with, but has a lot of advantages during maintenance.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
I agree Ilja but the original poster wanted to know if IDEs can be used for GUI. And also IDE is advised for rapid development. Thanks
Joined: Jul 14, 2008
Thanks to you all for taking the time to respond.
I don't think I made myself quite clear though, so to clarify my question;
Do many java developers in practice develop GUI apps solely using a textual approach?
I am just trying to get an idea of what is good practice, a straw poll if you will, and the reasons for adopting one approach over the other.
Having used IDEs for the last 14 years I am aware that they can be used, depending on the IDE, to produce GUIs ...... among many other things.
Ulf: Maybe you're right about companies letting the individual decide on the tools they want to use. I guess it's my Powerbuilder background colouring my view since Powerbuilder relies heavily on its' IDE (though as I said there are times you want to go in and tweak the code).
So when I am looking for contracts, Powerbuilder skill is what clients are generally looking for and since the term Powerbuilder refers to both an IDE and a 4GL I lump them both together.
Java, I now realise, is not like that since it's genesis is from the C/C++/Unix background (have I go that right?) which is predominantly text based.
I just found it odd that one would design something that was essentially visual by using a descriptive text. After all you wouldn't ask a guy to build your house by giving him a worded description of it, you'd give him a set of drawings. Same with graphic artists
........ but having said that when I design a web page I purposely use a textual approach (HomeSite)
..... so maybe I should look more closely at designing GUIs manually
Note that most Java programming doesn't involve AWT/Swing at all; most Java programming these days is server-side code, with GUIs in HTML. There are plenty of GUI builders, both for browser-based and desktop-based apps, and there are people and shops who use them, but I think you'll find that many if not most Java GUIs are, indeed, built with code rather than a graphical builder. The reason being that good hand-built GUI code is smaller, easier to maintain, and easier to test -- all qualities that the Java community places a premium on. Perhaps this is because there isn't a single unifying IDE, it's important that Java code be usable with different tools over time and space, and avoid vendor lock-in -- really good reasons to avoid GUI builders.
One thing that you many find that's a basic philosophical difference between the PowerBuilder world and the Java world is that Java applications are usually built with a strict separation between layers; many of the available tools try hard to make this possible. Because Java apps are built in separate layers, and technologies are mixed-and-matched across the layers, you don't have the single unified toolset that PB gives you. Instead, IDEs like Eclipse and Netbeans are themselves a sort of bazaar of different plug-ins that do different things; you can use whichever JSP editor or database tools or GUI designer is most suited to a particular task.
You may just have saved me from devoting too much effort on replicating and honing my GUI skills using SWING when I should have been concentrating on server side and HTML....... and, point taken re hand coding GUIs.
Just to back up Ernest's post a bit I too hand code Swing rather than using GUI builders. Most GUI builders use Gui Builder friendly layout managers (Netbeans' Matisse) which means that when it does come time to dig and and tweak some things it is much too complex. Not to mention just general code generation engine's really stink.
That said, I have lately been using a tool that allows you to define your UI in a YAML based file while all the grunt work is done in a Java file. The YAML file just takes care of things like:
button = new JButton("Push Me");
While the Java file handles all the events and what not. This has allowed me to keep my java files quite a bit cleaner. There are many libraries available that let you do this, most will have you define the UI in XML rather than YAML. Its just preference.
Also, helpful hint, when developing Swing GUI's Miglayout is your friend. It is a layout manager designed for hand coding UI's. I use it for nearly all my complex layouts.
Gregg's point about using a markup language is a good one. Occasionally I've used Thinlet as an XML wrapper around AWT. It moves the GUI definition to an external XML file. Now, Thinlet doesn't support Swing, so it's missing a lot of functionality you'd want in a complex app, but it illustrates the point.
Even in the standard Java library there is (limited) support for this; have a look at the classes XMLEncoder and XMLDecoder in the java.beans package. The API docs of class XMLEncoder contain an example of how to use this for a Swing GUI.