[On Demand] A method for reusing code

Source: Internet
Author: User

Date: 2010.01.19.
Keyword: Javascript methodology kiss principles

Today, I am tossing JavaScript for a day. I have never touched on JS programming before. In order to ensure the project progress, I tried my best to read the JS Code for half a day and started coding in the afternoon. Only then can we find that JavaScript programmers are very good at reusing code. Many seemingly complex operations have small components (What should we call the js code library ?) . So far, most of the work I need to do when using JS programming is to find or ask my colleagues online for a useful code set, and then reuse the code to implement the desired function. However, you also encountered a problem when reusing the code. Copying the sample code directly to the project code is often unavailable. In this process, you also need to use IE8 to debug the JS script to find the error point, then modify the code. The modification results are often unavailable. This process took me a lot of time and I found a good solution until the evening: I reduced the code of the routine before I took the code to be reused, wait until a minimum test code that can be run is constructed, and then post the code to the project code. Of course, this method cannot be guaranteed to succeed at one time, but after comparing the project code with the refined test code several times, we can often find the correct method of use.

The original principle taught by Lao Tzu in Moral Education
See xiaoyiming

And can also be used in programming. Think back to the Unix Design Philosophy
Keep it simple, stupid (kiss)

Yes, it is small and simple. It can make our lives more clear, and the productivity at work will also rise sharply.

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.