Top 10 Code Generation principles

Source: Internet
Author: User

Code Generation principlesTop 10

1.Give proper respect to handwritten code

Although code generation can save a lot of repetitive work and improve development efficiency, you must know that no matter how powerful and flexible your generator is, there are many special circumstances, these may be out of the scope that your code generator can generalize. Therefore, although you use a code generator, handwriting code is still necessary.

2.Handwriting code should be considered first.

Even if it is necessary to use code generation, you must use it again when you are sure you understand your framework.

3.Control your code.

A good source code management system is required for successful code generation projects. If your Generator operates a file that already contains handwritten code, you need a version management system to ensure your work.

4.Consider the language with caution.

The tool used to implement generators is different from the tool used to implement applications. One problem with the generator is that it tries to solve many completely different problems that the application will solve. Based on this, you should consider the generator as an independent project to really choose your tool.

5.Integrate the generator into your development process.

The generator is a tool used by engineers. Therefore, it should be reasonably and completely integrated into the development process. It can be integrated into the IDE tool or build process.

6.Contains warnings.

In the code generated by the generator, warnings should be given to those areas that should not be modified to prevent manual changes. If it is manually modified, the version of the generated code cannot be consistent. At the same time, unexpected behaviors may occur in important areas.

7.Make the generator more friendly.

A generator is a tool for programmers, but it doesn't mean it can be rough. The generator should tell the engineer what he can do, what he is doing, and what files it generates. The builder should be easy to use and user-friendly.

8.Contains documents.

Good documentation is a selling point of generators. Your documents should be complete and clear, but not too many documents. In addition, special instructions should be made on key points, such as what the generator can do, how to install it, and how to run it.

9.Remember that not all people will accept code generation.

Reading documents, training, and one-to-one meetings for your colleagues is very dangerous for the successful promotion of your generator. People are always skeptical about new things. You need to make them realize what benefits the generator will bring to them.

10.Carefully maintain the generator.

Unless the generator is only a temporary solution, it must be carefully maintained for a long period of time. The generator controls a large amount of code and maintains the generator and the Code with the same meaning, you should arrange special time and money to maintain and upgrade it.

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.