Mass seed module is done.

Source: Internet
Author: User

The author of course is not easy, to consider a variety of compatibility issues, to consider the efficiency of the problem (he really thought about it, I strongly doubt, seems to be just style to imitate other source code)

Quite without words.

Originally I know, the process of code debugging gradually improve, and gradually with a variety of compatibility problems and unexpected bug deal with the original rigorous structure will gradually decay, but the structure of the author is really not very rigorous.

Because some of the design, completely for compatibility, so some even without understanding, I do not understand, after all, I do not intend to maintain the code.

I'd like to summarize the pros and cons of this set of code.

1. The name must be meaningful, if it is a temporary non-meaningful name, then the late reconstruction should be changed to meaningful. Some like checkdeps, what this means, some code is basically to solve the compatibility problem, the name of the time, you can not follow the code content, because the reader is not aware of the compatibility issues you are familiar with. Sometimes define a number of names of variables, such as ID=XXX?ID:YYYY, and then use the URL as a complex ID, and such as the closure of internal and external variables, resulting in a great deal of confusion later maintainers.

If you expect other people to maintain this code, do not have a variable such as Id,list,array, even as a temporary variable. Light look at a function can also, see a few messy mess.

The name should be named according to function, and should not be named according to the details.

2. Code functionality issues that are consistent with naming. The use of global variables may be unavoidable, but be sure to separate compatible and non-compatible code. The normal code considers compatibility issues and almost inevitably violates the principle of single responsibility. In particular, there are a variety of patchwork, coincidental notation in compatible code, which are best separated from normal logical processing, especially complex logic. You should try to separate the logic and compatibility, and logically encapsulate one piece of logic alone.

In particular, the design of data structures should not consider compatibility issues. Otherwise, your frame is highly correlated with a certain version of the browser, and future generations want to change it. The complexity of code is orderly, limited, and the complexity of compatibility is endless and irregular. There's no need to do anything. URL naming, multiple different versions of the error problem, it is now clear that you have not yet done a version of the seed module into an imagined complex needs.

Two different versions of the module load, can not get the correct results, it is inevitable, cannot eradicate.

Your code to work with jquery efficiency that is not possible, if you want to be able to maintain, you must not cross a number of levels of function call global variables.

The use of global variables and closures in moderation, before use must be considered well, why in this position to use, what benefits, the greatest benefit is to encapsulate a whole block of functionality.

Complex structures are best defined at once, and do not add intermittently during program popularity.


Mass seed module is done.

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.