"The silent forests are, the more secluded the birds are." This is the exclusive sentence of Ancient Chinese pure poetry. It is quite beautiful under the influence and quietness. This kind of dynamic and static Realm exists in the field of software. If the software is properly designed, it can also make the software design elegant. I am not very familiar with sculpture, and I have always been very respectful of this solidification beauty.
Agile Software development is very popular nowadays, and the most popular discussion is the design model. One of the values of Agile Software development is to welcome changes and embrace changes. I can say "dynamic ". However, solving problems or changing business has always been one of the longest and most difficult problems in software engineering or software design technology, and there has never been a thorough solution. The design pattern is the abstraction of experience, which is a kind of solidification. I can think of it as "static ". However, the design model uses a static method to process dynamic transactions, or to make the transaction processing more dynamic. It is really static, dynamic, and static.
What I want to talk about today does not seem to have any relationship with the two. I want to emphasize and express my views on system configuration or system parameter management in a project.
In the application field, especially in the database field, we often need to configure some definition information. For example, a workflow management project involves the Visual Definition of a workflow. The Visualized definition of a workflow contains a lot of content, such as node definition, process definition, rule definition, event definition, personnel definition, and permission definition. It can be said that it is a complicated process. In general, we store the definition information in a data table. It is extracted from the database when it is needed next time.
Is a part of the use cases in the workflow.
When using the definition information, we usually use the following method:
The benefits of doing so are:
There is only one benefit: simple calling !!
However, the disadvantages are obvious. At least there are several disadvantages:
1. You need to constantly query the database. You need to query the database every time you use it.
2. increased the pressure on the database.
3. Added Network data traffic and many roundtrips. Low efficiency.
4. added opportunities for errors.
Since this is a bad method, why should we use it? How frequently is it used? Maybe it's really silly and cute?
However, in the. NET world, we can use the. NET magic weapon to subvert our traditional usage. What are these secrets?
A. Codedom
B. Reflection
C. Oo
Yes, it is enough.
Let's look at our new method:
We noticed that the arrow pointed out that we used to extract information from the database. This time we changed from Program Extract data in a centralized manner.
The advantage of doing so is that
1. No need to access the database unless the definition information changes
2. reduces the pressure on database servers
3. Make the software more robust
4. Reduces the network transmission pressure.
So what are the specific practices?
1. Define a template file. The file is C # code, similar to codesmith.
2. Define some abstract base classes in the template file
3. Define the assembly to be referenced
4. Change all business rule definition data to a group of business types.
5. Use codedom to dynamically compile these files to generate a specific Assembly
6. define policies to access these sets. For example, template1101.dll, with the suffix 1101 indicating the template ID. If you use the 1101 template, you can directly access the template1101.dll assembly.
In this way, we will solidify the data that requires frequent access. I call it sculpture.
In software systems, we can use this method to process data that is not constantly changing. I personally think this kind of processing is more elegant.