## CSDN博客

### 两个不同信仰的博客对.NET和Java的争辩

2003-01-12

Article Type: News

101 Reasons Why Java Is Better Than .NET

I am building a list, that's actually inspired by "101 things that the Mozilla browser can do that IE cannot".  Its a list of 101 reasons of why Java is better than .NET.  101 reasons is actually a pretty ambitious number, however its always good to aim high first.  If you don't succeed you could always relax the criteria for success!

Anyway, I have now accumulated 71 reasons. I will be blogging them in increments of 5 each day.  Hopefully, with feedback and suggestions from the community, the goal of 101 reasons will be achieved.

Here now are reasons 1 to 25:

1. Run on Multiple Platforms from the Smallest Devices to the Largest Mainframes.

Run on multiple platforms, from smart cards, embedded devices(JStamp), cell phones(Nokia, Motorola, Ericsson etc), pdas (Palm, Symbian, Sharp),laptops and desktops (MacOS, Linux), servers (Unix based), Non Stop Servers (Tandem) to Mainframes ( IBM ).

2. Run Dynamic Languages

Run Dynamic Languages like Python (JPython) , Scheme (JScheme, SISC, Kawa), Ruby(JRuby), Smalltalk(Bistro). In comparison a commercial development effort to port Python to .NET showed dismal performance. Furthermore, a paper comparing the CLR and the JVM came to similar conclusions .

3. Compile in One Platform Run in Another.

Visual Studio.NET and .NET SDK End User License Agreements specifically states that code compiled with it cannot run in non-microsoft platforms.

5. No mandatory upgrades. No subscription fees. No software insurance fees.

How many MIS organizations are held hostage to microsoft's draconian licensing policies?

6. Run Multiple Versions of the VM (Runtime) on the Same Machine

Its common to have multiple version of the Java Virtual Machine (JVM) available and running simultaneously on the same operating system. This is useful if you need to test your application on different version of the JVM. Try doing this with .NET.

Its common for Windows based products to have several machines with different versions of Windows to do tests. In fact, this is in fact such a big problem that even Microsoft licensed the use of VMWare (a product that allows you to run multiple virtual machines) for its 6,000 salespeople .

7. Large Innovative Open Source Community

The existence of a large body of open source code is value that should not be ignored. This provides developers an enormous repository of code that can be reused. In fact, most .NET open source projects are rewrites of Java projects.

8. Low cost Commercial Quality IDE's

