Question

Java and .NET are two languages targeted at removing platform dependence. This is achieved by adding a virtual machine/framework between the code and the OS.

So, what is the point in using it on the server side, as all websites are accessible via browser, and that is platform independent? Is there any special reason for using them?

Was it helpful?

Solution

.NET is meant for the Windows platform only. Java is the only one of the two that is meant to be platform independent.

These languages have a strong presence on the server end for many reasons:

  1. Lots of libraries that handle the subtasks of the problem
  2. Both frameworks are built with security in mind
  3. They are managed languages, it is much harder to pull off the typical attacks on software.
  4. They are considered to be mature technologies, they have been put to quite a bit of abuse and have stood the test.
  5. They have industry support.
  6. Both are object oriented
    1. This means that there is the ability to either develop a web site through the use of reusable components or third party components.
  7. Both language allow "sandboxing" of non-managed components (Java: JNI .NET: Boxing) [allows inclusion of legacy components]

OTHER TIPS

They're actually chosen for almost completely opposite reasons:

  • Java's platform independance means you're not tied to one platform and are thus more flexible in choosing the most cost-effective platform, or the most reliable one. And you can keep your apps running even when you have to change server platforms because the old one isn't supported anymore.
  • .NET is chosen because if you're going to tie yourself to an OS, Microsoft is the biggest player and thus the least risky option - or simply because companies fell into the "All-Microsoft shop" trap through gateway drugs like Exchange. And once you're there, .NET is what Microsoft wants you to use and supports and integrates with all their current tools.

Both Java and .NET have their own benefits for the server-side.

For example, with .NET you are free to pick the best language for the part of the application you are working on, and all of these .NET languages work together.

So, you may want to use F# for the data mining functions, C# to work with the database, unmanaged C++ (going through a thin managed C++ layer) for fast network connections, or system calls, and there are a host of other languages. .NET is less platform independent currently, but language independent.

Java can be used on several different OSes, which is advantageous if you are selling a solution, since you don't care what OS the customer is using.

Now the JVM is becoming less language dependent, with Clojure and Scala running off of it, so Java has become more interesting now, for designing applications.

They virtualize the underlying system, so they can be run on different kinds of server operating systems.

And, they are designed to be general purpose application development systems, so they are intended to be run on anything with a processor.

If you are asking because you do not understand why one would accept the overhead of an abstraction layer, keep in mind that both Java and .NET JIT down to native code.

So, what is the point in using it on the server side, as all websites are accessible via browser, and that is platform independent?

Well, web applications are not just rendering HTML for fun, they are doing things on the server-side that may involve talking to database(s), sending messages to a MOM, etc.

Is there any special reason for using them?

This is a partial answer but I wanted at least to cover the case of Java here. I could start by arguing that Java is a safe, robust, garbage-collected, object-oriented, high-performance, multi-threaded, interpreted, architecture-neutral, cross-platform, buzzword-compliant programming language... but this wouldn't really answer your question. Actually, the big deal with Java on the server side is IMO that you benefit from standardized Enterprise APIs (aka J2EE) that allow you to do "enterprise things" (JDBC, JTA, JMS, etc) in a standard way with hardware, operating system and software vendor independence (which is a big plus for contract negotiation). In other words, Java is perfect for heterogeneous environments which are almost always the case with big organizations and doesn't lock you in.

While platform independence are great to strive for I would say Java and .net are commonly used as there are a large number frameworks available which make it so much easier to develop enterprise level applications. This is especially true with java, where you have an incredible choice of high quality technologies most of which are flexible enough to meet the needs of most projects, allowing you to focus on your application's functionality.

Also, without no intent to start a flame war, Java and .net have better development tool support and are easier/quicker to develop with for your average programmer.

In early web days, it was mostly Perl and occasional brave souls who didn't like Perl or wanted more performance used C++. Then Sun developed JDBC and Servlets for Java, and then other J2EE pieces, and Java became a higher performance alternative to Perl, and easier than C++. With J2EE came a lot of application server products from big companies, and now you have a big Java web/app server community.

Then Microsoft came along, after losing the J++/Java war with Sun, and created a similar web app infrastructure with .NET. With .NET you have fewer choices, with all of the advantages and disadvantages that brings.

So, I think the answer is a mix of decent performance, safety and enterprise features, and major corporate backing. C++ is too hard and dangerous for most people. Perl, PHP, Python, and Ruby have their fans, but not the corporate backing. I don't think the fact that Java/.NET are on Virtual Machines is important for the server side. Java used a VM originally for the client. Sun had to work hard to make a fast sever VM. I think Microsoft used a VM to compete with Sun, and to make it easier to support multiple languages. It will be interesting to see if Google's Go language takes off, which may surpass Java and C# for safety and power but no VM.

the browser doesn't have access to the server resources (database, files etc.) that those frameworks have access to. You couldn't have an application that is only javascript (and does meaningful things)

I understand your question this way: why choose Java or .NET if there are more other comfortable ways to setup a server because the clients use HTTP to access the server?

You are right that the server OS or framework does generally not matter to the client.

However the client side also can contain applets or code that then needs to communicate with its counterpart on the server. Then JSP or .NET becomes more interesting as you do not have to manage different client OS's. Then website become easily extensible.

If you want to integrate some nice graphing and charting solutions (Telerik, Dundas, ... or whatever - not meant to be advertisement - ) from 3rd parties you would also have to select a compatible server infrastructure to run them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top