Develop Project auxiliary tools by yourself

Source: Internet
Author: User

During project development, many people have encountered a large number of code with common rules, although there are many differences. For example, in the Entity layer of the petshop project, each entity class describes the structure of the corresponding database table, except that the table and field names are different, and the rules are the same. If you manually generate and maintain this part of code, the number of tables will be a little better. If you have a little more, you will feel a heavy workload, and the two will feel a lot of repetitive work, copying, and pasting, then overwrite. In this case, you will choose to create an automatic generation tool for entity-layer code generation, which can avoid a lot of manual work and improve development efficiency, and reduce the impact of changes in the database table structure caused by changes in database design that cannot meet requirements. Typical code generation tools such as codesmith. (I have installed it, but it has never been used, because I like it myself)

Code generation tools are part of the project's auxiliary tools. In fact, in the project development process, in order to reduce repetitive work, reduce the possibility of errors, and improve development efficiency, we will make some auxiliary tools for specific functions, such as code generation and maintenance of system configuration files. We always stick to the principle that as long as we can do work with programs, we should not waste our physical strength. It may take some time to implement the auxiliary tools, but after the completion, the convenience and speed are obvious. (Of course, if this part of the code is very simple, it will take one minute to finish writing, and the modification may not be great. The result will take one day to implement the auxiliary tool, so it is unnecessary, depends on the actual situation .)

First, let's talk about some of the relatively important auxiliary programs in the projects I 've experienced. Later, we will talk about the management problems brought about by the management of these auxiliary tools while bringing efficiency, and the solutions used.

For example, one layer in the project is the data entity layer, which describes the reflection of business objects in the database. According to the original method, each Entity description class needs to be constructed manually. How to construct it? Every table writes a class and lists the columns of the table as member variables of the class. At the beginning, I felt nothing, because it was not the copy, copy, and paste of the code. It would not be too complicated. However, when I was writing an object class, I found it too complicated to write it. A bunch of tables, that is, it would take a day or two to copy and paste them without stopping. At that time, the time was also spent, and people were dizzy, and the changes to the database table structure could not be avoided. This kind of work was really not challenging. Therefore, a code generation tool is used to generate entity classes based on the database and table selected by the user. Since it was just getting started with ado.net, it took me one workday to complete and debug the code generation software. After that, no matter how the database changes, you just need to click a button to generate software for the code. It achieves both functions and exercises.

For example, if the project involves the maintenance of an XML file, everyone in the project team can add or modify the configuration file as long as they need it. (VSS is used for project control to ensure that only one person can modify it at a certain time.) At the beginning, such modifications did not cause any problems, because there was little information, manual maintenance does not work much. However, as the project progresses, the Information volume described is getting larger and larger, and the changes are becoming more and more frequent. Once the latest configuration file is obtained from VSS multiple times, the program cannot be parsed. Because of the large amount of information, you cannot view the configuration file after opening it, and it is inconvenient to search for it. It is difficult to quickly troubleshoot the error. The most common method is to overwrite the configuration file of the previous version. This is always not a method. Therefore, the maintenance program of the configuration file is developed, and the project team uses the software for file configuration. After using this configuration program, you will not be too worried about the configuration of the XML file.

In addition, the parallel operation of the new and old systems will cause the integration of new and old data during the project launch process. You need to import some of the original data into the new system in the new format. Think about it. If you want to manually convert it, it will not become a robot after it is finished. As a result, a data conversion program is developed and controlled by the program. It took some time to write code and test, but once and for all, you don't have to manually convert the data. You only need to view the logs to see which data is successfully converted and which data fails to be converted, check the raw data of the data, find out the cause, and then start the conversion thread again. (This program is the most memorable one)

The existence of these auxiliary tools improves the development efficiency of the project and reduces the loss of the project. The effect is obvious and it is also an application of the mastered technology. What I miss most is the implementation process, and I am most happy to see the use of auxiliary functions.

In future projects, we will first consider whether a part of the project can be completed using another program. If possible, we will try to use the program to complete it.

Always adhere to the principle that as long as you can use the program to do the work, do not waste your physical strength.

Now, it's time to go back to dinner.

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.