How to Learn JAVA

Source: Internet
Author: User

How to Learn java (1)
Recently, several friends on the Forum asked questions about how to learn Java. "I have learned J2SE. How can I switch to J2EE ?", "After reading Thinking in Java, can I learn J2EE ?". So I came up with the idea of writing this article, hoping to help beginners avoid detours. It is also a summary of my years of learning Java.

It is necessary to discuss the concepts of J2SE, J2SE, and J2EE before you start. The Micro Edition of the Java 2 Platform. It is mainly used for embedded Java, such as mobile phones and PDAs. J2SE, Java 2 Platform, Standard Edition, the JDK (Java Development Kit) we usually call here, is the basis of J2EE. J2EE, Java 2 Platform, and Enterprise Edition are so-called Enterprise-level Java. In fact, Sun defines J2EE as a component-based multi-layer enterprise-level application specification. That is, to define a Java specification for different technologies, so that these different technologies can be combined to build strong enterprise-level applications on the Java platform. From this point of view, the concept of J2EE should cover J2SE and J2SE. For example, a typical J2EE application, an online store, supports web-based order placement and mobile phone order placement. It is obvious that J2SE and j2e-hpc must be used. So there is no such problem as switching from J2SE to J2EE, but the latter has a wider scope.

Let's take a look at Sun's J2EE-related technologies.

1. Web Service technology

-Java API for XML Processing (JAXP)

-Java API for XML Registries (JAXR)

-Java API for XML-based RPC (JAX-RPC)

-SOAP with Attachments API for Java (SAAJ)

2. Component Model Technology (Component Model Technologies)

-Java Servlet

-Assumerver Pages

-Assumerver Faces

-Enterprise JavaBeans

-Java Message Service

-J2EE Connector Architecture

3. Management Technologies)

-J2EE Deployment Specification

-J2EE Management Specification

-J2EE Client Provisioning

-Java Authorization Contract for Containers

4. Other Related Technologies (Other J2EE Technologies)

-JDBC

-Java Data Objects (JDO)

-Java IDL and Java RMI-IIOP)

-JavaMail

-Transactions

So many technologies will inevitably make beginners feel overwhelmed and discouraged. Even an experienced J2EE developer, I am familiar with J2EE-related technologies. However, as a developer of a common J2EE application, we only need to focus on learning some of the technologies. We only need to be aware of other technologies, one day, you need to know where to run and find the information. In my personal opinion, the following technologies must be mastered by J2EE application developers. Java Server Page, Java Servlet, Enterprise JavaBean, JDBC, Transactions. There are also XML-related technologies such as JAXP, Java Message Service, Java Mail, JDO, and so on. Other Management Technologies, Connector Architecture, and so on are mainly for reference by the container provider's middleware provider. application developers do not need to care much about it. It is not too late to learn it when it is used.

Language Learning

The first is J2SE. Learning a new technology is nothing more than reading and practicing. A good reference book is especially important for beginners. Currently, the Java books on the market can be said to be overwhelming, and the quality is also uneven, making beginners at a loss. So I recommend a few books first. Currently, we generally recommend two books for basic Java knowledge: <Thinking In Java> and <Core Java? 2. Volume I: Fundamentals>. Needless to say, the first book is Bruce Eckel's masterpiece, Jolt's award-winning book. The content is comprehensive and covers almost all aspects of the java language. This book provides a wealth of examples to help you understand the learning content. In addition, the first part of the book introduces the basic OO books. I think it will be of great help to people who are new to OO. This book is Open Source and can be downloaded from the author's website. The disadvantage of this article may be that it is a little thick for beginners. This is why some people do not recommend this book as a beginner's learning book. Next <Core Java? 2. Volume I: Fundamentals> it is now in version 7. The popularity of this book can also be seen from the number of times it was published, this book also describes a comprehensive system. The Java language basics should be proven. The disadvantage is also too thick. It is a bit like a reference manual. The previous part has spent a lot of time talking about Swing and Applet, which may not be very useful for beginners. There are also some basic books like <Java in a nutshell>.

