Competition between Java and C #, Wudang and Shaolin!

Source: Internet
Author: User
The comparison between Java and C # has never stopped since the birth of C. In fact, Java and C # are better than Apple-to-apple. I think it is more accurate to say that Java and. NET are compared, while C # is a good guy in the. NET camp. Together with VB. NET, C # Becomes the right-hand side of Microsoft's. NET strategy.

There are countless articles on the Internet comparing Java and C. Here I see. one of the net's chief designers, Anders hejlsberg, the father of C #, has the most weight. He elaborated on the main similarities and differences between the two technologies from the design height and implementation technical details, such. why is the exception handling policy of net different from that of Java ,. why does net use delegate instead of using interfaces as widely as Java ,. net uses JIT instead of Java's hot spot policy, and so on.

Anders is a super-class swordsman in the computer field. His words are naturally advanced and profound. However, I agree with him in some of his words. I am not very familiar with some of them, and I am not convinced in some places, I still have some reserved opinions on some of his views on java. However, if I am really interested in Java and C #, I think Anders's old swordsman talk is the best getting started course.[Cchere.com Xixi River Highway]

Technically speaking, I cannot be better than Anders. I don't want to take this post too seriously, so I can easily comment on it, I will discuss this issue from my perspective.

In my personal opinion, Java and C # are like Wudang's Shaolin. Java, such as Wudang, features a "pure" word;. net, such as Shaolin, 72 magical skills, excellent and Bo. In fact, Java and C # are the same sect and are derived from the C ++ faction. Java is in the front, brother, C # is in the back, and brother.

Java was born by accident. At that time, sun's software engineer James Gosling was responsible for a small project, developing a small environment for microwave ovens, washing machines and other electrical appliances, and then writing corresponding programs. As a veteran of C ++, James is very familiar with the c ++ problem, that is, it is too difficult to write, debug, test and release. C ++ is like a sharp knife without a guard. Masters can do whatever they want, but if they do not catch it, they will often hurt themselves. At that time, there were a large number of UNIX sects. a c/C ++ program was designed to provide different flavor versions, such as IBM, HP, sun, digital, SGI, and windows. It was simply a pain to the ass. The idea of writing once and run anywhere is coming into being. He was so bold and he started Java design on the basis of C ++. He cut down several of the most dangerous items in C ++, such as multiple inheritance, pointer, and override operator. In addition, from the perspective of OO, he improved C ++ step by step, so from the perspective of object-oriented, Java is very blue. However, Java does not pursue the so-called "Pure oo". It is not an object-oriented language with 100% purity. Java opens a backdoor and creates a small number of "heterogeneous elements" independent of objects. This is the so-called primitive data type. This is because of actual needs. If you set the most basic data types (INT, float, double, bool ...) if it is made into an object, the performance will be greatly reduced and the GC pressure will be too high. Based on these considerations, Java gave up its pursuit of the so-called "Pure oo" and formed a hybrid situation where eight primitive data types and other reference types were added.[Cchere.net Xixi River Highway]

For Java programmers, there is only one task, that is, writing a class. It's just like Wudang's extraordinary martial arts. What we need to do is to draw circles, large and small, stacked circles... java contains no pointer, no structure, no union, no enumeration, no template, no macro... the programmer only needs to write a class and create an instance of the Class-object.

Since the birth of Java 1.0, it has been "pure" until 1.4.x. After that, Java was strongly impacted by C #. In order to keep the public eye open, Java added many things, mostly for language-wise match whatever C # provides. For example, the enhanced foreach loop, the lame autobox/auto-Unbox, And the masked emum (enumeration ). Generics of Java 5.0 is a semi-finished product, and annotation is also introduced out of need. So now someone is shouting, hoping that Java will not lose its most valuable thing-"pure ". Simple and elegant, This is the true meaning of Java. If we have to compete with others for feature, we can use C ++ directly at the beginning. Why should we create Java?[Cchere.com Xixi River Highway]

Fortunately, in the next Java blueprint, Java 6.0, codenamed Mustang (Mustang), has not deteriorated further. Thank God !!!

If Java was born out of technical needs, the emergence of. NET and C # is the product of "political struggle. At that time, Java was well received after its launch, and Java was sought after by rock stars. Sun is naturally not polite. He has raised Java to the "Platform" level, and directed at Microsoft.

Microsoft is annoyed, but it is not easy to attack. Their strategy is "downplay Java ". At that time, he repeatedly stressed that"Java is just a programming language, just like hundreds of other computer languages, just one of them". In this case, Microsoft is not slow. They sent a few troops to launch Microsoft's own virual J ++ based on the old swordsman Anders.[Cchere.com Xixi River Highway]

To be honest, virual J ++ is very distinctive. The speed and performance of Microsoft's virual machine are no inferior to those of sun at the time. Visual J ++'s Ide is very smooth and can easily design interfaces like VB's drag-and-drop, you can create COM component, call existing COM component, and access Win32 API through J/direct. If the program you developed only wants to run on windows, I think virual J ++ was the best Java environment at that time.

