Merging modern software development with electrons and metal
Random header image... Refresh for more!

Java Versus .NET For Desktop Apps

This is my take on choosing between Java and .NET for writing client applications.  I’m writing off the top of my head, since if I start doing research, I’ll up with a 10-post series that will be done next year or so…

Although both Java and .NET are good programming platforms, I think .NET is the default choice for industrial automation programmers writing Windows desktop apps because it’s a good choice, Microsoft is dominant in the industrial sector, and Microsoft typically has the best GUI designers.

Both Java and .NET are mature and extensive development platforms, with many choices of target devices, programming languages, IDEs, and libraries.

Targets

Java doesn’t quite run everywhere, but it’s available on a wide variety of platforms, such as Windows PCs, Linux, MacOS X and many embedded systems.  Android is closely modeled after Java, although I’m not sure how close the libraries are.

.NET’s full runtime is available on standard Windows; subsets are available for Windows 8 RT, Windows Phone, Windows CE, and via the independent Mono project, Linux, Android, iOS, and MacOS X.

IDEs

The most popular Java IDEs are Eclipse, NetBeans, and IntelliJ.  Eclipse and NetBeans are both open source.  Eclipse has a lot of add-ins, and is also widely used in non-Java applications such as embedded development.  NetBeans is supposed to have a good GUI designer.

Visual Studio is by far the dominant .NET IDE; it is an excellent IDE, but there are also two good open source IDE’s, SharpDevelop (aka #develop) and MonoDevelop.  The Visual Studio Express editions are free and quite powerful, although if you’re doing a lot of development I’d recommend paying for the professional version.  The last version that can run on Windows XP systems is 2010; VS 2012 can compile code for XP, but won’t run on XP.

GUI

The main Java GUI libraries are the original AWT, JFC/Swing (probably the most used), SWT (used by Eclipse), and JavaFX  (targeted for Rich Internet Applications).

The main .NET libraries are WinForms and WPF (based on XAML). I’ve heard good things about Microsoft’s Expression GUI designer (used for WPF); I’ve just checked and Microsoft is integrating Expression Blend into Visual Studio, while Expression Designer 4 is now a free download without tech support.

My impression is that .NET has better GUI designers, but Java’s libraries have better layout managers (for creating a GUI in code).  There are definitely many more graphical components available for .NET (spreadsheets, charts, reporting, etc).

Libraries

Both Java and .NET have a lot of good libraries available.  In fact, there is a lot of cross-p0llination: good libraries on one side are often ported to other side or inspire projects on the other side.

Books and Resources

Unlike in the PLC world, there are a lot of excellent books available for both Java and .NET, including programming, development techniques, and advanced topics.  Plus, there are tremendous resources available via the internet including blogs and Q&A sites such as StackOverflow.

Amazon and its multitude of reviews are a great place to find good programming books, new or used, but if you’re looking for eBooks, remember to check out the publisher, too.  For example, if you buy an eBook from Manning, you get the book in three formats (PDF, ePub, Kindle).  Also, many Manning books include a downloadable PDF of the book if you register it.

I typically buy used books from Amazon because I still prefer real books, and they’re much cheaper than most eBooks.

Other Programming Languages

One of the best features of both .NET and Java are the many programming languages available that are pretty (but not perfectly) compatible with the other languages in that ecosystem.  This makes multi-language programming eaiser; for example, you can use C# for the foundation and IronPython to add interactive scripting to a .NET application.

The top alternative Java languages are Groovy, Scala, Clojure, Jython, and JRuby.  The top alternative .NET languages are F#, IronPython, IronRuby, and Boo.

6 comments

1 Oliver Heggelbacher { 07.05.13 at 4:52 am }

I’d like to comment on this because we really had to decide for a framework for industrial desktop apps a few years ago. I’d certainly agree on the .NET preference over Java, but I’d like to throw in for discussion our own choice:

“Qt”

Now I am aware the outlook of having to code some parts in diehard C++ is not too exciting.

But with the new QML/Javascipt declarative UIs we could nicely separate the critical automation code from the fancy and playful UI elements. In fact, for the UI quality the Qt + Qt Quick approach really shines. We recently implemented some industrial control apps that truly wowed our clients.

2 Tony { 07.05.13 at 7:43 am }

Thanks for your feedback.

Yes, Qt is certainly an interesting option. I haven’t used it yet, but I’ve always heard good things about it.

If I were programming Qt, I’d very tempted to use either Python (PyQt) or LuaJIT and the appropriate Qt bindings. Also, the Qyoto bindings allow the using Qt from .NET.

BTW, Microsoft’s WPF also supports declarative GUI’s, and the Expression products were specifically designed to allow graphical designers to design to UI’s while the programmers coded.

3 Oliver Heggelbacher { 07.07.13 at 12:49 am }

Tony,
It’s interesting to discuss this from an industry automation viewpoint, really appreciate your initiative here.

Right, the Python bindings ( http://qt-project.org/wiki/Category:LanguageBindings::PySide ). Totally blanked out that you do not need to resort to C++. I realize this is an attractive path, especially for environments where you already deal with Python for control & automation tasks.

On a Java note: We do projects with linear servo drives from Swiss JennyScience http://www.jennyscience.de/en/. Their servo controllers have a XPort TCP interface and serve a Java app for setup. Quite unique, and I do like that this is truly cross-platform. Setting up and testing their linear drives is really a breeze, but the Java JRE requirements and execution of unsigned Java applets somewhat breaks the user experience.

About WPF I admit I have zero knowledge. Our freelance developer ( Frankie Simon ) actually came from .NET, and I sort of dragged him over to the Qt turf. Maybe he would want to add something.

4 Frankie Simon { 07.09.13 at 5:11 am }

Hi Tony, Oliver.

I had a few months of WPF development in a previous project.

Without going into depths (it was quite a while ago) I can say that things got really complicated really fast. There is something very much more intuitive in the way Qt handles the different parts – they just sit together well and it’s easier to get the desired results without hitting many walls.

As for the declarative UI, I really was blown away by how easy it was to get the UI going with Qt Quick. I remember this supposed separation of UI and code as a selling point for WPF but like I said, it was a lot more clumsy than Qt Quick. I spent a lot of time hunting down specific properties in MSDN or trying to understand why the designer misbehaves.

Maybe WPF is better now than a few years ago, but I’m definitely very happy with the current state of Qt / Qt Quick.

5 Tony { 07.09.13 at 2:20 pm }

I haven’t used Qt or WPF, so your feedback is welcome. I’ve looked into both a litle, but right now I’m using good old WinForms since it best matches the project’s requirements. I think your results may partly depend on the language you use; I’ve heard Qt is a particularly good fit with C++, and although still nice, not quite as good a fit with, say, Python.

6 Frank { 07.18.13 at 11:21 am }

Thanks for the tips Tony, I’m thinking of pursuing the .NET path for my planned PLC simulator project. I am hoping to be able to configure the interface to emulate most of the bigger manufacturer’s (AB, Siemens, Omron, Mitsubishi, Koyo, GE, Modicon…) by substituting I/O designators (I, X and O, Y, Q) and platform specific instructions, sort of run it in different “modes”. Would like it to do off-line emulation/simulation and ideally interface with Ethernet I/O. I don’t really want to develop a full blown PLC platform (mostly due to liability concerns) but I think it could go a long way in training classes. Do you know if there is an existing kernel that could be used to convert Ladder –> Instruction List and then actually run the logic? seems like this would be out there somewhere, maybe not open source but not too expensive.

Leave a Comment