Current location - Training Enrollment Network - Books and materials - A Summary of the Development of Book Management System (from the Designer's Point of View)
A Summary of the Development of Book Management System (from the Designer's Point of View)
It's almost a month since classes started. I made a small project for the first time-book management system. Very small, but I have gained a lot from it, not handing in homework, but consolidating my knowledge and laying a good foundation. One. Programming specification, programming specification, this is what I feel most. Now enterprise development projects can no longer be done alone. They need to be carried out in a division of labor and pay attention to teamwork. Team members should read each other's code. Moreover, after a system is developed, it is not necessary to use it once, but to constantly upgrade and maintain it to meet the changing needs of users. In this process, it may not be done by yourself, but by others, which requires anyone to read and understand your code independently, so the value of programming specifications is naturally reflected at this time. In view of this, the code should be written in line with industry standards and norms. For example, the annotations of documents should be understood clearly, and the functions, naming, parameters and return values of classes and methods should be summarized in detail as follows: (1). The name of the package should reflect the function of the system you want to develop, and the name of the package should be clearly divided into four layers. Generally, the company domain name should be used for reverse writing. That is to say, this book management system can use the domain name of our school as a whole, plus the system name book, followed by the names of various layers, such as cn.edu.hevttc.book..ui (presentation layer) and cn.edu.hevttc.book.service (service layer). Cn.edu.hevttc.book.dao (persistence layer), cn.edu.hevttc.book.domain (this package mainly puts entity classes and mapping tables in the database), or there can be a package-cn.edu.hevttc.book.util, which puts the tool classes that may be used by the whole system. Also note that the package name should be lowercase. (2) Naming of classes, methods, variables and controls 1. The name of a class must be a noun, not a verb. The first letter is capitalized, and words are separated by capitalized first letters. For example, this is a service layer interface, public interface book service { The naming of methods is generally that the first word is a verb followed by a noun, the verb should be lowercase, and the first letter of the noun should be capitalized. For example: public string getNextID(){

................} 3. Variables are usually named the same as method names. 4. In VE, the name of the control is generally before the type of the control+the meaning of the function to be completed. For example, the naming of labels: the naming of lblResults buttons: the naming specification of controls that btnSubmit can refer to. Net. Note: Generally speaking, no matter which aspect is named, it should reflect the meaning of the function it wants to complete, so that any programmer can "know its meaning by its name" when he sees your code. This is the most important, which directly reflects the readability of the code and is an indispensable part of the programming specification. (3) The annotated problem notes must be understood in detail. The quality of document comments is directly reflected in API documents, because others want to know the functions of code classes, methods and interfaces from API documents. At the beginning of the whole document, make a statement about copyright, time, etc. , and at the beginning of the class, use/* ………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………… Methods should explain functions, parameters, return values and possible exceptions; The annotation of variables should explain the meaning represented by variables; Document comments should be placed in/* * ............. */,and only those placed in it will generate API documents. Note: The easiest way to write a good review is to refer to the code of Sun Company, because it is authoritative. First, the hierarchical structure of system design (four-tier structure) The quality of a system design is directly linked to the durability of the system, because the standard for measuring a good system is to see whether it can meet the changing needs of users and whether it can meet the requirements of reusability and expansibility. To achieve this goal, it is necessary to put classes with the same function in the same package, that is, in the same layer. These layers are not called directly, but through interfaces, but can be closely related to each other to achieve high cohesion and low coupling. This time, I have a deeper understanding of the importance of the four-tier structure. Free play for the first time, just finished the function, the layers are too closely connected, all crowded together. "You changed this place, you have to change that place again. This kind of code maintenance workload is huge. The four-layer structure can solve this problem well. So my harvest is that you must do a good job of design before writing code, and design is the focus. " A good design can get twice the result with half the effort. 2. Where the regular expression involves verification in the system, I basically used a loop method at first, and the code was for…, if…. Otherwise … through communication, I found a new method, which is regular expression. It is understood that regular expressions are specially used for verification, and the use of regular expressions can greatly reduce the amount of code, which is concise and clear. The only difficulty, and the key to writing regular expressions, is the writing of patterns. If you write well, everything will be fine, but usually it is difficult. I think there are a lot of things you don't understand, and it's not easy to understand them all, so sometimes you can borrow other people's ready-made achievements and use them better when you are dead. For example, date verification can not be understood in three or two days, and can be copied online, but try to master more knowledge points in the training stage. I wanted to summarize the common functions of regular expressions, but I didn't need to think about them later, because they are available on the API. What you summarized is not all about API. Regular expressions are in the java.util.regex package. 4. Importance of Debugging Debugging function is very useful and important. With the increase of code, once a bug appears, it is far from enough to worry about it with your eyes, and the efficiency is not high. Debugging is an effective tool to solve errors. You should learn to use it often and get used to it from the beginning of training.