The Eclipse and Netbeans IDEs are free for any kind of software development. JBuilder and JDeveloper are free for educational use. This is in stark contrast with .NET where Visual Studio.NET costs almost $500. Also, if you think sharpdevelop is commercial grade, think again! 9. More Available Jobs A search on Monster.com will quickly reveal that there are 10 times more jobs that require Java skill than C# jobs. In fact a third of C# jobs require Java skills. 10. Better and Standardized Connectivity to Legacy Applications The Java Connector Architecture (JCA) is a standard for connecting to Enterprise Information Systems (EIS). JCA supports access to SAP, IBM CICS, PeopleSoft, Oracle, Siebel, Screens 3270, AS/400, Unisys, ADABAS-C, VSAM, Codasyl, IMS, Tuxedo etc. This level of connectivity options in unavailable for .NET. 11. Multiple Vendor Choice and Support Java technologies are supported by multiple vendors allowing mix and match and best of breed solutions. Java standard APIs have always been designed to be supported by multiple implementations. For example the Java Messaging Service (JMS) standard is supported by multiple vendors IBM, TibCo, Progress, SpiritSoft, Fiorina, Swift, Open3, JBoss, etc. You have the freedom to pick what's the best messaging product for your situation, you don't have that option with Microsoft where there is only one choice MSMQ. 12. Compile to Machine Code Java has several solutions to compiling into machine code, that is when compiling to byte code is an issue for either intellectual property or performance reasons. TowerJ, Jove from Instantiations, Excelsior JET and GNU GCC provide robust solutions to compiling Java to native code. 13. Future Proof Java is future proof or rather future portable, in the sense that your existing code base will not become obsolete. How so? I can run Java on machines today and machines in the future. You don't have that assurance for Microsoft's technologies like .NET. A vivid example is their support for for VB6, which has been set to expire. It's crucial to consider that every development has a ROI that spans several years. How many years was DNA around before Microsoft declared it obsolete? 14. Most Popular Language in the Corporation A recent survey reveals "Interestingly, the strong showing of Visual C# .NET divides the Microsoft camp and propels Java into first place as the most popular language over the coming year". In corporations, there are more developers familiar with Java than any other language. The benefit is that there's a higher chance that someone can maintain or fix a java program than that written in any other language. Do you think you'll find someone in your corporation who will be able to fix that legacy VB application 2 years from now? 15. Larger Talent Pool Java is taught in most universities, this is resource for well trained affordable junior programmers, the same can't be said about C# or VB. Senior Java developers are also easier to find. The same can't be said about C# where there aren't any senior developers. Also a senior VB developer is least qualified to lead development requiring OO analysis and design. 16. More Contributions From R&D Organizations Java is not only taught at universities, it is also extensively used as part of research and development. Work by Matt Welsh at UC Berkeley contributed to the New IO mechanisms we find in JDK 1.4. Generics was worked done by University of South Australia. Aside from universities, research organizations like CERN and HEP have contributed a large amount of code to the public. 17. Government Approved The Office of Management and Budget (OMB) of the U.S. Federal Government recommends to architects the use Java 2 Enterprise Edition over Microsoft .Net as underlying technology. This means that a larger share of billions of dollars that will be spent to upgrade the governments aging IT infrastucture will be done in Java. Expect other governments wary of Microsoft's licensing practices to do the same. 18. More Homogeneous and Less Complex Environment The Java environment is more homogeneous and less complex than .NET. It is not littered with obsolete technologies like COM, DCOM, COM+, ADO, nor is it dependent on operating system indiosyncracies like register settings or most recent service patch level. Furthermore, there is no artificial divisions between someone called a VB programmer and someone called a C# or C++ programmer. Developers are competent whether its UI development or server development, everything is in Java so its understandable and therefore maintainable by everyone. 19. More Deployment Options With Java there are more ways to deploy your application. Here are a few ways: applets, webstart, x-windows, midlet. Furthermore, there is standardization for client provisioning being proposed as a JSR. 20. More Searchable References A search in Google of for "C#" hits 1,720,000 documents, for "Visual Basic" hits 3,270,000. In comparison a search for Java hits 32,100,000, almost 10 times more than even Visual Basic. 21. Better support for Software Process Best Practices Most best practices in software development are done in Java shops. Examples like Refactoring, JUnit testing and Continuous builds. Java developers are familiar with these practices, and by hiring them, you introduce these practices into your organization. 22. Mature Object Oriented Relational Mapping Tools It is best practice in Object Oriented development to decouple business objects from their underlying relational database representation. Java has several mature and robust products that support the mapping of relational databases to objects, notable of which are TopLink and CocoBase. There is no equivalent of such a tool in the .NET world. Microsoft is trying to remedy the situation by buiding something called "ObjectSpaces", however its still in beta and not mature enough to entrust your enterprise business on. 23. More Productive Coding Tools Java IDEs are superior in their support for coding tasks. Features like code refactoring, intention actions, superior code browsing (i.e Find Usages) and robust code completion are superior to what you find in Visual Studio.NET. In fact, Visual Studio.NET is known to unintentionally erase code. 24. Cross Platform Integration with Other Languages Integration with Java from other languages like Perl, PHP or Python is cross platform. In otherwords, I can take my PHP scripts that talk to Java and run in windows, place them in a Linux box and have them work without a major porting effort. 25. Higher Paying Jobs On the average a Java programmer earns quantitatively more than a VB programmer with the same number of years experience. 25 pathetic attempts to make .NET look bad Carlos Perez has posted 25 reasons why he thinks Java is a better platform than .NET, and I kind of feel sorry for him. Why? Because I've written like 100 lines of Java in my life and I'm pretty sure I could come up with better arguments than these. Many of Carlos's reasons are only tangentially related to the Java platform and are more about perceptions than technical excellence. That makes me sad - Java deserves better. Unfortunately the reality in this industry is that perceptions matter as much as technology, so I feel compelled to respond. I'm pretty sure I'm being trolled for doing so, but it's such juicy bait I can't help it. Before I do, let me be clear - I like software. I've been around enough platforms to find joy in all of them, including Java. Java introduced some important ideas to the mass market, many of which obviously made it into .NET and were refined in the process. JUnit, Ant, SAX parsing, Eclipse - lots of great stuff comes out of the Java space (as well as stinkeroos like Swing). It is not my intention to smear the Java platform here, rather to smear the arguments proposed by Carlos. So, on that note... 1. Run on Multiple Platforms from the Smallest Devices to the Largest Mainframes. .NET is officially less than a year old and already runs a pretty fair number of places, and not all because of Microsoft. .NET is multi-CPU aware and should at least run on largish NT mainframes. It also runs on StrongArm devices and (aside from the disaster with [Nokia?]) can run on cell phones. 2. Run Dynamic Languages Neither the CLR nor the JVM are very good at dealing with dynamic languages since type safety is the linchpin of their security models and dynamic typing makes that very hard to enforce. That said I have yet to find a paper saying the Java platform is friendlier than the CLR, and that includes the paper Carlos cited. Support for alternate languages is an explicit goal of the CLR and is an explicit non-goal of Java, so you'd expect it to be a little better, right? Here are some reasons why the CLR is a richer environment for alternate languages: l Support for pass-by-reference and pass-by-value (Java only supports pass-by-reference for object types) l Support for tail calls (important for deeply recursive languages like LISP or Haskell). l Support for method bodies over 64k (important for some compilers that need to emit entire programs into a single method) l Support for "ordinary" (nonstatic nonvirtual) functions. l Support for user-defined value types l Support for Auto-boxing (the runtime can infer a boxed representation of a value type, so you don't have to manually mess with int versus Integer) l Classes can share constant pools, wasting less space l Support for two families of arithmetic operations (some that throw exceptions, some that don't). 3. Compile in One Platform Run in Another. uhhh, Mono? Portable.NET? Compact Framework? 4. Smaller Runtime Download Why does this matter? I can buy a 100BG drive for$200US. or about \$2/Gigabyte.  In this light we're talking about roughly 1.6 cents worth of disk space for Java and around 2 cents for .NET.  The only place the size of the runtime matters is for small devices. No doubt for these devices there are more Java options right now (a company here in Tucson actually does research in this area). But you don't install the standard JRE on small devices either.

