Forms contra Swing, multiple GUI threads
One of my biggest annoyances regarding Java Swing is the single GUI thread limitation. This limitation was told by Sun to be implemented in Swing in order to "make things easier for the programmer and spare him from having to deal with manual synchronization and other low level threading mechanisms". I have always thought that this was a stupid decision by Sun.
Swing still suffers from it, even though Sun has put some workaround mechanisms into Swing in order to help solve some of the many practical problems that comes as a result of this design. Its like the sad "single message queue" limitation of the Presentation Manager and Workplace Shell of OS/2, which I believe was one of the many reasons why OS/2 suffered so much. Maybe the main reason for Sun to put the same constraint into Swing wasn't actually to "make things easier" but to "make Swing portable also to such kind of systems as OS/2"? I think so, but we wasn't supposed to bother.
Now, to me, Swing seems to be slowly fading away as well, while grat parts of the still strong Java community adopts more threading friendly alternatives such as Eclipse SWT. Thanks to SWT we have finally seen some really snappy and system integrated GUI desktop applications written in Java. I am considering jumping from C++ to Java SWT with my Larsen Commander application as well.
However, at my work I have to use .NET and C#, which is not a problem to me. But I miss the Eclipse IDE when I use Visual Studio at work. Anyway, after being working with C# 2.0 for some months now I am impressed by the language. It is so much more compelling to me than Java. I only need to think of such language constructs as true generics, operator overloading, properties, value types, no checked exceptions, delegates and "yield return", to convince and remind me why I like C# so much over Java and C++. I just hope that Java will get some of these soon. Particularly Java 7, which is on the drawing board.
But it is not only the C# language it self that seduce me. Likely significant is parts of the class library and runtime environment. I have already mentioned that I miss Eclipse, and I really do. But I don't miss the Java class library. To my experience the standard .NET 2.0 class library is as good a library as that of Java. In some extends even cleaner and better. Especially ADO.NET (contra JDBC) and .NET Remoting (contra RMI).
When it comes to Forms versus Swing I have found Forms to be more limited in functionality and flexibility, but easier to use by design. Especially when it comes to that issue regarding multi threading. In Forms you can have multiple threads performing GUI operations. Any thread can do GUI stuff. The main point is that the thread that created a GUI component is also the thread that must be used to handle GUI events for the component and/or perform method calls on it.
This really makes sense to me. I like it, and I am happy to finally be able build my GUI on a true thread context oriented class library. I am also happy not having to explain our customers why multiple parallel modal dialogs can cause various strange and obscure behavior. So happy that I am in fact now considering moving my personal Larsen Commander application to .NET and C# too. I hate to say and admit it, but it is true. I will probably do.
Swing still suffers from it, even though Sun has put some workaround mechanisms into Swing in order to help solve some of the many practical problems that comes as a result of this design. Its like the sad "single message queue" limitation of the Presentation Manager and Workplace Shell of OS/2, which I believe was one of the many reasons why OS/2 suffered so much. Maybe the main reason for Sun to put the same constraint into Swing wasn't actually to "make things easier" but to "make Swing portable also to such kind of systems as OS/2"? I think so, but we wasn't supposed to bother.
Now, to me, Swing seems to be slowly fading away as well, while grat parts of the still strong Java community adopts more threading friendly alternatives such as Eclipse SWT. Thanks to SWT we have finally seen some really snappy and system integrated GUI desktop applications written in Java. I am considering jumping from C++ to Java SWT with my Larsen Commander application as well.
However, at my work I have to use .NET and C#, which is not a problem to me. But I miss the Eclipse IDE when I use Visual Studio at work. Anyway, after being working with C# 2.0 for some months now I am impressed by the language. It is so much more compelling to me than Java. I only need to think of such language constructs as true generics, operator overloading, properties, value types, no checked exceptions, delegates and "yield return", to convince and remind me why I like C# so much over Java and C++. I just hope that Java will get some of these soon. Particularly Java 7, which is on the drawing board.
But it is not only the C# language it self that seduce me. Likely significant is parts of the class library and runtime environment. I have already mentioned that I miss Eclipse, and I really do. But I don't miss the Java class library. To my experience the standard .NET 2.0 class library is as good a library as that of Java. In some extends even cleaner and better. Especially ADO.NET (contra JDBC) and .NET Remoting (contra RMI).
When it comes to Forms versus Swing I have found Forms to be more limited in functionality and flexibility, but easier to use by design. Especially when it comes to that issue regarding multi threading. In Forms you can have multiple threads performing GUI operations. Any thread can do GUI stuff. The main point is that the thread that created a GUI component is also the thread that must be used to handle GUI events for the component and/or perform method calls on it.
This really makes sense to me. I like it, and I am happy to finally be able build my GUI on a true thread context oriented class library. I am also happy not having to explain our customers why multiple parallel modal dialogs can cause various strange and obscure behavior. So happy that I am in fact now considering moving my personal Larsen Commander application to .NET and C# too. I hate to say and admit it, but it is true. I will probably do.