After learning the basic language basics, don't forget that the most important and useful information is the JDK document. From the first day of your learning of Java, JDK documentation should be on hand. If you encounter a problem first, you should go to the Forum to ask a question instead of reading the JDK documentation. Do not continue to learn about it. Learn to check the JDK documentation first. It is no exaggeration to say that in our beginner's forum, 60% of the problems can be solved simply by checking the JDK documentation. The latest JDK documentationhttp: // java.sun.com/j2se/1.4.2/download.html (currently the latest version is j2se5 http://java.sun.com/j2se/1.5.0/download.jsp) can not simply say not to practice, the same download page to download JDK back. After the installation is complete, I want to upgrade it. After installation, there is an src.zip file (some JDK versions are SRC. jar), good things --- JDK source code. Someone always asks on the forum where JDK source code is downloaded. You say something is stored in your house and you can find it everywhere. With this problem, you need to compete with others on the Forum. Open the source code and check whether there are any questions. Several of the most important command line tools are:

Javac: Compile the source file to the class file

Java: Run class

Jar: a packaging tool.

Javadoc: a tool for generating Java Doc.

For beginners of java, I do not recommend using IDE But directly using a text editor and then compiling and running it using command lines. This helps you understand the basic concepts of CLASSPATH and PATH. CLASSPATH is a confusing place for beginners. The current IDE is so clever that you can automatically generate the java source code and compile it with a name. Maybe you have run your first Hello World Program, and you do not know what java and javac are used. As for actual project development, a proper IDE is very important. We will introduce some java development tools later.

How to Learn java (2)
Basic J2EE and advanced Java language

After learning the language basics, You can naturally transfer it to the learning of the actual J2EE technology. J2EE is complex, and EJB and Servlet are the core technologies that every J2EE developer needs to master. For servlet, I recommend <Core Servlet and JSP 2 Edition> and <More Servlets and Java Server Pages>. The first is the Servlet textbook recommended by Sun. The second is Amazon's best-selling Java book and five-star book. This book is a Chinese version of the Mechanical Industry Press called <Servlet and JSP authoritative guide>. It seems that the translation is good, and the second version does not seem to have seen a Chinese version. Both books fully and systematically introduce JSP and Sevlet knowledge, from web server configuration, JSP, Servlet basic programming, Tag Library (Tag Lib), filter, the event framework is well described. Examples are also useful. There are two well-known EJB learning books: <Enterprise JavaBeans, 3nd Edition> and <Mastering Enterprise Java Beans Third Edition>, two authors Richard Monson, ed Roman is a heavyweight in the industry. Richard Monson is a member of the EJB standardization expert group. For me, it is difficult to distinguish between the two books. One advantage of the second book is that you can download http://www.theserverside.com/books/wiley/masteringejb/index.tssfor free.

In other words, we can't just say no, but it is a little troublesome to do J2EE exercises. The application server is indispensable. We 'd better prepare a lightweight database. The following is a brief introduction to these tools.

