NET to Java

Source: Internet
Author: User

If you know C #, it's not that hard to turn to Java, after all, the language syntax is similar. Try the next Java, say your own experience.

First, both Java and C # are fully object-oriented languages. In the three principles of object-oriented programming, the two languages are close enough to be close. But there are some differences, but not much, a little more accustomed to the good,

Like what:

collections : Both languages have set ArrayList, and there is hashmap in Java that accesses values by key, and C # is Hashtable. C # is easier than the Java multi-generic collection list<t> and dictionary<k,v>, and is safer without unpacking.

inheritance : Java uses the keyword extends,c# only ":" On the line. Calling the constructor of the parent class Java uses the Super keyword, while C # uses the base keyword.

Properties : The Get and set methods are used in Java for both definition and access, and can be paired up. C # is a real property, when you define the get and set must appear at the same time, the room when asked. No get,set.

event . Not in Java (Java executes events by implementing a custom listener Class). C # defines a delegate similar to a function pointer to implement an event.

Wait a minute...

Second, Java Web and ASP is similar, the core of the Java Web is servlet,jsp is actually the servlet, and the servlet process can be relatively clear to see how the whole front and back of the work, similar. NET ASHX General Handler, Java is the main advocate of MVC, with the development of web technology, servlet is mainly used as control, JSP is used as view, which is embodied in many MCV frameworks. Thanks to the active open source community, popular Java The MVC framework is quite mature. and ASP. NET MVC (though I haven't used it, I've probably learned it) feels like it's not very comfortable to use. It seems that ASP has not yet spread. Many. It's Microsoft that's going to spoil us. Feeling WebForm is not elegant enough, coupling is too high, personal contact with the Java Web after the majority of the scenario is that MVC is better.

Currently exposed to the MVC framework is Struts2, commonly used in the presentation layer, the front page display and control page jump. To build a project, there will be a Web. xml file, which is the master configuration file for the entire project. The integration of other frameworks is first done in this configuration file. Struts also has a master profile Struts.xml, which is configured in this configuration file for all configured actions in the project. Action is the core of struts, in fact, is to control the page jump switch, each page and background data interaction or jump to another page through the action. See the relevant documentation for specific use.

Three, Java framework of a variety of famous full-featured stack Spring Framework, MVC Framework STRUTS2,SPRINGMVC (Spring subkey), Data persistence layer framework mybatis,hibernate, template engine Freemarker, Velocity, Framework has the disadvantage of the framework of the benefits, the use of the framework is nothing but to improve productivity, reduce the cost of testing and maintenance to ensure system performance. But inappropriate use of the framework will only aggravate the complexity of the system, reduce system performance, increase maintenance difficulty. When to use the framework when not used, To be careful in making a choice. At present, only contact STRUTS2, because some small projects directly servlet+jsp+jdbc on the good, lay a good foundation or more important, after the project slowly contact use it.

In general, Microsoft's ecological environment is not given. NET face more and more narrow, the situation of Java ecosystem is a bright future, choose Open Source Java for a reason, a wealth of information, a variety of solutions to choose. Once encountered a browser post SVG to the background to the PNG image of the function, very hard to find an open-source library on Git, A lot of bugs, and Java Apache under the batik is quite perfect. Finally, through the background cmd call batik to achieve, how a tragedy. Roost also interested in Windows Phone, do a few demo app found closed WP API is still too little, Recruitment WP development is less. Of course, C # is still the most beautiful language, and Visual studio is still the most perfect IDE. . NET programmers should be more exposed to other language development platforms, at least as a pioneering vision.

Category: Java

NET to 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.