J2EE vs. NET, Java vs. C#:比较公正的评价

原创 2005年06月02日 02:16:00

J2EE vs. NET, Java vs. C#:

Since there's been plenty of discussion on these topics, I thought I'd write down my own views on these matters. For the record, just in case someone questions my experience in languages and libraries, I was one of the first adopters of Smalltalk, C++, and Java, taught all three professionally for several years, taught programming languages at UT Dallas, wrote an ORB in Smalltalk, wrote the first portable STL toolkit for C++, wrote the ObjectSpace Systems<ToolKit> cross-platform systems libraries, wrote the JGL generic collections library and the multi-protocol ObjectSpace Voyager Java ORB. And of course, I wrote a good deal of the TME Electric XML toolkit and GLUE web services platform for Java. Sorry for the long-winded introduction, but establishing a strong background in these areas helps to establish a basis for my opinions, and throws out any claims that I am some kind of Java-hater!

Historically, languages build on each other, borrowing the best ideas and then throwing in some new ones. Some languages evolve, some stagnate, and some die. C -> C++ -> C# is a good example of an evolution, and Smalltalk is an example of a language that I loved but is pretty much dead.

C# was designed by Anders Hejlsberg, a long-time hero of mine, the force behind Turbo Pascal and Delphi, and a guy with an obvious talent for language design and implemention. In C#, he's taken a lot of the best ideas from previous languages, integrated some new ones of his own, and come up with a natural evolution of where Java was heading. For example, the ability to associate attributes with any element supports declarative programming in an elegant and powerful way. C# makes iteration simpler and more natural for developers, and auto-boxing simplifies manipulating collections of primitives. There are many other nice features of C# that are covered in several articles I've read.

It's also significant to note that several new C# features have already been proposed and will be implemented soon, making C# one of the freshest and quickly evolving languages on the market.

The Java language, on the other hand, had a strong initial start and then essentially stagnated after Java 1.1. The only new thing in the last 6 years has been the assert keyword, which is not much to write home about. I'm definitely don't like languages that include an entire kitchen sink of features, but C# shows the kinds of features that could easily have been added to Java.

For a while, Sun was sitting in the cat bird's seat with a great lead in the languages and libraries space. Microsoft didn't want to adopt a strategic language that it could not improve upon, so it decided to create its own language that could be evolved at a reasonable pace. Now that C# has gone beyond Java, Sun has got to quickly evolve Java or watch it slowly fade away. I think that IBM realizes this, and I hope that it's working hard behind the scenes to rectify the situation.

It's frustrating but understandable that James Gosling holds disdain for C#. Gosling keeps going on about how C# is a clone of Java, but it's not - it borrows the best from Java and then adds improvements of its own, just like Java improved upon previous languages. That's the way it works, regardless of which company is involved!

Another thing about C# that seems misunderstood by much of the Java community is the concept of "unsafe" code. The idea behind "unsafe" code is that a programmer should be able to access low-level programming constructs without having to clumsily drop into a different language. In Java, you have to use JNI to link with libraries written in a language like C to get at low-level constructs. In C#, you can use the C# language to get at low-level constructs, and code which does this is marked specially so that the executing environment is aware of it and can prevent code flagged in this way from executing. This seems an elegant way of providing the full range of expressive power within a single language, less error prone, and easier to manage.

All that being said, I write my code in Java these days because of its portability.

Enough of Java and C#. What about J2EE and .NET?

The great thing about Java when it arrived was its simplicity and portability. Over time, the J2EE libraries have become pretty complex IMHO. For example, there have been many conversations on various news groups complaining about the learning curve and performance associated with EJB. .NET is definitely simpler than EJB for building server-side components, and so Java badly needs a new and simpler way to build portable and scalable server-side components. This of course is the reason that TME launched GLUE and has been working on its rapid evolution.

The main advantage that J2EE has over .NET is portability. Whether this advantage remains is primarily a business decision for Microsoft. There is no technical reason why the core .NET framework can't be made cross-platform, and several groups are already working on doing this. Heck, CLR was designed from the ground-up to support this! So J2EE is an uneasy situation in which a simple snap of Bill Gate's fingers results in its primarily advantage being neutralized.

The best defense for Java/J2EE is fairly straightforward:

- standarize Java and allow some of the language wizards at IBM and other companies to evolve the language at a similar pace to C#.

- come up with a far simpler server-side programming alternative to EJB

Time is running out......

J2EE vs. NET, Java vs. C#:比较公正的评价

  • zgqtxwd
  • zgqtxwd
  • 2008年04月24日 15:12
  • 116

【最优化方法】穷举法 vs. 爬山法 vs. 模拟退火算法 vs. 遗传算法 vs. 蚁群算法

优化算法入门系列文章目录(更新中):   1. 模拟退火算法   2. 遗传算法   一. 爬山算法 ( Hill Climbing )          介绍模拟退火前...
  • kuvinxu
  • kuvinxu
  • 2014年06月29日 08:46
  • 2377


以前没怎么弄过堆溢出问题,直到最近看见Google研究团队发布了关于dnsmasq的一系列问题 (需要翻墙)其中有两个CVE涉及到了Heap Overflow。其中的基础知识不再赘述,可以直接参考以下...
  • iextract
  • iextract
  • 2017年10月12日 18:12
  • 397

Benchmark: PHP vs. Python vs. Perl vs. Ruby

Benchmark: PHP vs. Python vs. Perl vs. Ruby 转自:http://xodian.net/serendipity/index.php?/archive...
  • ghlfllz
  • ghlfllz
  • 2011年10月15日 16:34
  • 4776

LAMP与J2EE与 .NET三者的比较

为了开发一个动态网站出来,有3中选择,三种选择是一种三足鼎立的一种状态:LAMP   J2EE  .NET,各有各的好,下面自己总结一下 1、ASP.NET ASP.NET 的开发框架是 ...
  • lonsegdi
  • lonsegdi
  • 2015年08月02日 08:54
  • 2714


内存、指针相关 当程序运行出现退出错误为以下任意:(xxxxxxxxxx为地址) free():invalid pointer: xxxxxxxxx     malloc(): mem...
  • prliebtsy
  • prliebtsy
  • 2018年01月26日 21:39
  • 81

VB .NET vs. C#

VB .NET vs. C#选择那个会更好一点?   By Craig Utley By Montaque(当然,我只是做了稍微的注解) 偶尔看到的这片文章,我觉得还是不错的一片文章。作者分析了一下两...
  • Montaque
  • Montaque
  • 2002年12月10日 23:43
  • 1842

Java练习:Overriding Vs. Overloading经典笔试题

需要理解Overriding 、 Overloading以及重载匹配算法。 有类层次如图 package OO; import static tips.Print.pln;//System...
  • yqj2065
  • yqj2065
  • 2016年12月06日 03:11
  • 367

jetson TX2报错 error==cudaSuccess(8 vs. 0) invalid device function

  • zhaoyaohuahua
  • zhaoyaohuahua
  • 2017年10月28日 11:27
  • 171

caffe mnist测试Check failed: status == CUDNN_STATUS_SUCCESS (4 vs. 0) CUDNN_STATUS_INTERNA

在caffe runtest 均通过的情况下,测试mnist出现(copy他人的,记忆中一样一样的) F0616 16:54:55.034394 3070141376 cudnn_conv_laye...
  • tulip561
  • tulip561
  • 2017年07月06日 01:04
  • 6287
您举报文章:J2EE vs. NET, Java vs. C#:比较公正的评价