5. No mandatory upgrades. No subscription fees. No software insurance fees.

How many MIS organizations are held hostage to microsoft's draconian licensing policies?

Guilty as charged. That said, how many Java developers are held hostage to Sun's draconian handling of Java?  Even Andy hates the JCP :)  The growing maturation of Mono makes this a less compelling argument, too.  As my friend Keith likes to say "They're both just Vendor Scum, man".

6. Run Multiple Versions of the VM (Runtime) on the Same Machine
On this laptop I have Mono,  Rotor, Portable.NET, and two versions of the commercial CLR running simultaneously.  Works great.

7. Large Innovative Open Source Community
A-ha! Good argument. I really don't think I can refute this one.  Java's been around a lot longer.  Give it time.

8. Low cost Commercial Quality IDE's

Not nice to make fun of sharpdevelop. For non-profit use VS.NET can be had pretty cheaply, especially if you know anyone that is in college somewhere. And Eclipse .NET integration is starting to happen.

9. More Available Jobs
For now.  This is actually related to 15 and 25.  Not very convincing to me.

10. Better and Standardized Connectivity to Legacy Applications
I don't work in this space, but I can't imagine these vendors are planning on ignoring .NET.  But I'll concede the point - Java has more penetration in these spaces.

11. Multiple Vendor Choice and Support

See my response to #1. As for messaging, Carlos forgets at least  IBM MQSeries.

12. Compile to Machine Code

