Matt Hughes asks:
"When does one programmer's preferences (Java over Microsoft-anything because they hate Microsoft, or Microsoft over open-source because open-source is evil) and the variety of choices start to erode productivity? As a J2EE developer for the past few years, I admit that I've become frustrated at the number of choices out there. Every one offers a different way of doing things but they don't all interoperate (JBuilder doesn't natively understand Struts) and none of them -- in my experience -- pulls all of the web technologies together very succinctly. Does Visual Studio .NET and the .NET framework pull this together better than the open-source projects out there, or is it just as complicated in your experience? Is .NET too immature to be trusted? What are your thoughts?" For those interested in the raw performance numbers, Slashdot did a
performance comparison between the two technologies, in an earlier article.
"I've recently been asked to produce a report listing the pros and cons of J2EE and .NET as a web application development platform. I've been using J2EE for years now and haven't even touched .Net as I dislike most Microsoft products. However, for the report, I am trying to be objective. From my own experience and from what I've read, it seems the defining issue for some people is choice.
As far as language preference, some argue Microsoft allows too much (VB.NET, C#, and supposedly everything else *eventually*) and J2EE too little (Java). As far as development environments, Microsoft offers too little (Visual Studio .Net, Windows Server 2003, Windows only) and J2EE
provides too much (JBuilder, Eclipse, Tomcat, JBoss, Websphere, any OS/hardware combo, etc)."
I think everyone suffers from the Maslow Hammer syndrome. We all prefer to use the tools we already know. This is not an entirely wrong attitude, since anyone is more proficient with the tools used regularly. The Maslow Hammer syndrome is dangerous only when its threshold is so high it prevents changing to a tool that is much better. This is not the case for either of J2EE/.NET. If I changed to .NET now, I'd take a few months to develop as fast as I do now in Java.
If at first you don't succeed, skydiving is not for you
I haven't coded neither Java or C# much, but I know the basics for both of them. C# to me seems a bit clearer and easier to get a hang on than Java. I also like the fact that I can code in C#, Smalltalk, Eiffel, ilasm (yeah right;)) or some other language, and if a Visual Basic programmer want to use my classes (s)he can just use them, like they were native classes.. No modifications needed. No wrappers needed.
I haven't done any testing on raw performance, but I have noticed that running "mono app.exe" starts the app almost as fast as a native app while Java takes WAY more time to start up.. Also, Java seems to have much more RAM overhead..
My other account has a 3-digit UID.
The choice between .Net and J2EE is a cultural one. Many companies would rather have one solution, even if it limits them in many ways. Others would rather have more flexibility, even if it means more work (learning how to use struts and JBuilder together).
.Net isn't easy to use on accident. Each company chose their strength and built around it.
J2EE technologies aren't flexible by chance and
Okay, here is my anti-disclaimer. I _AM_ a web developer, and I do web development all day long, every day, since there was a web pretty much.
.Net model encourages a better web architecture (IMO).
.Net solution performs better. So thats 1. The Java code might be more "correct" OOP design, but in terms of maintainablilty, mediocre code, vs 4X perfect code is gonna be a close call. And I don't think the .Net code is mediocre, its very readable. And the Java code isn't perfect. So in my book, .Net wins the pet store competition.b
.Net (specifically C#). .Net has a problem of swallowing exceptions. In Java you have to declare what any function can throw. Therefore the caller of your function can know to handle the error, pass the error, or ignore (swallow) the error.
.Net is a reality too.
When JSP first came out, it was a significant step forward from the tool that I was using at the time, ASP (classic). The advantages were many. Exception handling, and objects were the primary ones. Other things (like being strongly typed) also were a significant step forward. Yes you could get many of these things by doing your ASP development in JScript, instead of VBScript, but nobody really did.
However, the disadvantage of Java : over-architected. If you follow the blueprints, or examples provided by Sun, or Apache, or any other big shop out there, you end up with thousands of classes. Java itself doesnt have this issue, (IE, the language does not require this) its more of the paradigm that the whole J2EE world evokes.
ASP.Net has many of the same advantages that JSP has. Exceptions, classes, strong types (if you want them)
However, as a bonus, the
For example, take a look at Java Pet Store vs PetShop.net. Yes there are complaints from the Java world that its not a fair comparison, because they did things differently. THATS THE POINT. If Java encourages you to do things in a way that uses 4x the code, and runs slower, thats a problem. Microsoft is under no obligation to do things in an inneficient manner to match Java, because thats what Sun wants. MS set out to compare "how much code to make this functionality happen, and how does it perform"
Some may say : but the Java code might be better architected! How do you judge architecture? Only 2 things matter. Maintainability, and Performance. The
Now, from a platform perspective, Java did some things that I wish would have made it into
Since you dont declare exceptions in C#, callers of functions have to be prepared to handle any exception. As a result, most callers just end up catching Exception and then they never get passed up.
Some other things are enviromental. Visual Studio.net is FAR AND AWAY the best IDE I have ever used. Seamless integration of HTML, code, Javascript, database etc. Integrated debugging of client and server side code, including database calls (it will jump into the stored procs and let you step through them!)
While integrated debugging is something available in Java, I have not seen it to this degree.
Also, ASP.net seems much easier to extend. Making new controls (user controls or server controls) is trivial compared to the work required in Java.
Now, Java's big claim to fame is of course cross platform compatibility. If you need to run on Unix TODAY, then obviously go with Java (or python, or perl or whatever)
But Mono is just around the corner. Mono will already run iBuySpy (a pretty complex app) without modifications. So cross platform for
The two technologies are really targeting different markets. J2EE is really aimed at large enterprises. As such, it was designed primarily for scalability (not performance). That means lots of layers, etc. so that they can be put on different machines and clusters and stuff like that. This makes J2EE more complex as well but once you learn it, you can do more with it. J2EE application servers also do a lot more for you than Microsofts application server technology. .NET (as with all MS software) is really aimed at the small to medium sized enterprise. MS is focused mainly on making their stuff easy to use. So the learning curve isn't as steep, but once you start building more sophisticated applications, .NET is not as flexible.
.NET. Visual Studio is really easy to use. While the Java folks have spent the past few years focusing on refining the technology itself - tool support has suffered. However, that will soon change - Eclipse and Netbeans are coming along and Sun will soon be releasing new easier to use tools.
.NET. You will be locked in if you use it. Mono is coming along nicely but do you really think that MS will maintain compatibility with it in the long run? Given their history, I seriously doubt it. With Java and J2EE I can setup complete development and production environments without paying a single license fee. There is also healthy competition in the J2EE app server market so if you are using Websphere and IBM pisses you off, you can dump them and switch to BEA (with minimal porting effort).
Tool support is the biggest draw to
You also cannot ignore the proprietary nature of
Like you, I've also had to evaluate both technologies (I work for an enterprise consulting firm) and believe that J2EE is the way to go. Initially, it may cost more (if you use the proprietary software) but it is worth it since you have far more control over it and more options.