In this project development practice, I once again tried to generate C # code with a Python script, which made me very satisfied--improved code quality, maintainability and productivity, and reduced error rates.
It seems that things are going in the right direction. So what are the contributing factors? I think for a moment, there may be the following 2 points:
- Practical technical experience in generating code with scripts
- When I use the 1th, I feel the "Data modeling" and "Framework Design"
Recalling this design process, I first identified the following parts of the data:
- Front-End Presentation data
- Business layer Data
- Data-tier data
Use an Excel table to define the three-tier data, and then generate the code from the script. However, since this business is not complex, the three-tier data is defined in a table.
After this part of the work, and then look back, this process is not the data modeling process?
Once the table definition is complete, the Python script is written according to the definition in the table, generating the code for the front-end presentation layer, the business layer, and the data layer. The generated code, in fact, is a function code that represents a particular function.
Here I think of the common MVC framework, and does the MVC framework provide a complete set of functions for accessing requests and content presentation? In fact, a little bit more, the framework does all this stuff.
Now, it seems possible to draw this conclusion:
Data Model + Framework = A system that can be run.
This is a very simple equation, and the vision that unfolds in front of us is that our daily development work is to build the data model and then put them into the frame so that we can rest. If you really believe in this picture, it means you're being brainwashed.
In our project, there are hundreds of thousands of lines of code in the CS file, open a stored procedure, there are thousands of lines of code, they are a hotbed of bugs, like nightmares often haunt us. So what code is this code?
I think that this code can be divided into the following two kinds:
- Code for Business Logic transformation
- Code that lets the framework identify data
Cond.....
A tentative summary of data modeling and framework design