Fog Creek Software
Discussion Board




Swing UI?

Hi... am a student working as an intern on a project that has a very short deadline: 4 months from now -> end of internship.

My team has been considering the development tools to use, and the one that came out very often was Java and Visual C++ (perhaps using Visual Studio 6).

We're hinging on Java because of prior experience, but I've read that Swing is a lousy set of UI components => there are very few commercially successful applications using Swing.

Of the 3 people working on the project, I'm the interface designer. My objective (in line with the project objectives of course) is to design and implement an intuitive WIMP interface for the project.

Am curious about the viability of Swing versus Visual C++?

Wei
Thursday, December 05, 2002

This has been discussed before. While some have tried to change my pont of view, I have not realy seen anything to change my mind. Swing is horrendous, It is probably one of the key elements as to why Java failed on the client.
If this is standard WIMP and you have the choice, try either .NET (C++ or C#) or WxWindows ( http://www.wxwindows.org/ ).

Just me (Sir to you)
Thursday, December 05, 2002

You can consider Qt from trolltech.com.

dk
Thursday, December 05, 2002

Heres a good online book about using QT with Python.

http://www.opendocspublishing.com/pyqt/

You might wan't to consider Python under such tight deadlines.  Even if they are using something else for the backend, Python will integrate with pretty much everything.

Ged Byrne
Thursday, December 05, 2002

Remind me, whats WIMP stand for again?

I have got a lot of Swing experience, and I have a tendency to code GUIs by hand - which isn't anywhere as fast as using a visual builder, but it at least allows you freedom in what IDE you want to use.

As for Swing being 'lousy', I don't know about that. Its lightweight for sure, in the sense that you don't get as many of the for-free features as you would with native features. All rendering is done in software, and Swing applications tend towards the memory intensive both of which hit performance. Used to be a really big issue on 400-ish MHz machines, but its less of an issue nowadays, and I personally find swing applications that I use (big heavyweight IDEs (IntelliJ IDEA)) to be fine from a UI performance perspective.

I think you have to assess the volume of screen development that you intend to do and pick the right tool for the job. As always, the best tool is usually the one you are most familiar with, especially when deadlines get shrunk. Do some quick prototypes in both environments to get a feel for them.

In general UI development is dictated more by familiarity with the UI APIs than anything else (those things tend to be huge) and is certainly something that stands well in Swings favour (its a well named API for sure).

Richard
Thursday, December 05, 2002

I second (third) Ot .

http://www.trolltech.com/

Prakash S
Thursday, December 05, 2002

well, I like Swing.  There is nothing really bad about it.

I like Delphi because event callbacks can be registered/unregistered at runtime.  C++ is full of message maps.

I would be surprised if you can sketch out a user interface that couldn't be implemented in *any* language / toolkit.  UIs are generally built from the same pieces - labels, panels, text boxes, trees, tabs etc - and all toolkits have these.  So it comes down to the language choice of the implementor of the UI.

Designing a UI and implementing it in abc language using xyz toolkit are two completely separate pieces of work.  The only thing that can slip up is if you do some fancy custom control requirement that can't be done in some basic toolkit.  But with swing, you can do custom controls easily.  You could with FOX or MFC or whatnot too I dare say.

C++ UIs are never pretty sourcecode.  If you aren't comfortable with C++ and C++ UI code, you ought avoid having to learn it as a dependancy of the project.

Nice
Thursday, December 05, 2002

Since you don't have much time to learn, I'd say just go with what you know.  Swing may not be that great, but it's good enough for most things.

Foolish Jordan
Thursday, December 05, 2002

WIMP = Windows, Icons, Mouse and Pointer.

Ged Byrne
Thursday, December 05, 2002

<<Remind me, whats WIMP stand for again?>>

<quote ref= http://www.jargon.net/jargonfile/w/WIMPenvironment.html >
WIMP environment /n./ [acronym: `Window, Icon, Menu, Pointing device (or Pull-down menu)'] A graphical-user-interface environment such as X or the Macintosh interface, esp. as described by a hacker who prefers command-line interfaces for their superior flexibility and extensibility. However, it is also used without negative connotations; one must pay attention to voice tone and other signals to interpret correctly. See menuitis, user-obsequious.
</quote>

Jan Derk
Thursday, December 05, 2002

"Used to be a really big issue on 400-ish MHz machines, but its less of an issue nowadays."

Please, PLEASE, don't assume for us. I still use a PII 350 Mhz at home. That's why I still hate Swing.

Leonardo Herrera
Thursday, December 05, 2002

Before recommending a development tool, a bit more info is required. Depending on the type of project, the targeted platforms, users, etc Java, C++, C#, VB, Delphi/Kylix could all be your best bet.

Personally I would not use Swing if you were, for example, only targeting Windows or for a commercial WIMP application.

Jan Derk
Thursday, December 05, 2002

I hear great things about SWT, a windowing toolkit for java which uses system widgets through JNI (I think).  It comes with the Eclipse IDE, which I also hear good things about.

I have yet to try either however.

Tom (a programmer)
Thursday, December 05, 2002

What kind of project are we talking here? Will it be a web application? Or an application running on a local machine? In the later case: Which operating system is used?

Also, it seems to me that you are comparing apples with pears (as we say in German), when you try to decide between "Swing" and "Visual C++". I am not a Java developer (just learned a little Java at university), but even I know that the Swing UI is not the only GUI library available for Java. And if you decide for the use of C++, the same is true. Here are different development environments and user interface libraries you can choose from. When you are talking about Visual C++, you probably have the MFC in mind.

Ugly as it is, the MFC does its job in most cases and you can find a lot of support and suggestions for problems on the web. I am not actually happy but quite content with it.
I would not go for the Visual Studio 6 version, though.

Using managed code and the .NET framework just for the user interface and do the rest in plain C++ might be a good idea, too. The documentation of the new .NET classes seems to be way better than the one for the MFC, and it looks as if it is pretty straightforward to use (I haven't tried, though).

But you should not choose your tools because someone here considers this or that language or library good or bad, but so that they fit your problem.

Have fun,

Jutta Jordans
Thursday, December 05, 2002

SWT is much fast for me, it was built specifically because Swing wasn't fast enough...

Scot
Thursday, December 05, 2002

faster...

Scot
Thursday, December 05, 2002

second swt. Download eclipse and try it while you are it. SWT and Jface are buried in there. Much much simpler than swing. I was thinking about approaching o'reilly to do a swing/jface book..?

Karel
Thursday, December 05, 2002

While I don't have a ton of experience in other UI technologies, Swing certainly gets the job.  I build "real", "commercial" applications with it, and it stands up to every challenge.

Pros:
- Swing is unbelievably well designed, which makes it extremely powerful for an experienced developer.  Can you do it in Swing?  Yes, you can.
- Swing is well documented, particularly in the 1.4 JDK.
- Source code for most components is included.
- Good user community and support from Sun.

Cons:
- Because of the power and flexibility of Swing, it is _very_ easy to design and build a poor application.  While I fundimentally believe this is true with most technology, it is more so with Swing (particuarly if you are building everything by hand).  Don't hand Swing to a herd of green devs and say build me a UI.
- It's Java, it can be sluggish.  You have to know who your target audience is.
- Sun seems to be rewriting major parts of it.  Swing seems to be at a point where Sun can't fix some of the problems with a band-aid any more.  So they are redoing big chucks of it, like the focus management sub-system in 1.4.  This can lead to compatibility problems and headaches.

All and all, Swing is powerful in the right hands.  If you have a good architect and smart devs, I'd go with it.  Otherwise, another technology might be more appropriate.  I, however, am going to read more about PyQt on OS X...

gee-dub
Thursday, December 05, 2002

and in the end...it's wxWindows for python

fool for python
Thursday, December 05, 2002

I am assuming this is a fairly decent-sized project. Given your deadline, I don't think you have the luxury of considering performance issues. Your main concern is to build it as quickly as possible, with the least number of defects while meeting the requirements. That means the language should be one that your team is comfortable (and productive!) with.

While it is tempting to use the coolest-sounding, most powerful language people will let you play with, it may well be that the most appropriate language is VB. It all comes down to what your application is meant to do, what platforms it must run on, the skill level of the developers, and so on.

As an intern, you want your employers to remember you as being the guy they would really love to hire again (even if you don't want to work there, a good reference helps) - especially in this economy. The way to get them to feel that way is to complete and deliver an application that meets their requirements -- on time. This happens so rarely that they will be stunned. 

So how to do that? Nail down the requirments, trim 'em down as much as you dare to for your first release, and THEN decide what the fastest, simplest, lowest-risk way of implementing those requirements are.

Sadly for us, the ideal approach is usually the least exciting, least sexy, most mundane.... you get the idea. I'm just going off and cry in my cubicle now.

Rob
Thursday, December 05, 2002

If you are simply building a Windows GUI app, can you tell me why you ruled out VB/.NET (or whatever the name of the week is)? 

Bella
Thursday, December 05, 2002

As someone who has done GUIs in both Swing and C++/MFC...

The Good:

Developing Swing apps in Java is faster and easier than C++/MFC. The GUI API is more elegant and I tend to find the Java standard libraries are more likely to have a function to do what you want than the C++ ones (which saves lots of time).

There are also some cutting-edge IDEs out there (IDEA in particular www.intellij.com) for Java development. IDEA doesn't have a RAD GUI builder, though.

The Bad:

Java apps are bigger and slower than native executables. They take longer to start up, take up more RAM and, as has already been mentioned, can be less responsive on slower machines. You have to make sure a sufficiently recent JVM is correctly installed on the client machine.

So, IMHO:

If it's an inhouse app that needs to be developed quickly and won't have to run on machines that are too crappy (like a 64MB P400), I'd go with Java/Swing. It will be quicker to develop.

If you're making shrinkwrap software for desktop machines, then go C++. You could make a Java app but a native code competitor will beat you every time for speed & ease of installation.

Andrew Reid
Thursday, December 05, 2002

I agree with everyone else as far as choosing a language that people have experience with.

If the whole team has experience with Java then Java will be a superior choice for a 4 month application. Even spending 1 month ramping up on a new language costs you 25% of your time.

If half the team has C++ and the other half has Java - maybe it is a good to figure out who knows "the most" about their language. That person could be a mentor for other people as they learn the language. Also, the language expert could do most of the tricky programming/development/debugging while other people get do more requirements gathering, usability testing, etc...

NathanJ
Thursday, December 05, 2002

If you intend to be a serious java developer, then I suggest giving swing a shot.  The improvements in the jdk 1.4 release are awesome.  If you know what you're doing, rapid development it a sinch.  Also the Latest netbeans IDE is rockin'

Moose
Thursday, December 05, 2002

It's rather annoying when you're running multiple programs and Swing apps on Windows stall for a couple seconds when you switch to them.  They're basically the last to wake.  So if you know your users use many programs, or very resource-intensive ones, Swing is not a great choice.  But if you just separate out the GUI from the logic, it won't be hard to port to another Java system.

v1 won't be perfect...

And Jython has a lot of syntactic niceness for Swing (and anything else using java beans.)  The jython o'reilly book is necessary though, last I checked.

Tj
Friday, December 06, 2002

The main swing drawback is non-standard user interface behavior for windows user. When 90 % of programs are native applications java one will behave little different and less predictable. Swing tries to emulate windows look and feel but this is only approximation. Little details will annoy user. Joel wrote about such small stresses that lead to dissatisfaction in his UI book.

IMHO java performance is not an issue on computers less than 5 years old.

Java/Swing programming is more fun and productive than MFC programming. You will deal with great designed OO library but not search where disappeared this @#$ message or something like this. Compare to swing MFC library is set of wrappers over api with huge legacy.

But if your program intends to have large audience you should rater prefer MFC (like I do) or delphi or vb.

Andrey
Friday, December 06, 2002

I agree with wxWindows/wxPython. I favor an application architecture where the number-crunching and application data management is in C++, and the UI is in wxPython. Haven't seen anything that comes close to this for large-scale development of scientific applications over the long haul.

Jeff Kotula
Friday, December 06, 2002

I am in charge of a technical application written in Java/Swing  and C++, plus a decent JNI bridge between.

We decided to build the GUI in Java/Swing and to write those parts in C++ that are required to yield considerable performance. Three years ago, this decision was quite risky,  but in the end it turned out to be a rather good way in our case. (Perhaps nowadays I'd consider SWT/JFace also).

None the less, I consider a project which is to be finished within four months a typical "death march project" (good luck to you). You won't have the time to look for the best solution; what you need is some kind of rapid prototyping, and for that I guess Swing (with a nice GUI development tool like JBuilder) is ok.

Roland
Friday, December 06, 2002

If the machines where the application will run have more than 128 mb of ram SWING is OK
Less forgot it.
SWING it's incredible memory greedy (this IS a fact)

Good Luck
P.S. Sorry for my poor english

Giorgio Pallocca
Saturday, December 07, 2002

Serious question.  (Perhaps b/c I lack VC++ experience)  Can someone explain why people are still building window's GUI's in MFC/C++/VC++/C++.NET (or whatever) ? 

Why are you not doing it in VB/VB.NET (or whatever) ?  All complex logic can be done in C++ and called as an external library, right?  I thoight this is how it went almost 5 years ago.

Or do you code GUI's in C++ b/c its the more circuitious esoteric route, thereby justifying high salaries, and job security?

Bella
Sunday, December 08, 2002

Wow! I didn't check for 2 days and I got 20+ really good replies! Thanks alot guys, I will go check out the APIs you guys mentioned.

Yup WIMP is Windows Icons Menus Pointers.

My team is very comfortable with Java (we're new to C++, which is really really bad). Besides, there are other aspects of the project such as database (planned in XML) and 3D manipulation (Java3D???).

Yes the scope of the project is immense, especially for 3 under-paid interns, but it's a good challenge and if (of course only if) we can develop a pretty good prototype, the school will prolly demo it or something.

Ever heard of the ACE framework? Basically we're gonna take the ACE framework (which is notoriously hard to use) and package it nicely with a UI and everything. The user would be able to generate C++ programming code for concurrent and networked applications, like a server for example in like 5 minutes. He would be able to customise the aspects of the server (like OS platform, expected load, etc) and then FURTHER edit it in 3D. Like add communications components to the server. Sounds big eh? =)

We don't have time basically. 4 months left as of today. I think Swing is pretty easy to use, though Java performance is always slow - due to the platform-independence maybe? I think it'll only be for Win32 because that's all we have.

I would like to learn C++ but I think there's no time to learn it well enough to do a pretty and efficient GUI.

I've looked into this Windows-like L&F called Looks Pro by jGoodies.com but it needs money, so that's out.

Wei
Monday, December 09, 2002

Well as for the VB.NET or VB issue, I think there's no issue really.

We have 1 semester of (disastrous) experience in VB.NET. =)

Wei
Monday, December 09, 2002

"I've looked into this Windows-like L&F called Looks Pro by jGoodies.com but it needs money, so that's out."

java comes with a windows l&f.  Maybe that wasn't what you meant.

Java Swing is going to be just fine.  Now start concerntrating on your problem, not your tools!  And good luck

Nice
Monday, December 09, 2002

Wei, by disastrous, I hope you mean that you learnt a lot.

Good luck.

Prakash S
Monday, December 09, 2002

Nice: Thanks, I will re-focus on the problems at hand.

Prakash: Well, disastrous meaning I hated the wordy syntax and did the project in C# and only got a "pass" score. =)

Wei
Monday, December 09, 2002

*  Recent Topics

*  Fog Creek Home