11 tips for improving your programming skills

Source: Internet
Author: User
Tags naming convention numeric value square root

Programming is a cool thing, but behind the scenes it's hard for a lot of people. Many people are defeated by difficulties at the beginning of learning programming.

When you are unfamiliar with programming, you may feel that you don't know what to do and how to use the knowledge you have learned. As long as you pass this difficult period of study, you will find a new world.

Here are some tips to help you quickly improve your programming skills.

Introduction to Programming:

1. Write more code

The best way to learn something is to practise it. You should spend a lot of time building and writing code unless you think the practice is not helping you. You can start with simple programs that are related to basic knowledge.

2. Participation in different types of projects

When you are familiar with a development language, you should start doing some business. Doing so will give you a complete understanding of the performance of that development language, and it will also drive you to learn something about the language. After a while you will find that you often use similar methods to solve similar problems, it will be difficult to jump out of the inherent thinking to learn new skills.

3. Proficient in one or two languages you use

Read one or two good books about the language. Focus on the advanced development theory of this language knowledge, and its core and language library enough to understand. Make sure that you have at least one scripting language in the language you are using.


4. Start reading


Read as much as you can. Books can help you learn a language in a systematic way, and can bring you to understand all aspects of the language. It is more important for beginners to read more books.


5. Join the discussion


When you talk to someone, you have ideas or ideas that you have never seen before. In the process, you can learn a lot from others, and it's also an opportunity to check out how much you know about the language by sharing your thoughts about programming.


6. Read through the company's internal technical and training materials


For example, Google has a lot of code labs, and the best practices that Daniel has decades of experience writing in a variety of languages are used in laboratories for core training and quality guidance. If your company does not have similar resources, Google's open source has some of their guides: https://code.google.com/p/google-styleguide/


7. Write a blog


When you learn to program, you will encounter all kinds of problems and try your best to solve them. You can write down your problem-solving process and what you've learned from your blog. Other people can also benefit from seeing your article. At the same time, you can make friends with like-minded people.


As for the time spent on learning programming, you should initially squeeze 20% of your personal time to improve your personal development skills. If possible, it's best to be one or two hours a day instead of a week, because you can improve your ability through everyday habits. The effect may not be obvious at first (if you're distracted by the Internet or anything else), but the goal is to make you more efficient in your long term programming learning.

Programming to improve the article:

1. First, careful analysis of the problem

2. Then think about how to solve the problem.

3. Collect and collate all requirements.

Take the time to write down the goals that the final product is going to achieve and identify which of our target groups of users. If this step can be done well, it will save a lot of time behind, is called Maito.

4. Write a comprehensive implementation plan (or model).

If it's a small project, this step may be just a basic process or a simple equation.

If it's a larger project, this step helps us cut it into several modules and then think about the following questions:

What tasks each module needs to perform

How data is passed between modules

How to call data in a module

While it is tedious and uninteresting to write code and collect and plan requirements, if this is not done well, debugging later will be especially cumbersome. If we can take the time to design a correct program flow and structure, then we actually have half the success before writing the first line of code.

5. Annotate our code.

If you think your code might need an explanation, annotate it. Each function should first describe its arguments and return results, one or two lines ahead of time. Instead of telling you what, the note should be about why. Also remember to update the comments when you update the code.

6. Use a uniform naming convention to define variables.

This will help us to track the variables of each type and the purpose of each variable at a glance. The benefits of this article are not only convenient for us to play x = a + B * C So simple, it will make our code easier to debug and maintain. One of the popular naming methods at present is the Hungarian Naming Act, which uses the type prefix to the variable. For example, for the whole variable, we can use Introwcounter, and the string is strUserName. Whatever your naming convention is, it doesn't matter, as long as it's consistent and simple enough to describe the variable.

7. Format the editing code, and visualize the structure of the code.

For example, you encounter conditional statements (if, else, and so on) and loop statements (for, while, and so on) indented code. Also, you can add a space between the variable name and the operation symbol, which refers to "+", "-", "*", "/", and "=" (for example, myvariable = 2 + 2). This will not only make your code more intuitive and elegant, but also make our program flow more clearly.

8. Comprehensive testing.

First, we test whether each module can operate independently by entering the values we expect. Then try to enter some possible but very rare values and continue with the test. This basically exposes all hidden bugs. Testing also has the so-called skills, through practice and practice, we can gradually build up the appropriate skills. The test should contain the following conditions:

Extreme value: Positive value with 0 and greater than expected maximum; text with empty string, parameter null.

Meaningless value. Although it is unlikely that users will enter garbled characters, we should test them anyway.

Incorrect value. Enter 0 in the division, or lose a negative number if the expected number is positive and the square root is open. When the input type is a string, enter a non-numeric number and see if it will be resolved to a numeric value.

9. Practice, practice, or practice.

Programming will continue to evolve as the Times move forward. So there's always something new that we need to learn--even more useful and important--and there are always things that are worth knowing about.

10. Reduce the risk of change in demand.

In a realistic working environment, demand is always changing. However, if we have a very comprehensive collection of requirements in the early stage, the initial implementation of the plan is very targeted, then the late due to changes in demand and the possibility of misunderstanding between the two sides will be much less likely.

We can improve the clarity of the process by presenting the requirements documentation and implementation plans before we start writing the code. This will help to ensure that our plan is truly done in accordance with the customer's requirements.

If you compare a project to a series of milestones, then just do one at a time. Remember, the fewer things you need to think about at any given moment, the more detailed and perfect we think.

11. From easy to difficult, simplified into complex.

If your software is complex, then I suggest you start with a simple module. For example, there is a project: Design a program that requires a gradient graphic to follow the mouse direction and change the shape depending on the mouse's sliding speed.

First of all, design a square, write a piece of code that can make it follow the mouse, so that the motion tracking problem is carried out separately. This is, of course, the first step.

Next, the size of the square is associated with the speed of the mouse, which solves the problem of the shape changing with speed.

Finally, create the actual shape you want, and connect the three components together.

Using this method, it is natural to write modular code. And each component has its own independent function. This is useful for code reuse (for example, you can apply the first step (for implementing mouse tracking) in other projects and make our programs easier to debug and maintain.

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.