International opinion: 10 things you need to do right away to help you program

Source: Internet
Author: User

International opinion: 10 things you need to do right away to help you program

 

[Csdn compilation] We have been striving to master things that are brand new to us. So what can we do to help learning? The following is a list of 10 things about how to make your programming more rapid and reasonable. I prefer to use Ruby on Rails, but the following points also apply to other environments.

1. Upgrade unit test

Your programming is not tested? You should perform the test at any time, that is, tatft (testing all the fucking time ). Of course, you should choose a better method than unit test. Rspec and shoulda are two optional tools.

2. Try TDD

Now that you are testing, you should record these tests. Do not record the code and overwrite it with subsequent tests. Instead, it should be a record of methods. Test drive development can help you compile better code. The most important foundation of tatft is TDD. It is not difficult to perform tatft. First, you can write down the simplest test and run it, observe the test failure, and then write the execution statement to make the test pass, repeat this process without stopping.

3. automated deployment
Automation is your best friend. It is quite useful to implement automatic Capistrano. After you configure and deploy your project, the first thing to install should be Capistrano. Automatic deployment from the first day will save you a lot of time.

4. Install SCM

Install SCM and learn how to use it. The advantage of doing so is that the Code in those overweight libraries is no longer so redundant. Currently there are a lot of tools to choose from. I use git every day. Git is a very special distributed SCM, that is, DSCM. DSCM is promising and can work with users with other libraries.

5. Review continuous integration

Now we have tested the code and stored it securely in the library. What is a better method than continuous testing? Automatic Testing is a good choice. Thanks to the existence of cruisecontrol. RB, this application tool automatically runs those trivial tests.

6. Understand your code

Writing code is one thing, but the more important thing is to understand the code. Four automated tools can be used to help you understand the code: flog, tarantula, rcov, and saikuro. These tools have their own uniqueness. I would like to introduce them to you.
Flog, which records complex results in alphabetical order.

Tarantula, based on relevance principles and some flexible creative designs. What it does is Spider your rail application to search for bad links. This is a relief, and I have benefited a lot.

Rcov is a very popular tool in the ruby field. It is a C0 range tool. In other words, it accurately determines which parts of your code are being tested and which parts are not being tested. The only defect is that it cannot test statements such as "If condition_a & condition_ B | condition_c.

Saikuro can measure the complexity of your code loop, that is, you can calculate the number of Branche and Path in your code. Of course, the lower the complexity of your code, the easier it will run.

7. Upgrade Your fixtures

Fixtures is one of the creative things, but it has many drawbacks. Fixtures has very few alternatives. I chose to use rails scenarios because it works like fixtures in testing, but allows me to make DSL better than yaml. I can also specify multiple scenarios in a file, which will make things more organized.

8. Collect analysis objects

Build a new system on the rail platform. New monitoring tools are available every week, so we have a lot of options. Here I will introduce the tools I have used: hoptoad and tuneup.

Hoptoad has good capabilities for abnormal packets. It can collect intermittent applications and display the collection results in a simple way. Also, this is a free software ~

Tuneup obtains data in another way, and calculates how long it takes to combine itself in each place. Does it take a long time to build your page? But you don't know why it took so long. Use tuneup to check it. You will find things you have never thought of before. In addition, tuneup is an open-source software. you can log on to their hosting service to share your results.

9. read other people's code

Do you want to become a better programmer? You must read more code, including good, bad, your own, and other people's code. Reading code is a skill that many programmers do not pay attention to. However, it is an extremely required skill to quickly read others' code and understand its meaning.

10. blog writing habits

Personally, when I read my blog, I can find all the information. Most of the time, I write key points related to technology, and occasionally discuss some simple topics. Blog writing is for sharing reasons. You can write down technical skills that can help you save time, or some technical difficulties and commands that you want to remember.

Address: http://smartic.us/2008/9/9/10-things-you-could-be-doing-to-your-code-right-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.