网站首页 新闻首页 网页设计图形动画软件编程网站开发办公软件操作系统数据库网络技术认证考试范文资料黑客攻防 书籍教程 进入论坛

JAVA程序员眼里的C#

http://www.diybl.com/ 2007-2-6  网络 点击:  [ 评论 ]
文章搜索:    【点击打包该文章】

Java developer's view of C#.
September 03, 2004
There are two ways to compare programming languages: a religious war and a "we just don't care" type of attitude. I will try to find the middle ground and start with generalities. The key feature of both Java and C# is automated memory management. Of course this makes both languages useless for writing an operating system kernel, but it makes application development significantly easier because

Chances of a memory leak are minimized
We don't have to write code to free up memory
We can write f(g(x)) and not worry about freeing up memory used by the return value of g(x).
So, we have two popular software development platforms. Each of the two is used by millions of software developers and is backed by a world famous software giant, but neither one carries any revolutionary advantages.



Influence of Microsoft
Historically Java came about earlier than .NET and slowly captured not only the server-side software market, but also the market of corporate client oriented GUI applications. The reasons were that C++ is too complex for making forms, Visual Basic doesn't feel like a cool developer's language, and Borland invested more into Java than into Delphi.

However, the more Java applications there are, the smaller the demand for Windows. So Microsoft decided not to support Java, and to create .NET in order to stimulate the development of software designed to run on Windows. Of course .NET has some cross-platform compatibility, but from the point of view of Windows, .NET is trying to become a part of the operating system like Internet Explorer. The career of a .NET developer supposes a close partnership with Microsoft including the use of the Visual Studio Development Environment, MS SQL database, and the versioning control system Visual SourceSafe.

Microsoft marketing deserves a lot of credit for the fact that many software development companies tend to think about software entirely within the Microsoft framework. Because of that, sometimes we have to put aside beloved Java, and make use of C#. The good news is, the experience gained while working with Java is helpful with .NET, and development of .NET is motivating progress of Java.



CVS vs. VSS
The majority of Java developers have gotten used to CVS, after which a move to Visual SourceSafe combined with its integration into Visual Studio and the solutions-projects concept is perceived as quite painful. To be fair we must note that the use of CVS in a large project is theoretically possible, but triggers a negative reaction of people, used to working with VSS.

Here I could throw some punches on the subject of "why is CVS better than VSS", but I will not do that because CVS isn't perfect either. Then there is a project called "Subversion" which is openly positioned as the replacement for CVS. Neither does Microsoft consider VSS as its flagship product, and is working on a replacement for it in the form of the Visual Studio 2005 Team System.



The influence of VB.NET
Many languages can be compiled into byte code for JVM, but practically all the software for the Java platform is written in Java itself. A project for .NET can equally likely be written in either C# or VB.NET, and quite often both languages are used.

Clearly C# and VB.NET have very few differences, except for the syntax, but create a divide in the community of developers. Even if you write exclusively in C#, in the results of a support documentation search you will always find material related to VB.NET. In a desktop version of MSDN one can filter the content by programming language, yet I still find the Java documentation much more convenient and helpful.



GUI development
GUI development in C# is a typical example of RAD, like Delphi. In Java the GUI is usually done with Swing. Even though Swing is quite large and complex, the fact that the architecture is well thought out and scalable combined with the availability of the source code allows for development of GUI of any complexity.



Web application development
I have a lot of experience in web application development in Java, and never have I worked with ASP.NET. However I readily accept ASP.NET having some minor advantages when it comes to creating small scale web sites. However these advantages separate web-applications into a distinct segment of software. Many developers specialize in either web development or GUI development. In Java web-applications can easily be created without the use of special technologies like JSP, JSTL or Struts. All you have to say is extends HttpServlet.

Of course Java will not easily give up the market of web development. We can expect more news from JavaServer Faces and Fabrique. In any case web page development is not among the most complicated problems for a modern programming language.



Is everything object?
In Java there is a popular slogan "Everything is object", in C# this would not be true. The first thing that stands out is the existence of structures in C#. Obviously we are motivated to use structures to increase productivity, but I think modern computers are productive enough not to require the addition of another entity in a programming language.

Also anonymous classes are replaced by delegates in C#. This is the idea that if a method has a definite set of arguments and a given return type, it is absolutely unimportant what its name is and whether or not it is static, or any other nonsense. You can just call it.

While we are on the subject of delegates, we should also mention events. They really do decrease the code volume in GUI development. However this comes at a price of going against OOP principles.

文章整理:DIY部落 http://www.diybl.com (本站)   【点击打包该文章】
[1] [2]
如果图片或页面不能正常显示请点击这里 站内搜索:   

文章评论

请您留言