Notes for writing programs

Source: Internet
Author: User

Note the following when writing a program:

1. Check whether the text editing box contains invalid characters. For the numeric type, you must determine whether it contains non-numeric values. For the character type, you must determine whether it is within the allowed characters.

2. for a period, you must determine whether the previous date is greater than the next one. We also need to judge the date of January. (The birth date in www.chinaren.com is not determined ). Do not slander me :)

3. For path selection, you must determine whether the path is valid and accessible. Whether the entered path length exceeds the maximum character length.

4. For the value to be written into the database, you must determine whether it exceeds the length defined by the field.

5. When writing data to a folder on the network, you must determine whether data can be written.

6. For the default data in the interface, the default value must be displayed, even if it is 0, because the software is not used by one person, others may not know.

7. When performing batch deletion, it is best to provide a Cancel button to give others a chance to regret it.

8. During a long period of operation, make sure to turn the mouse into a funnel model to let others know that your program is still running. It is best to use a progress bar to display the progress. Give the user the confidence to continue.

9. For menu items in the menu bar, it is best to make a shortcut on the toolbar. Users are too lazy to sit there without moving the keyboard or mouse, and your program can work.

10. The folders and files in the operating system are case-insensitive, but the code written in the program is case-sensitive. Especially when determining whether a file exists.

11. In an interface, buttons in the function set should be put together as much as possible.

12. Pay attention to concurrent access when calling DLL in multiple threads.

13. When writing data to the hard disk or database, it is best to write data to the buffer zone first and then write data at one time, which can speed up the process.

14. When naming a parameter, try to make it meaningful. Do not enter a, B or something everywhere .. Do not write too long for a function. Write more comments. When you leave, do something good for the people who come later.

 

 

I hope you can write down what you think you should pay attention to for your reference.

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.