C # Java is a little worse.

Source: Internet
Author: User

C # and Java are both good languages. They achieved a similar purpose in a similar way, although C # has more syntactically related things than Java, such as the foreach keyword and some more pleasing extension/implementation architectures. Unfortunately, the light of these improvements has been masked by something weakened. In this article, I will compare two languages and try to avoid going deep into the JVM and CLR layers.

Java: the essence of C ++ is indisputable.
When comparing Java and C #, you cannot notice many similarities between them. To some extent, this is due to their common sources: C and C ++. However, when Gosling and his colleagues sat down to create Java, they not only learned the capabilities of C ++, but more importantly, they lost some useless features, the latter makes C ++ more prone to errors and more difficult to learn. C #'s designers have added many C ++ features, while Java has also added these features, but C # has not removed some of the worst features of C ++. As a result, the language still provides all the features for everyone, but the outcome is that internal conflicts are constantly and too complex.

Casual syntactic Defects
The most common errors are flow control and syntax. C # provides a goto command to change the execution point of a program. Since Edsger W. Dijkstra published his book Go to Statement Considered Harmful in 1968. The Goto statement makes the code difficult to debug and is difficult to be processed by the test tool.

In another case, operator overload also has a big problem, but the layers are different. When "+" represents anything based on the type of the operand, the functions of the Code are no longer transparent and unpredictable side effects will occur.

C # Security weakening
C # There is a simple mechanism to mark the code area as insecure. In these insecure regions, Java and later C # have put some security measures in place to prevent programmers from directly modifying the memory location and using Vertex operations, however, these measures are doubtful. When using an advanced language with the spam function, if you go down to the memory address layer, the object/memory will be intentionally separated and mixed. Errors may easily occur, debugging becomes a nightmare, buffer overflow is raised again, and the famous security vulnerabilities in C and C ++ appear again.

C # simple access to the local library on the host system is also allowed. The access to this non-. NET object is similar to the functions provided by the Java Local interface (JNI), but it is more dangerous. JNI is designed to carefully restrict interaction between Java code and local code and predefined interfaces ,. NET makes it extremely simple to call local object files. As a result, developers cannot realize that they threw the portability of the platform out of the window during this process.

SOAP Integration
C # and its larger extension. NET have been closely integrated with the SOAP Web service. SOAP is a good standard for using XML to specify parameters and result values for remote process calls, but it is not the only method. Using External libraries for Web Services allows Java developers to easily change the style of their Web services to SOAP, XML-RPC, or something that has not been invented. Of course, C # developers are always able to use external libraries for SOAP Web services, but the close integration of SOAP standards imposes more restrictions than it can do.


Owner's panic
The most frightening feature in C # may be its owner. Microsoft has carefully demonstrated the use of C # And. NET on non-Windows platforms, but it is still a great show. The CLR used on non-Windows platforms has many problems and many errors. It runs C # Through The ECMA standardization process-this step does not dare to be taken on Java even Sun. The concern is the extent to which Microsoft may block it, if it is willing. Microsoft has applied for a patent to exclude others from writing third-party CRL, such as the Mono plan. If Microsoft decides the free C # And. NET community pressure, it has the ability to take tickets and laws to drive their development activities back to the Win32 platform-of course this is not what it wants to see.

On the contrary, the Java language is not the ECMA standard. Unfortunately, Sun did not follow this standard. However, it can be implemented without patent obstacles. Its virtual machines and core class libraries have open and closed source code implementations from third parties. C # seems to be free, but it is not actually, and Java seems to have a lot of restrictions, but it can be implemented through a free channel according to law.

Finally, I never thought I would say this, but Java has better tool support, even when considering the integrated development environment (IDE. Visual Studio. NET is a good IDE. It represents years of effort and features. However, Eclipse IDE provides support for Java, which outperforms Visual Studio in terms of stability, usability, and features. IBM contributes significantly to Eclipse, and if you believe in the original software motto "Build one to throw away )", then you can take the Visual Age as the first attempt (discarded. For developers who use C #, fortunately, the. NET version of Eclipse is under development.

Not that bad, but not Java
Objectively speaking, there is nothing terrible in C. It does not have the terrible things in Visual Basic, and it does not actually inherit something like C, and these things will let developers shot at their own feet. However, the bottom line is that C # does not do much, if there is anything better than Java. It is obviously worse in some ways. When making a choice between these two very similar languages, please select the one that is slightly better and experienced the storm: Java.

 

Related Article

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.