When using ASPs many years ago, I heard a magical thing called code generator. Just specify the database link, this code generator can generate an interface, then select the data table you need to generate, press the button, and immediately generate it based on this table, the corresponding ASP program code is generated, Convenience. At that time, I had a light car to the ASP. After reading this tool, I asked the heart, and then used a ... I saw the ASP program source code generated by this tool, which is really a bit uncomfortable. Redundant code in large sections. Although the generated code is indeed capable of completing a specific business operation, the maintenance is really too bad. It is said that there will be some quality code generators to generate better programs, but they have started from that time, the code generator became synonymous with garbage code. I am willing to write a line of code and don't want to use the code generator.
Now, when focusing on a certain industry, you will find that repetition is so big. - User management is similar in most places, just a variety of fields, and the user login interface, the logout interface may be the same, just change some pictures; most of the business operations are Increase and delete the refund, and repeat the same manner in this operation, it has to be careful; the authority management interface doesn't seem to have a big difference ... Maybe we have been annoying. The framework guarantees the quality of the project to some extent, but does not reduce the amount of encoding; some frameworks do even need more encoding (and learning time). For example, since Struts except JSP, Struts also needs to write specific form, action, plus a few lines in Struts-Config.xml; TapeStry needs to write .page, .html, corresponding Page class If you need to verify the delegate class; as for FreeMaker, Velocity's interface workload may be small, but you have to write your own simple framework for MVC mode. Spring integrates these representations, it looks better ...
The fundamental problem of the above solution is that the framework only ensures quality, maintainability of the project, but does not reduce the amount of encoding. Therefore, the use of code generators is based on This has already had a precedent, most effective, mostly powerful power of the XDoclet's EJB task. We know that creating an EJB requires simultaneous creation of other four boring interfaces, XDoclets have played the power of the code generated in this regard. In addition, MiddleGen can also create a web application based on a database, using Hibernate, Struts, EJB technology, which can generate JSP, Hibernate mapping files, Java classes, EJB classes, etc. MiddleGen should be the prototype of the most complete application generator I have seen, but he is not enough to specifically, not enough to shorten the encoding time.
I think a few days, in the process of making Openbugz and corporate project, I came up with this model:
Infrastructure: Spring, Hibernate, TapeStrySpring, Hibernate is not allowed, the front desk does not use struts or webwork because the top two are not flexible enough in the interface, and Struts needs to cooperate with Tiles to achieve flexible layout. Webwork is not familiar, I don't know how to achieve flexible layout. However, the problem in TapeStry is hardly problematic.
Application Technology: Ant, XDoclet, FreeMaker, JUnit with freemaker without Velocity is because the former has more support, and from my feelings, Freemaker is relatively powerful. Development Steps: 1 First Developer (Project Manager or Technical Manager) Modeling the entire system according to the requirements, completes the basic class map, generates all business model classes; Especially when there is a inheritance relationship between the business model class); 3 (code generation) generates a corresponding DAO interface such as XXXDAO, used to increase the XXX object (if you use Spring Hibernate Template, this step can be omitted) 4 (code generation Generate a DAO implementation 5 (code generation) generating business logic layer code XXXMANAGER to invoke a DAO layer to create a variety of business logic operations; 6 (code generation) Generate unit test 7 (code generation) generated a business model with XXXManager Class's Increase Reform Interface HTML (Code Generation) Generating Interface The .page File 9 (Code Generation) required for TapeStry If you need to verify, you also need to generate the required Delegate class 10 (code generation) generation Increase Remarks Page 11 (Code Configuration) Configuring DAO Transaction 12 (Code Configuration) in Spring Profile Configuring the XXXManager13 Configuring Database Link in Spring Profile, using Hibernate's SchemaExport to generate database 14 to generate the entire project File structure, including build.xml, can also generate JBuilder or Eclipse item 15 development if needed: Make changes to XXXManager, modify the interface.
As can be seen from above, the workload of the entire project is already very low ;-) This is relatively high for business analysts, and it is required to be completely thorough. Only the last job in the project is left to modify the business logic, and the modified page is modified. This is the power of the code generator.