Sun is naturally furious when Microsoft is so "messing around" Java. Add COM and WFC to Java. Isn't it Qj Java? Can the developed things be regarded as Java programs? Can Java write once and run anywhere? So Sun took Microsoft to court. The reason is that it is very simple.Microsoft in Qj Java, Sun asked Microsoft to stop immediately and unconditionally!

As you may not expect, Microsoft has lost its lawsuit and won't be able to mess up Java any more. However, when engaging in virual J ++, Microsoft's team has been formed and its concept has been clarified. It has a personal understanding of managed world and how to access COM, there are answers to the technical questions about how to invoke APIs. Microsoft has put aside the Java mask and met all the new requirements. So. Net started brewing at Microsoft.[Cchere.com Xixi River Highway]

It is certain that there must be an unusually fierce debate within Microsoft regarding whether to engage in. net. COM/COM +/VC ++ these Microsoft hard roles will certainly fight against. net. Because of. net, it is equivalent to giving up Microsoft's COM/DCOM that has been engaged for many years. In a sense, it is a soft acknowledgment of the managed code of Java. Although COM/DCOM has many problems, such as the famous DLL hell, But Com still has room for improvement and development. These problems cannot be mitigated or solved, at that time, COM/DCOM had outstanding performance advantages, especially those developed with VC ++.

I don't know who played a decisive role in this debate. At last, Microsoft made up its mind that Bill Gates shot the board and engaged in. net.

For. net, Microsoft has two primary problems:

1) how to keep VB programmers. VB is the son of Bill Gates and the cornerstone of Microsoft's family. It has the largest programmer group in the world. How to bring these VB6 programmers into the. NET "thief boat" is Microsoft's top priority.

2) how to install Java programmers into the. NET camp, so that they will immediately feel "Going Home", instead of re-learning vbprograms such as dim OBJ as string. This is the background of C.[Cchere.net Xixi River Highway]

. Net, and VB. net, C # Are all brand new (of course there are other languages). In this round of design, Microsoft fully draws on C ++, Java, and their own VJ ++, it should be said that it is still relatively successful. 1.0/1.1 was a little hasty. In 2.0, Microsoft made a lot of effort and. Net had overall progress. In general, there are several points.

1) generics of the first stream. Completely new design, outstanding.

2) fully optimized XML operations, which make Microsoft. NET very good in Web Services.

3) The progress of ASP. NET 2.0 is impressive.

4). Net is fully integrated into every product of Microsoft. SQL 2005 and office 11/12 are closely integrated with. net in the next generation of windows.

Microsoft. net is very large, and Microsoft must take into account the previous com world, so. net is a little clumsy, and some are not writable. It is so concise than Java (aside from JNI ). Biru said ,. net to access the previous COM, to access the previous DLL, Win32 API, which inevitably produces some problems ,. net to use the services provided by COM + to compile the so-called serviced component and Queue component. There are also some problems here. The Assembly developed by the COM program to use. NET will also bring about many problems. To solve these problems, Microsoft has made many strange things on the left and right. This is also a "Microsoft feature![Cchere.net Xixi River Highway]


If you look at Microsoft's. Net Library, you can simply divide it into two parts:

1) The namespace starting with "system" (slightly the same as Java package) is a. Net standard, which is clear and can be compared with Java.[Cchere.com Xixi River Highway]
2) The namespace that begins with Microsoft will be invisible to the bottom. However, if you want to write a decent windows program, these things will not be available yet. Please give a warning in advance.

If you are confused about this, you must ask the following question:

Which of the following is better for Java and. Net? If I run to. net, should I select C #, VB. NET, or anything else?

Again, as I mentioned earlier, Java and. NET are like Wudang and Shaolin. Wudang seven Xia is famous all over the world, and the name of the far earthquake; and Shaolin four gods monk is also the martial arts, earthquake ancient times. Regardless of Java or. NET, Kung Fu is able to solve the same problem as it is when it comes to home. Wudang Shaolin has no advantages, but the depth of skill.

If it is in the Windows world, my advice is to take the. NET route. After all. net is more handy on Windows, whether it is accessing office files, developing Windows Services, using COM + infrastructure, joining hands with IIS to compile web apps/Web Services, or developing on ms SQL database ,. net is much easier than Java.[Cchere.com Xixi River Highway]

There are more than 20 languages theoretically available for compiling. net programs, but in fact VB. NET and C # are the main languages. These two languages are actually made on the. NET library. The foundation is the same, but the difference is only syntax ). In theory, C # is a little better than VB. NET. For example, C # can use pointer in the unsafe block, while VB does not have the pointer concept at all. However, in practical applications, the two are almost the same, which is difficult to distinguish. In Microsoft's words, which language is completely personal preference ).

If you are engaged in research, learning, or writing algorithms and editing background applications in the company, Java is a good choice. After all, the world of Java should be clear and transparent, in addition, if you select Java, you also win a "free body", which is not restricted by the platform, but not restricted by the software verdor. You don't need to look at Microsoft's face.

This article comes from
: Http://www.cchere.com/article/542929

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.