Code Generator Development and Design

Source: Internet
Author: User

 

CodeThe process of generation is a software framework or system that converts and generates an organizational structure in a certain advanced language through a ing rule.ProgramImplementation process.

Development Purpose:

Code generators used within the Development Company,For the company's internal code implementation stage,Provides quick and effective assistance.

Existing features:

Generate a single tableModelAnd related operations

Main functions should be implemented in the current phase:

1.To implement multi-Table operations, more well-establishedModel.

2.Customize the method to generateDalLayer-related operations.

 

Functions to be achieved in the future:

Project Management:

For a database(Generally refers to a library),Create a project,In this project:① Contains allModelManagement,Custom Non-custom From system table.② For allDalManagement of layer classes and Methods,Class to be generated,How can this problem be solved?,ThroughDalManagement of the layer allows you to modify and edit classes.,You can customize methods, such as modifying parameters and self-developed methods..

Project Import/Export,Import and Export,Set all project information,Export to file,RecommendedSQL Server.ExportXMLStream Export,Import can import project-related data to the database.

 

Generation interface:

The generate interface is not to generate any interface, but to generate a certain style of interface based on a certain encoding criterion and a certain Encoding template. In this process, the key technical point is how to define the "joint" part in the generation process, that is, to directly generate different codes by controlling the generated module part, or by generating configurable code and generating modifiable configuration files (suchCSSDocument) to control the generated code interface, or both of them are expected to be used.

Another technical difficulty is that, after determining the location of the "joint" part, how can we define and generate a general rule repository that can be used for expansion, interface code generated.

 

Supports multiple databases:

From the implementation point of view, to support multiple databases, we must first layer the structure. The current code framework has been divided into layers, and the data layer has been separated, however, the overall implementation of the factory model is not particularly clear. In view of the current technology, it is more appropriate to focus on implementation and put optimization in the reconstruction stage.

 

Supports multiple data architectures:

Currently, the architecture of the system isPetshopLayer-3 mode generation. This mode is applicable to some websites.B/SArchitecture implementation, however, in otherB/SIn the system and some other software, this mode may not be suitable. In this case, a new and appropriate method is required for encoding and how to be compatible with the new software framework generator, it is also a matter to be considered.

 

Friendly operation interface:

The friendly operation interface here first refers to the software's appearance being very human-friendly. In addition, it is very important to refer to some operations in the software operation process, it may be complicated. For example, you cannot develop custom controls due to technical reasons. Instead, you can use some other commonly used controls. After mastering certain technologies, you can try to use custom controls to improve friendliness.

 

ImplementationWebServices

The improved software framework does not fully adopt the traditionalC/SDevelopment Method. Instead, it adopts a service-based model. Put the main business logic on the server to run.

 

Solutions for related modules

Generate multipleModelArchitecture:

From a single table pairModel, ConvertModelNested.

Generate basic methods:

GenerationModelAdd, delete, query, and modify operations

Generate custom methods:

Generating custom methods is the difficulty and focus of the system.,Is the core. Custom methods require the following elements:

Description  RedIs the key part of this implementation

Protection Level:Public protect private

Return Value Type:Void, String, Char, Int, byte .....Built-in system type

②String [] char [] int []Built-in Composite Type

ModelinfoCustom type

Modelinfolist <>

Parameter type :

Single Parameter

①String, Char, Int, byte .....Built-in system type

②String [] char [] int []Built-in Composite Type

③ModelinfoCustom type

④ No Parameter

`Composite parameters:

(1) ① + ① Type

(2)Others

Process implementation:

(I) Instant generationSQLMethod

Five methods:

①SelectReturns a single value.

②SelectReturns multiple groups of values.

③Insert

④Update

⑤Delete

 

 

Return Value-parameter-process combination:

Return Value Type

 

Parameter type

Process Implementation Method

System self-owned typeVoid

CustomModel

Insert

Update

Delete

Custom typeIlist <modelinfo>

System self-owned typeInt

No Parameter

SelectMulti-row result set

 

 

 

 

(Ii) Matching Method Based on stored procedures

Technical difficulty: method parameters And stored procedure parameters Make a reasonable match.

Two solutions are required

1

Generation Method parameters, which are one-to-one relative to the stored procedure parameters

Easy, but not easy to use

2

UseTableOfModelAs parameters, assign values to the stored procedure parameters one by one.

 

 

GenerateSQLCode Module

Generate relatedSQL

 

Generate interface code Module:

UseDomCode Generation, creation, and designDomTree and related interfaces

 

 

Complete system architecture work is required

Database Design:

Project Management Module

Custom Functions

Main Code Architecture

Unified Interface Definition

DesignSQLStorage Process generation module

 


 

Development stage and objectives:

Objectives of the first stage:

Familiar with the internal architecture of code generation, master the code generation mechanism, and the global definition specifications of the unified architecture.

Requirement: Understand the components of each module.

Stage 2 goals:

Create a new external software framework and refine the functions of each part of the code generation.

Requirement: A Preliminary model is available.

Stage 3 goals:

In addition, we can propose reasonable extension solutions,

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.