views:

396

answers:

9

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?

+8  A: 

.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]
monksy
NET is NOT meant for the Windows platform only. There are several 3rd party frameworks, MONO for example for other platforms
ArsenMkrt
You said several, could you please name a few more, at least one more. My intention is just to know another. Please.
Adeel Ansari
Mono is not a mature platform to run enterprise server applications. It is a decent implementation, but it is nowhere close to the J2EE or PHP for web systems. Have you tried to test the compatibility between mono and MS's .NET?
monksy
Vinegar, I did.. but is there a reason that you ask for a specific number of reasons?
monksy
This answer should not have been down voted. The five reasons given outside of the Windows .NET framework platform neutrality are acceptable and uncontroversial.
Amir Afghani
dotgnu (http://www.gnu.org/software/dotgnu/ ) is the seccond
ArsenMkrt
Ah. Thank you ArsenMkrt.
Adeel Ansari
.NET *is* available off the Windows platform, and *has* been standardized. However, it is certainly *strongest* on Windows, since Microsoft debuted it for their own platform, and spends a lot of time, money, and manpower to keep it up-to-date and potent for its own systems
warren
6.1 st reason seems to be the main reason for using them...
Xinus
Other than enums, in what way is Java more OO than .NET? I'd say that .NET has a better story around the whole value type boxing etc, and allowing you to call methods directly on value type values.
Jon Skeet
Point 6 seems debatable on both ends (read about what Alan Kay says about object orientation, which he invented), and 6.1 seems to imply that there is no reuse without object orientation, which would be plainly wrong.
Svante
@Svante: If you create any component in .NET you can use it anywhere either Desktop and Web applications thats what I think steven wants to point out
Xinus
monksy
@ArsenMkt: (funny name btw) I haven't heard of dotgnu... I hope it doesn't share the same downside as GCJ.
monksy
@steven, re: java is more OO than .net. Based on your comment, I don't think you understand what object oriented means.
Jeremy
@jeremy: Could you explain your arugement? My arguement is that Java is designed for OO compared to .NET. (There are trade offs on each interpretation)
monksy
steven: dotgnu has its stong points, e.g. WinForms were working reasonably well in dotgnu years before they did in mono (assuming they already do...)
ammoQ
Wow... I'm impressed ... I followed the Mono community and the controls were a thorn in its side. [Along with a decent IDE cough cough]
monksy
What does boxing have to do with unmanaged code? Did you ever actually use .NET?
nikie
I can't remember the official term for it with .NET, but what I mean to say is create a private sandbox for unmanaged components. [C++ dlls, etc]
monksy
Java may be a more robust cross-platforms language than .Net but this list does not provide sufficient support for that viewpoint. This is a very amateurish post that seems to do little other than dress up opinions and prejudice as facts. That's not the way to have a technical discussion, in my opinion.
Wedge
@wedge...yes you are right about the comments... however the post was neutral as Amir stated.
monksy
@steven claiming that .Net is a "good attempt" at object orientation is either flamebait, ignorance, or just silliness. But it is not neutral.
Wedge
@wedge... I removed it, I did not try to make a claim that it was inferior or a bad solution.. I was hinting that it could be a bit more robust
monksy
A: 

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)

Marek Karbarz
That's not true actually, using a database with a REST API you could implement an application entirely in javascript (which has been done). The only problem with this is that you can't make an application secure (at least not yet) when you write it in such a way.
Wedge
I should point out that I mean entirely in-browser, client-side javascript applications, server side javascript has been around for a while (though isn't very popular currently).
Wedge
+2  A: 

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.

Jeff Katz
"both Java and .NET JIT down to native code" -- still JIT takes some time to compile
Xinus
But it is a one time effort (not really impacting on a long running application)
jdehaan
@xinus, and the runtime compiler may look ahead and optimize
Xepoch
+3  A: 

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.

James Black
A: 

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.

jdehaan
but do you require JVM/framework on server side to embed applet or activx component in website ?
Xinus
No but if you want to dynamically load data from the server or exchange data with other users logged in you could do so more easily. If the client applet works on its own, it is not needed of course but that would be a rather autistic applet.
jdehaan
+6  A: 

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.
Michael Borgwardt
+1 - the key point is why they are chosen ... particularly at the enterprise level.
Stephen C
+1 for gateway drugs like Exchange
dotjoe
+1  A: 

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.

vickirk
+2  A: 

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.

Pascal Thivent
+1  A: 

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.

Greg Graham