views:

566

answers:

4

Apologies in advance for the possible flame thread, but that's not what I'm going for.

I've only ever done serious development in Linux using C and C++, and I'm looking to take the plunge into Windows. I've been doing some reading and asking around, and it seems to me that .NET with C# is the way to go for developing commercial user-oriented business applications for Windows.

A big consideration for me is the integration of the user interface into the desktop, since this is what the user ultimately interacts with. Is it possible to recreate the look of the Office 2007 GUI in Java, for example, or is this only possible with .NET?

I'm also concerned about portability. In the future, I may want to port the application to Linux. I know about the mono project, but I'm wondering if it wouldn't be better to go with Java.

In short, what are the trade offs between Java and C# when developing commercial, user-oriented business applications primarily intended for Windows?

+13  A: 

The most important bit is in "primarily intended for Windows".

If you only need to work on Windows, C# is likely to be a much better bet than Java. There's a better variety of visual styles which blend in well with Windows. It also makes interoperating with native code (e.g. bits of the Win32 API or COM libraries) easier than Java. Personally I prefer it as a language, but that's a different matter.

If you need to run on other platforms, I'd seriously consider Java. While Mono has quite a lot of momentum, it doesn't have the same degree of compatibility with .NET as Java does on the various platforms it supports.

So basically, weigh up the "may want to port" aspect very carefully - it's the driving factor in the decision, from my point of view. Once you've decided to do a port, it doesn't matter much if 90% of your customers are on Windows - it'll still need to work, and work well, for the remaining 10%.

Jon Skeet
Code that works in Mono OK works that way on ANY platform. So your statement about compatibility with platforms is WRONG.
Mash
Compatibility is a two way relationship. Mono code working under Windows CLR is only half of the requirement. There are plenty of features which Mono does not support and as such there's plenty of .Net code written on Windows that does not work on Mono.
Mikko Rantanen
.NET 2.0 BCL 100% covered by Mono except some Microsoft Windows specific things. And there is very helpful tool http://mono-project.com/MoMA to migrate from .NET to Mono. Most of the time it takes just VERY little effort to run .NET apps under Mono.
Mash
@Mash: The coverage may be 100%, but that doesn't mean they'll behave the same way under all circumstances. Until Mono is built from the same source as .NET (as is the case in Java) I very much doubt it will have the same degree of compatibility. I think Mono's a great project, but I don't think I'd trust my business to it just yet.
Jon Skeet
In fact, just as an example: when someone was checking my MiscUtil library against Mono recently, they found a bug in Mono's handling of empty lines at the end of a file using TextReader. Also I believe Mono still has trouble compiling my Protocol Buffers implementation due to a compiler bug. (There were various issues before, but apparently it's down to just one now - I intend to take a look when I have time.)
Jon Skeet
I just wrote a Console.Writeline("hello") app in Windows, transferred it onto the Mono VMWare virtual machine and tried to run it. No go. Rewrote it by hand in mono and tried it on Windows. Works perfect. -10 for mono on this one. It was the VMWare image from mono-project.com so no wining about misconfigurations and stuff like that please.
Andrei Rinea
A: 
Mash
+2  A: 

Since you have an expirence with C++, you can go with C++ plus Qt for GUI. It's a good cross platform GUI library, and you can recompile the code to work in Windows, Mac, and Linux with consistent look.

Sure you can make nice interfaces with it, but maybe not as cool as MS Office interface (Microsoft blend).

You may consider it as an option. http://www.qtsoftware.com/products/

Examples http://www.qtsoftware.com/qt-in-use

Saleh Al-Zaid
Any Qt Ribbon out there?
Mash
I couldn't find one :S
Saleh Al-Zaid
+3  A: 

First off, whether or not your GUI will look good on windows will depend more on your skill with GUI design than it will on your choice of language or toolkit.

Windows Forms doesn't really give you full access to the Windows GUI functionality using the documented API. You'll have to make calls to native API functions or at least use windows-specific messages to achieve some effects. Also, I don't think there is a built-in way to access the Office 2007-style ribbon control. You'll need a 3rd party component for that.

A lot of .Net apps rely on 3rd party widget sets to achieve nice looking GUIs. Be warned that these frequently rely on P/Invoke or other windows-specific functionaly and thus don't work on mono. So if you really want a cross platform GUI, .Net is not the best choice.

You can also do .Net GUIs in Windows Presentation Foundation, but again this is not supported in mono.

GTK# works well on Unix and windows, though it looks slightly less native on Windows.

Java Swing is very cross platform and is looks pretty good with a platform native look and feel. You could download Netbeans to see it in action.

SWT is an alternate toolkit for Java that has slightly less cross-platform compatibility than Swing, but is still popular nonetheless. Eclipse uses this toolkit, so download that to see it in use.

karunski