Preliminary attempt on Code Generator

Source: Internet
Author: User
I saw instructor Li's CodeThe following code uses a generator, but for a project that has already been defined by a basic system, such as some components, classes, and interfaces, the use of his code generator is indeed somewhat impractical for the following reasons:

1. The Code cannot be integrated with the original project at all, and more than 90% of the code needs to be modified. It is determined that I cannot use his code generator.

2. The Code style is completely different from the personal style.
This made me very depressed, because my personal programming style has been formed, and I am not used to the Code he generated. For example, some variables, I am used to starting with "M, no matter what type it is, because I can know the type from the variable name, or the development environment will prompt the type, so I am not used to using "istudentnumber, strname, dmondy "and so on, this is completely a personal habit, because from" m_loginname "I know it is a string. Of course, this is just a habit.

3. Database interfaces and some middleware problems.
His code generator also has several layers of architecture, so it also generates some intermediate structures. However, for my projects, there is a fixed structure, it is impossible to add some new structures and code to change the original intermediate structure, such as some data layers.

Of course, it may be that I am not used to this code generator, so these problems exist.
However, I really don't want to write some mechanized code, so I made a self-developed tool to facilitate quick development of the intermediate structure, named it smartcoder.
This is just a preliminary attempt. I have long had this idea to write a code generator. However, the time relationship, without careful architecture and development, only took half a day and made a simple one, tools that can meet my personal project requirements for the moment. Of course, I really want to spend some time developing it seriously. I am also keeping in touch with Teacher Li, hoping to develop a good code generation tool to replace some boring mechanical coding work.

Select a field from the database. The tool automatically generates relevant code based on the data attribute. For example, if a field is automatically added as a key field, it is not modified when it is added or updated.

The generated code can run normally in the project, which is much easier.

This is just a preliminary tool. I believe I will improve it if I have time. Currently, it can only generate code from my project, so it is not a code generation tool. Wait until the time is ripe.

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.