views:

547

answers:

8

I have seen a few examples where the architecture is that there is java on the server side and c# on the client - what makes this combination so good? why would .net on both sides not be a better choice (or in fact, java on both sides?)

added later: in lots of cases, the java is hosted on a windows server itself, i think via tomcat (not 100% sure) - what's the motivation here?

+2  A: 

Data interchange formats like JSON make it far less important that the systems on either side of the connection are the same low level technology.

Java is a very well tested and supported language for servers, whilst C# has great tools for building GUI's.

justinhj
Short and sweet. I personally feel that C# is slowly building support on the server, but the lack of cross platform is a big pitfall. Mono replicates most of .Net, but not everything or the same.
daub815
Re data exchange: indeed. Although for system-to-system, xml would be more ubiquitous, with portable binary formats like "protocol buffers" slowly gaining momentum.While Java *is* well tested and supported; so is C#/.NET - but yes, tools like WPF do allow very powerful client development in C#/.NET
Marc Gravell
+4  A: 

Well, there are a lot of cases where .NET is used at both ends (and I would guess ditto for Java). But my guess for the motivation behind Java-server/.NET-client architectures is that the application is targeting Unix as the server OS, either for cost or reliability reasons, or because it needs to fit into an existing Unix server environment (e.g. working closely with existing Unix apps), but is targeting Windows as the client platform. (I think Java is probably much less common where Windows is also being used as the server platform; no figures to back this up though.)

If a Unix server OS is assumed, then Java is a very productive choice, well supported with lots of libraries but with a larger developer base (at least in "enterprisey" environments), and more "management" recognition, than alternatives such as Perl, Ruby or Python.

Conversely, .NET is the better fit for the Windows client, because it has much better support for building Windows GUIs. It's not just the tooling: the Java GUI APIs themselves (e.g. Swing) tend to prefer cross-platform similarity over a native look and feel, and therefore tend to result in apps that don't look or behave like Windows applications. (I am generalising a bit here -- sorry!)

itowlson
+12  A: 

Java is frequently used on the back-end (and has become the de-facto standard) for a number of reasons:

  • Java can run on various operating systems transparently, from Windows development workstations to dedicated unix servers.
  • Java enforces a modular, object-oriented approach to coding, which allows for large-scale systems to be written (hopefully) without becoming unmanageable. (this is also true of C#/.NET, but not true of other back-end languages such as Perl or Python)
  • Java is frequently used in back-end systems (the more popular a language is for a particular application, the likelier it is that there are mature libraries and tools in that language for that particular application)

C# has great tools and libraries for designing UIs in Windows. Java's operating system (OS)-independent nature provides fewer tools for the particular quirks of an OS's UI, whereas C# is designed and maintained by Microsoft, for the purpose of writing Windows applications.

Elliot Kroo
As an aside - IMO the bullet points all apply equally to Java and .NET... so I'm not sure they are the "reasons" - simply "Java got there first" accounts for a lot of it. .NET/C# are still heavily used in server usage; it isn't just windows applications. Indeed, since a lot of development is web-based these days, you could argue that (by the numbers) *most* of .NET/C# development is used on servers; broken down into ASP.NET, Mono Rails, WCF servers, socket servers, remoting servers, ASP.NET MVC and others.
Marc Gravell
Besides the OO approach, do the other buller point *not* apply to .Net. Java is platform independent and can be used on a small Linux server when starting and move to huge Solaris or Aix machine when you need heavy iron. .Net is by Microsoft, for Microsoft (Mono is a incomplete not up to data always-catching-up clone).
+2  A: 

Java is considered more mature, which is a good attribute for a server, whereas C# has better integration with/similar look and feel to windows and office (which the clients like)

Peter Lawrey
A: 

Most servers are either Windows or *nix based. So at the server, either Java or .NET/C# (via mono on *nix) would be perfectly good.

Java has better support for different client devices, but in many ways that requirement is being replaces by the much better HTML support at most clients - at least for online devices.

For a installed client application, then arguably Java has the better portability - but with things like Compact Framework, Micro Framework, Silverlight, etc .NET is catching up.

Personally (due to job role), I care mainly what is at the server; .NET/C# has never let me down - but I'm not a Java developer, so I can't contrast directly. From work on open source projects I know there is a good community of people out there using mono on the server.

At the client, tools like WPF offer a first rate GUI experience, with .NET's support for winforms being useful for regular windows apps. But since a lot of the WPF architectureis common with Silverlight (with Moonlight as the mono twin for *nix etc), this allows the experience to be used on non-Windows clients too.

Marc Gravell
Mono can not be compared to .Net. Mono is an incomplete, not up to date and always-catching-up clone. There are people using it on *nix servers, but not a lot. Windows people prefer developing for a full, up-to-date stack (.Net) and Unix people don't want to be second class citizens (Mono plays catch-up remember), while mature, proven and risk-free (patents!) alternatives exists for their platform. If you care about platform-independence, java is the way to go, also on windows. If you only program for windows, .Net is an option.
Well, .NET is also incomplete. If it was complete, they'd stop changing it! I know first hand of many people who use mono on production *nix servers. And there are definitely (isolated) areas where mono has a lead (the compiler as a service, for example). I think you are over-simplifying things by saying what "Windows people" vs "Unix people" want. Ultimately, we all just want to get the job done to the appropriate time/budget/etc constraints, get paid, and go home.
Marc Gravell
A: 

As far as Java is concerned two things

  1. Linux. Its reliable and cheap. One of the many reasons enterprises use a lot of Linux for Java because they don't have to reboot boxes after Patch Tuesday.
  2. Hotspot. Its one of the wonders of the modern world - amazing performance.
Fortyrunner
A: 

Fortyrunner, I haven't seen a single benchmark where a hotspot JVM will beat MS CLR.

A: 

On the server side Java has proven to be robust and scalable and it is available on platforms that .NET can only dream about. Hence if you want the most choices in hardware Java is an excellent choice - this includes very large machines with many CPU's as well as lots of clustered cheap x86 boxes.

If you have .NET on the server side you must use Windows, and Windows simply doesn't scale well hardware wise.

Thorbjørn Ravn Andersen