C # is Java only a little bit.

zhaozj2021-02-12  150

C # is Java only a little bit.

Http://www.zdnet.com.cn/developer/tech/story/0,2000081602,39193401,00.htm

C # and Java are very good languages. They achieve similar purposes through a similar way, although C # is more than Java more than Java, such as Foreach keywords and some more happily extended / implementation architectures. Unfortunately, these improved rays have been concealed to cover up. In this article, I will compare both languages ​​and try to avoid deep into the JVM and CLR layers.

Java: It is indisputable with C all the essence

When comparing Java and C #, you can't notice their many similarities, this is to some extent to their common source: C and C . However, when gosling and his colleagues sat down to create Java, they not only absorbed C 's ability, but more importantly, they lost some useless features, the latter made C more easily mistakes and more difficult . The C # designer joins a lot of C features, while Java has also joined these features, but C # does not remove the worst of C . The result is such a language that still provides all the features for everyone, but its ending is constant internal conflict and is too complicated.

Sedimentation

The most easily identified error is flow control and syntax. C # provides GOTO Command, which uses it as a mechanism for execution points. Since Edsger W. Dijkstra published his "GO to Statement Considered Harmful" in 1968. The GOTO statement causes the code to be difficult to debug, and it is difficult to test the test tool.

In another different case, the operator has a big problem, but only the level is not the same. When " " represents anything according to the type of operand, the functionality of the code is no longer transparent, and it is difficult to expect side effects.

C # weaken safely

C # has a simple mechanism for laid the code area as an unsafe. In these insecure areas, Java and later C # arrange some security measures to prevent programmers from directly modifying memory location, and using point operations, but these measures are worthy of doubting. When using a high-level language with a garbage cleaning function, if you get to the memory address, you will make it intentionally separated by the object / memory. The error will be easy to appear, debugging into a demise, the buffer overflows again, and the famous security vulnerabilities in C and C appear again.

C # also allows simple access to the host system. This access to non-.NET objects is similar to the functionality provided by Java Native Interface (JNI), but it is more dangerous. JNI is designed to carefully limit the Java code and the interactive operation between the machine code with the defined interface, .NET makes it extremely simple to call the native object file, resulting in the development of the developer when doing this Recognizing that they also throw the portability of the platform in this process.

SOAP integration

C #, and its greater extension .NET, has been closely integrated with SOAP Web services. SOAP is a good standard that uses XML specified parameters and result values ​​to make remote procedures, but it is not the only way. Using external libraries for web services to allow Java developers to easily change their web services, making it SOAP, XML-RPC, or something that has not yet been invented. Of course, C # developers can always choose to use external libraries for SOAP web services, but the restrictions caused by SOAP standards are more than what it can do. Panic

The most panicted characteristics of C # may be its owner. Microsoft has made a careful display of C # and .Net for non-Windows platforms, but this is a large extent. Its CLR used for non-Windows platform is much more problematic, and there is a lot of errors. It runs C # through the ECMA standardization process - this step does not dare to take it on Java. It is worried that it is from Microsoft to block this, if it is willing. Microsoft has applied for a patent to reject others to write third-party CRLs, such as Mono plans. If Microsoft decides to press the free C # and .Net community, it has the ability to get tickets and legal battles to the Win32 platform. Of course, this is not what it wants to see.

The Java language is the opposite, not an ECMA standard, but it is unfortunately that Sun does not follow this standard. However, it is achievable, and there is no patent hindrance, and its virtual machines and core libraries have an implementation of open and closed source codes from third parties. C # looks free, in fact, Java seems to be limited, but it can be achieved by the law through a free approach.

Finally, I never thought that I would say this, but Java has better tools for tools, even in consideration of integrated development environment (IDE). Visual Studio .NET is a very good IDE. It represents many years of effort and is rich in characteristics. However, Eclipse IDE includes support for Java, which exceeds Visual Studio on stability, ease of use, and provided features. IBM's contribution to Eclipse, and if you believe in the original software motto, "Build One To Throw Away", you can try the Visual Age as the first (abandoned) attempt. For developers using C #, the .NET version of Eclipse is under development.

Not that bad, but not Java

Objectively evaluation, there is no horrible thing in C #. It doesn't have the terrible things in Visual Basic, and it doesn't inherit some things like C, and these things will make developers shot their own feet. However, the bottom line is, C # does not do a lot, if there is anything better than Java. It is obviously worse in some respects. When choosing between these two very similar languages, select the one slightly better and experienced in the storm: Java.

转载请注明原文地址:https://www.9cbs.com/read-7281.html

New Post(0)