Experiences and experiences in Webb. Wave project development

Source: Internet
Author: User
This project has been developed for nearly eight months. During this period, I have a deep understanding of C. I am also deeply impressed with Asp.net. For this project, remember some personal experiences.

The development environment of the project, vs. net2003, Asp.net 1.1, and SQL Server 200.

1. Solution management.
Generally, a large solution is divided into several small projects. Of course, I am not very clear at the beginning. Therefore, a Webb. Wave project serves as the core UI. Later, a logic layer of Webb. Wave. countrol was added. Of course, this project was added earlier, so it has a lot of content. Later, several projects were added. There are currently five projects in total.
Webb. Wave core UI
Core Webb. Wave. Controls Logic
The Webb. Wave. Controls. Upload Component is available on my blog. Source code
Webb. Wave. Resource Project
The Webb. Wave. wavesystem System Service project is mainly used for system global functions and global functions.
Webb. Wave. WebService web service project.
At first, only the first two projects are involved, and databases are not involved here. That is, a simple three-tier architecture. However, after the development, it became increasingly apparent that such an architecture was unreasonable.
First, there is a conflict between user authentication and resources at the UI Layer. For security, all pages in the UI Layer must be authenticated. Therefore, if you do not log on, you cannot access any page (except the login. ASPX page ). At the beginning, there was no problem with this architecture, because it did not take into account other accesses to the website without authentication. However, the next simple problem is when the system administrator can recover the system. That is, when a system problem occurs, logon does not work, or the system needs to re-reset, it is required to access the system without logon. The solution is also done on the login. ASPX page. Later, other functions were added. For example, the verification code generation had to be added to login. aspx. You can also retrieve passwords. The result makes a login. aspx very large.
This is obviously wrong. For convenience, it must be divided into several small modules, so that authentication is required in part, and authentication is not required in part, so a WebService project is added, this project does not require authentication, but because it is integrated into the wave project, you can request a page for authentication at any time, which is much more flexible.
For example, a file list request (XML file) can be requested without logon. Therefore, authentication is not required for this page in WebService.
The data request of another Treeview node (XML data island) must also be put in the WebService when logging on to add special authentication. In this way, when calling it on the UI Layer, it must be authenticated. Convenient and practical.
The second is system initialization. Because the system still has some services, such as sending emails and clearing resources, you must set a global thread to complete such work. However, the problem is that if you place it on the UI Layer (Webb. wave) in the global class, it can solve the problem very well, however, the trouble is: every small change, a little compilation, will make IIS reload the entire Webb. wave. DLL file, so that each debugging becomes very slow (on the one hand, file loading, on the other hand, the thread stops and re-runs ). So I divided it into a project. In this way, if wavesystem is not compiled, IIS will not reload it and will not stop the system service. Of course, your other debugging will be very fast. There is also a resource file to re-create a project, which is also convenient.
Therefore, it is possible to reasonably divide a project into several small projects for management, so that they can be as independent as possible. Therefore, when breaking down a project, we should consider that the references between projects should be reasonable. Do not break down the project into a referencing B, and B should reference A again, so the decomposition is unreasonable.

2. Use of third-party components.
Here is the use of Ms webcontrol. For these controls (Treeview, toolbar, multipage, and tabstrip), Treeview is the most used in projects. However, a problem is that its data structure, if a view exists, this is almost a catastrophic consequence! When there are hundreds of data nodes, the viewstatus on the pageCodeN is more than, and several Mb is possible. Later, I gave up its data structure and changed it to JS + WebService binding. Finally, we found that the client script is very important if you want to make good use of these controls! You can find DHTML on msdn to solve some problems. Do not use them directly on the server side. This will increase the burden on both the server and the customer.

3. Make full use of the database functions
at the beginning, I was not familiar with sql2k, and I gave up many database functions to be compatible with the access database, for example, stored procedure. A large number of SQL statements are on the logic layer. At that time, I thought that the management logic layer would be able to manage the database well. This is transparent to the database. In addition, the database configuration is also very simple, except for data tables, nothing else. However, in this way, the computing workload on the logic layer is multiplied quickly. For example, tree data generation, deletion, and parent-child table relationships! If it is implemented in the database, it is very simple. However, if you put it on the logic layer, it is just a bit more computing, such as deleting data in the subtable! It seems that the logic layer can also be easily completed, but the consequence is that, on the one hand, you have to write dozens of lines of code, which is a trivial matter, back-and-forth access to the database adds the burden on the server. In addition, this increases the chance of errors. Another example is to create a log when deleting a record! If you do this on the logic layer, it seems reasonable and convenient. However, in actual development, you will find that it is at least 10 times more troublesome than Directly Writing logs in the database. Therefore, make full use of the database function! It is possible to rationalize the data on the data layer, which makes the logic layer much more convenient, and also makes the UI Layer simpler. Especially for parent and child tables! You can also hand it over to the database! Although. Net has repeatedly recommended that dataset be used to complete the parent-child table relationship, the owner should do what he or she needs to do.

4. Make full use of user controls on the UI Layer!
Such a good function. However, note: If you create a control and call it on the page just like designing the UI, it makes no sense. What I want to talk about is to make full use of controls! First, you must understand that it is a class. Therefore, all attributes of the class can be used! For example, you can inherit your own UI controls and inherit from the original controls. Most importantly, you can define many events on your own. For example, two controls A and B may be displayed on a page. Now, a button on B is required. After clicking it, B is hidden and A is displayed. It looks simple, but it is still a bit difficult to do. Because you need to call some page methods in child control B. Therefore, it is most reasonable to add an event to control B. In this way, you can process the relationships between various controls as you like. For example, you can create an independent control for a class so that it can update the database and display data. You only need to give it a common method, loaddata (), pass an ID, and it will add its own data, and then add an updatedata (), add an onreturn to call the function on the page to hide or delete it from the page. Using this structure can solve many difficult problems.
Note: make full use of the Nature of controls and the power of. net!

5. Backup and log management
It looks simple. However, when three servers appear and are not updated at the same time, you will be in trouble. Especially database changes! It is absolutely correct to manage logs! Update logs so that you can quickly update other servers. The importance of backup is not required. Please make some permanent backups, especially when some projects are making major changes, such as project breakdown or beta release.

6. Test
The general function test will not be done, because if the side functions are not completed, the project cannot be completed. Finally, we have to perform a formal test. Of course, testers are the best. It is also necessary to use tools to perform some tests. Of course, my project stress testing is unqualified, which means some core modules need to be re-developed. In the unit test of development, I feel pretty good. Never share the same idea with me. This is extremely dangerous! Perform professional tests.

Some personal experience.

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.