It was easy recently. With two years of new talent, we were able to experience the cool and bitter experience of working as a project manager, Technical Manager, test Manager, technical support engineer, and programmer at the same time. Maybe I am a hard-working man. Once I am idle, I feel awkward. Of course, this is a common problem for programmers ~. In the three years of working at the law firm, he has been engaged in several enterprise email systems, big, small, and well-known and unknown systems. Every one of them made the law firm unsatisfied. During the idle period, I plan to write a program in this area to solve the dissatisfaction in the previous system as much as possible. At the same time, because of the particularity of the enterprise mail program, it contains both B/S content, it also contains the content of the standalone software and some underlying knowledge of the system, so it is also suitable for case tutorials for new personnel training. After finishing the series, sort it out, it can be used as internal training for law firms. Well, I will not talk much about it. I will introduce some ideas about the program below.
The program itself should be used as a case study, and it should be oriented to newcomers who are new to the beginning, so the program comments and explanations will be as detailed as possible. Enterprise mail is basically a large project. Therefore, the program considers a layered architecture to facilitate expansion. The program itself contains the single-host software and B/S structure. For B/S, the program will strictly abide by Web standards. For standalone software, the program will consider multi-language configuration. The program incorporates custom tag calling, xslt, xml, templates, static applications, and provides complete examples. Because the program itself is a large project, it focuses on maintainability and performance. However, I personally believe in one sentence:The program is written to people first, and then to machines!Therefore, the program will make a comprehensive trade-off between performance and ease of use. The following describes the basic framework of the program:
Figure 1 Program Framework Structure
The program is named "Yi Xun enterprise Mailbox System", which is simple, fast, and efficient. The program is based on the. NET4.0 Framework. The development tools and auxiliary databases are VS2010 + SQLServer2008. The following describes the purpose of each layer of the program:
- EasyFastMail. BLL-business logic layer. Mainly responsible for business logic judgment of the program. Note: business logic is not a program logic, even though they are often similar and even integrated. Program Logic indicates whether an operation is successful. For example, deleting a piece of data determines whether the deletion is successful based on the database return value. This is the program logic, it determines whether a specific operation of the program is successful. However, in a complex environment, you need to consider many issues while deleting data, not just deleting data. Take the common function of deleting a user as an example: in enterprise OA, adding a user upon entry and deleting a user upon departure are difficult to meet the needs of the enterprise. In the enterprise, the management of resigned personnel is also an important task of the Human Resources Department. (For example, the leadership is discussing a project description. Everyone thinks it is feasible and promising as a whole, but some details are not clearly recorded in the written report, in this case, you need to contact the report writer or project owner. If the person has left the company, in a large number of cases, it may be due to forgetting or other reasons, it is impossible for him to give his successor a very detailed explanation of every job, so he needs to contact the successor. If the program is set, the user will be deleted after leaving the job, you may not be able to contact this person again, which may result in project shelving or other losses.) The resignation operation should delete the data in the User table and save the data to the resignation personnel table, in addition, these two operations should be placed in one thing to ensure the operation is successful at the same time. Otherwise, the transaction is rolled back and the operator is prompted. In this way, the user deletion operation should include two steps: 1. Delete the data in the User table; 2. Insert the data into the resignation personnel table. These two operations combine the business logic of the program. In summary, the business logic of a program is sometimes exactly the same as that of a program, and sometimes contains several program logics at the same time.
- EasyFastMail. Cache-the Cache layer of the program. Caching is not too important for programs, especially large programs. It can greatly improve program performance. We must pay attention to this point and pay more attention to it. I have seen a case where the program performance has soared by 7% due to a reasonable cache design.
- EasyFastMail. Common -- public class library component, mainly used to share modules and other auxiliary tool libraries between different layers.
- Easyfastmail. Model -- model layer of the program. The model is used to pass data. It can be exactly the same as the database table, or you can add or delete fields as appropriate. How to design, choose based on the actual situation, as long as the purpose of data transmission can be achieved. For example, in the Add User function, the user includes the name, login name, age, and Gender. If there is no model, many parameters need to be received for the corresponding method to implement this function, in this way, it is easy to cause bugs in the program due to carelessness, and if you want to increase the number in batches, it is more difficult to handle. If you have a model, it will be much easier to process. assign a value to the model and pass it to the corresponding method. The method can be set to a value from the model as needed.
- Easyfastmail. sqlserverdal -- database operation layer of the program. Note: Do not make logical judgments in the database operation layer. The role of this layer is to add, delete, modify, query, and provide the returned values for the call layer to determine.
- Easyfastmail. Web -- page display layer of the Program (B/S structure ). The presentation layer is responsible for collecting, displaying, and verifying whether the collected data is valid. This layer is the hardest hit by program chaos. A common mistake for new programmers is that the layer contains too many logic and data operations. In this way, the purpose of layering is lost, and the maintainability and scalability of the program become empty talk. Please pay attention to this.
- Easyfastmail. winform -- display layer of the Program (stand-alone software or C/S structure ). The precautions are the same as above.
Well, the content of this chapter is here first. From the next chapter, we officially enter the encoding process. In addition, this series of articles is written by myself in my spare time. I have no energy to do a lot of preparatory work, so there are inevitable omissions. You are welcome to criticize and correct them, I will modify the corresponding chapter based on my comments and suggestions. I have watched Mr Zhang Xiaoxiang's Java series video. I personally welcome it, but I am not sure whether it makes sense for new people. So I am hesitant to do it or not. I also welcome you to give more suggestions.