Web Server (Servlet Container.

Tomcat: http://jakarta.apache.org/tomcat/

Jetty: http://jetty.mortbay.org/jetty/

Common application servers include,

Jboss: http://www.jboss.org/products/index

Weblogic: http://www.bea.com/framework.jsp? Cntw.index.htm & FP =/content/products/server

WebSphere: http://www-128.ibm.com/developerworks/downloads/ws/was? S_TACT = 105AGX28 & S_CMP = DLMAIN.

Tomcat, Jetty, and Jboss are all Open Source. Weblogic and WebSphere are leaders in the J2EE server and are expensive. However, developers can download free trial versions.

If you only want to learn Servlet, Tomcat is recommended. It is a Servlet officially designated by Sun and the reference implementation of JSP specifications. The most important thing for beginners is that it is relatively simple to use, has a complete set of built-in documents, and has a large number of users. It is easy to get help on the Forum if you have any questions. If you want to learn EJB, we recommend using Jboss, not only because it is Open Source, but mainly because the configuration is simple and easy to use. For example, for the database connection, for common MySQL, Oracle, ms SQL and so on provide the Sample Config file, directly take some small changes to the Deploy directory can use DataSource, it is easy to deploy J2EE applications. ear or. the war can be thrown to deploy. The only inconvenience is that it starts with Jboss3.0 and its documentation starts to charge fees. However, some basic configurations are very easy to find on the Internet. After all, they are too popular. Weblogic is easy to use, but it is much larger than Jboss. It makes some common configuration work very simple through a powerful management interface. Compared with Jboss, Jboss has too many documents, which is a bit arrogant, for example, deploying one. the ear file, which is usually automatically deploy when we directly drop the applications directory under the domain. However, it is easy to scare beginners by reading its documents, I think this is a profound learning. As for WebSphere, it is not recommended for beginners. It is more difficult to use than the first two servers, and it consumes a lot of memory. However, this guy is doing well in the enterprise market. After all, he was born in a great place like IBM.

Database, the current common include PostgreSQL, MySQL, Oracle, ms SQL, DB2 and so on. The first two are open-source databases, which basically monopolize most of the database markets. I recommend MySQL for beginners to do EJB and JDBC exercises. The reason is very simple. Open-source software is free of money. There are many documents for users. Http://www.mysql.com/products/mysql /. PostgreSQL can also be considered, but domestic users are far less convenient than MySQL, so it is easier to ask questions on the Forum, http://www.pervasive-polics.com/downloads /. As for those heavyweight databases in the future, we don't have to worry about doing exercises. We can't afford the money.

After learning the specific technologies of J2EE, it is not a problem to perform basic J2EE development at this time. Now you should consider improving your code quality. Here I strongly recommend Martin Fowler's <Refactoring: Improving the Design of Existing Code>. This book is not a very practical book, the author teaches you how to improve the quality of the Code, tell you what is the Bad Smell of the code from the specific code, and how to remove these Bad Smell. Many book reviews say so. This book is helpful to beginners and intermediate readers. At least a few programmers I have come into contact with who have recently studied programming, and their coding quality has greatly improved in the short term. Of course, the Refactoring concept is not only applicable to Java, but also to all OO languages. The concept of refactoring is so deeply rooted that almost all popular IDE tools today support refactoring. Here I would like to recommend another <strong tive Java>. Programmers from C ++ know the role of <strong tive C ++> in the C ++ field. So far, there are still such interesting stories. C ++ programmers are divided into two types, one is read <strong tive C ++>, and the other is not read C ++. Although the impact of this <strong tive Java> On the Java field may not be so great, it is of great guiding value to Java programmers. The author is Sun's Joshua Bloch, designer of java Collection framework. From the perspective of the JDK designer, the author will introduce you to his Best Practice. Instead of doing so, he will not point out some of the API design defects in JDK. The preface written by James Gosling, the father of the Java language, is "I sure wish I had this book ten years ago. Some might think that I don't need any Java books, but I need this one ". This book will make you feel that you still don't know much about Java. For example, we think the equals method of an object is very simple. Maybe you will reload this method for your new Class every day, however, you have paid attention to the "self-inverse", "symmetric", and "pass" factors that must be taken into account during overload. Are you also careful to reload the hashcode method? If not, you are advised to read this book. After reading this book, you will feel closer to Java. Both of the above books have been published in the Chinese version, and the later <strong tive Java> has two versions of the Chinese version. The first translation is a little short, later, the mechanical industry press commissioned Mr. Pan aimin to re-translate it. The same book has been translated twice in a row in the same publishing house. It also shows that the Chinese publishing industry still attaches great importance to this book.

At this stage, while reading a book, you can combine the source code of some excellent open-source projects. The Code style and comments of these open-source projects are worth learning. It's too lazy. Don't forget to have a Jdk source code on hand. In fact, you don't have to look for source code. In actual J2EE project development, some excellent open-source projects are basically used. The Framework may use Spring, Struts, and Log mechanisms. Basically, JarkartaCommons Log or Log4j will be used in unit tests. In combination with the project, read some of the source code, it can improve itself and help the project, so it may be appreciated by PM. How happy is it. Haha, It's a little far away. After a beginner's time, you should learn how to find a suitable Java book. After dozens of years, today's Java technology has become so complex that I believe that even a person who has spent all his life can never learn all the relevant Java technologies, what's more, new technologies are coming soon. Three years ago, no one would know that Struts will become the de facto industrial standard of Web frameworks. 2 years ago, who would know that Hibernate will be dominant today. Since we can't expect to learn all aspects of java at one time, we can only learn what technology is needed in practice. But whether you can choose a good reference book will bring you twice the result with half the effort. Therefore, I think it is worthwhile to spend some time on choosing books. Otherwise, you will only spend more time later. Next I will talk about some of my experiences in choosing books, which is not necessarily correct. First, let's take a look at the authors. The authors of the books mentioned above are all famous in the industry. You can't make a mistake when choosing their books. If you read more books, you will naturally have a list in your mind, which authors are trustworthy. 2. Publishers and computer books, Oreilly and Addison-Wesley are well-recognized publishers. Oreilly's <XXXX in Action> series is a good choice for currently popular Java technologies. In addition, I will also go to the Amazon website (http://www.amazon.com/) book reviews, generally less than 3 star books I will not consider. Theserverside, Hangzhou. I would like to recommend to all Java learners. If my favorites can only store two websites, I will select java. sun and theserverside. Here you can learn about the latest Java developments, learn the first-hand Java materials, and see the heated debate among Java experts (including industry leaders.

At this stage, the basic skills of Java Developer should be well developed, and I will continue to learn it later. Before the end of this section, I will introduce Oreilly's <Java Threads, Second Edition>, because I think multi-thread programming is a basic Java skill, everyone who wants to learn Java well should master it well.

Improve

At this stage, we should learn from the software architecture and Framework layers. As an object-oriented Bible <Design Patterns>, this book has to be recommended. Needless to say, this role in the Object-Oriented field belongs to the Godfather level. No matter what OO language you are learning, whether you are using. Net or J2EE development, this book is a must-read on your way to the advanced level. <Core J2EE Patterns> is designed for J2EE. Senior designers of Sun Java Center describe the mode of key J2EE technologies. Best Practices, design policies and proven solutions. This book is worth reading for everyone who wants to become a J2EE architect or designer. When learning the design mode, it is recommended to look at the actual source code, such as looking at the Junit source code, you can see a lot of elegant Implementation of the design mode, one of the authors, Erich Gamma, is the author of <Design Patterns>. As for the J2EE design model, Sun also opened up a dedicated space for compaction. As Grady Booch said, the model provides a general solution to common problems, and the exploitation model is equivalent to a strong team of experts. If you have not studied, start now. In addition, for object-oriented methodology, the idea of extreme programming should also be understood at http://www.extremeprogramming.org /. Rod Johnson's <Expert One-on-One J2EE Design and Development (Programmer to Programmer)> is also very valuable for the specific implementation of the J2EE project, the book demonstrates how to build a J2EE application with the simplest possible solution based on the rich practical experience of the author. The author puts forward this point for the first time. In many cases, there is no need to use ejbs for J2EE applications, for the majority of J2EE developers that must be called ejbs, it is also a bit cool. Of course, as a member of the Servlet and JDO expert groups, this is not what the author believes. Today, the Spring framework popular in the Java World originated from this book, and concepts such as IOC and AOP are even more widely spoken by java developers. Finally, as an in-depth study of Java, it is also necessary to read the Specification of Java technology. Write it here for now.

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.