Tips summarized during development

Source: Internet
Author: User

During normal development, we always encounter various problems. When our technology is not enough, it may not be a big problem. However, once the technology gradually matures, what we writeProgramAs we grow bigger, we will face more and more challenges. 1. How to quickly understand a new class and its methods 2. How to simplify program development to cope with the growingCode3. How to find errors and locate exceptions in increasingly complex programs 4. How to make better use of the Development Platform for more effective learning. To sum up, it should be the question that a programmer who is in the increasingly sophisticated technology must face to improve their programming capabilities.

1. Understanding a new class is what we must face in learning. In development, we must use various services, controls, components, and custom classes. If we learn one by one, so I will learn the best way to learn about the monkey year and month, which is to summarize various ways to master new classes, we all know that a class is white, that is, the synthesis and encapsulation of its internal objects and methods, so we should start with learning a class from the method, you can also find a class from the method and then start with the method of this class to understand the class we want to know. You can use the javadoc window that comes with eclipse to get a preliminary understanding of the class, press ctrl to move the mouse over the expected class, click, or right-click in the javadoc window, and click Open
Input, you can see the internal methods and objects of the class, and then combine ALT and "/" to view all the methods of the class, you can know which methods of the class are your own, those things are inherited.

2. Code expansion is inevitable. What we can do is to simplify development, modularize and function the code, and combine functional thinking for development and logic. The principle is that when the main class uses various types of implementation and the basic method is to use, that is, the overall planning, and all functions are modularized into various types, and when dealing with various types of code blocks, the code is modularized through annotations, so that accurate positioning can be achieved and development efficiency can be improved. However, it should be noted that nullpointerexception is prone to NULL pointer exceptions because the object is not instantiated and may occur due to: 1. An error occurs during the transfer process, for example, when the method is passed, there are differences between classes. 2. Errors occur during inter-class calling. Generally, internal classes are 3. Although there are references after modularization, they are not instantiated because the instantiation of each module may overlap, it will mistakenly assume that it has been instantiated.

3. Generally, log can be used to meet the requirements. you can locate the error location and type, but it is troublesome to mark log. Therefore, you can use DEBUG, however, when the program is large to a certain extent, debug should be used, because the annotation may need a lot. Of course, this only varies from person to person. The key lies in the accurate identification of error types, which requires us to have a basic understanding of various exceptions. In combination with logcat, the basic error searching skills are sufficient.

4. Use the javadoc window and logcat window, press Ctrl to move the mouse to the desired class, ALT and "/" to view the class, out line (this is especially important, can be used to accurately locate methods, objects, and some internal classes, but you can use it to locate the code when you want to add the code.), file explorer, debug window, ddms, Java, debug mode for various learning.

In programming, the key lies in concise memory. If you need to remember more, you can easily remember and remember wrong. Therefore, the key to programming is concise. What is concise is to summarize general skills, such as classes and methods, logic, design patterns, and other general technologies. In programming, you only need to take care of the new knowledge steps, this simplifies programming and makes it easy to remember.

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.