Wait a minute - isn't the whole point of Java NOT to do this? Let me be clear here - I have no beef with the Java source language.  It's nice.  But completely ditching the platform it's supposed to run on doesn't sound like much of a benefit to me. Anyway, .NET's NGEN (or "pre-jit) facility basically allows you to compile code as it's deployed onto a client machine,  and in a way that is robust in the face of security and versioning, and in a way that allows clean interaction with ordinary [JIT-compiled] code.

13. Future Proof

This is where I really begin to question Carlos's sanity. Java code will not become obsolete? Then let's just kill the JCP now as being irrelevant.  Sun has resisted every attempt to standardize Java in any meaningful way and could obsolesce everything tomorrow arbitrarily.  (MS did this with VB.NET and the results have not been pretty).  C++ was way more nailed down than Java and the ivy is starting to grow over its door.   Nothing is future proof.  (Except COBOL)

14. Most Popular Language in the Corporation
The exact same survey Carlos quotes states that

"78 percent of respondents indicated that they are currently developing for a Microsoft platform, with 28.6 percent stating that they are actively developing specifically for .NET or ASP.NET"

Sounds to me like a lot of Java programmers are using Java on Windows.  Give them time :)

15. Larger Talent Pool
Bullshit, frankly.  I have personally worked with a number of universities who include C# and .NET in their curriculum, including the University of Arizona, Cornell, University of Colorado Boulder, Texas A&M, and UC San Diego to name a few. And since many .NET concepts are familiar to Java developers any good Java developer would be productive in a week or two and feel pretty comfortable in a few months.

16. More Contributions From R&D Organizations
Give this some time.  Plenty of researchers are tinkering with managed code too. MS has the funds to throw at Academia so like it or not .NET will get research interest.

17. Government Approved

I'm not sure how this proves Java is better than .NET.  The Government after all used to love Ada :)

18. More Homogeneous and Less Complex Environment
This one betrays real ignorance and deserves special praise for it's entertainment value. First of all, .NET obsolesced many of the technologies Carlos mentions.  The Registry? DCOM? Dead dead dead.  Yes those technologies needed to die, and they did.  Now can we talk about EJB? Second, saying "Developers are competent whether its UI development or server development, everything is in [insert language here] so its understandable and therefore maintainable by everyone" is laughably naive.  Anyone who said something like that to me in a job interview would find a polite but quick end to things.  The world is complicated.  There's more to knowing how to write software than knowing what a for loop looks like.

19. More Deployment Options

Umm, no.  You can deploy .NET apps in most of the same ways as Java apps, and once the security story for internet apps gets better you'll basically be able to do everything.  Will everyone who likes Java applets please raise their hands?

20. More Searchable References

Reaching for straws.  Not worthy of comment.

21. Better support for Software Process Best Practices

More hilarious flailing. There are just as many hopelessly incompetent "Java experts" as there are VB hacks. (and VB hacks at least usually have some humility :). None of the things you mention are unique to .NET. JUnit and Ant are wonderful tools that quickly got ported to .NET. Spend some time in the .NET class libraries, especially in the areas of threading, remoting, and interop.  Do you really think the Java libraries are better factored?

22. Mature Object Oriented Relational Mapping Tools

This makes me feel icky, probably because I have a strong dislike for these tools anyway.  But sure, fine,  I'll let Carlos have this one.

23. More Productive Coding Tools

Umm, yeah, okay.  This is the first time I've seen someone hold up Java IDEs as being the great thing about the Java world. Eclipse and IDEA both get props from my Java homies.  The rest of them...well, it's subjective.  VS.NET certainly is not perfect (I curse at it daily) but it's pretty darn productive.  I really doubt either space has much of an advantage here.  (insert obligatory "leaky abstraction" reference here).

24. Cross Platform Integration with Other Languages
See my response to #1

25. Higher Paying Jobs
Even if you're right programmer salaries are notorious for fluctuating.  It's a very bad career strategy to just go where the money is.  There's great money to be had as an SAP consultant, yet I'd sooner shoot myself in the head.  If you're competent in *any* technology area you'll make decent money.

0 0