In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Code Writing Code writing is a concern of every programmer. But there is a big difference in coding ability between individuals over time. This is largely due to personal programming habits. In this ECAP background code writing process, I have a deep experience, the following summary of the experience of writing. 1) Good programming habits. In the early stages of programming must be in accordance with the uniform specification requirements themselves. Ideally, everyone on the project team should write the same piece of code first that looks like it was written by one person. But this requires an ongoing process of accumulation. Therefore, it is necessary to be strict with yourself at ordinary times. 2. After the code is implemented, you should read it yourself. The advantage of reading code yourself is that you can spot obvious syntax errors before compiling. Such as missing parentheses, semicolons and so on in the statement error. 3. Conduct unit testing after successful writing. The goal of unit testing is to get your code to implement the required functionality. Testing different conditions separately. After passing the test, submit it to business personnel for integration testing. 4. Write as many logs as possible during testing. When testing, there are often a lot of unexpected problems. Journaling too much can lead you to the wrong place very quickly. The principle of writing logs is that logs must be written at each branch and condition; variable values must be printed at the values and copies of key variables. 5. Clean up most debugging usage logs after integration test. After the integration test is completed, the program functions without problems. The logs used for debugging do not need to be printed to avoid overloading production disk space. Some critical branch logs are best kept to handle production issues during maintenance. 6. Pay attention to SQL efficiency when writing code. Writing efficient SQL statements should follow the following rules: 1) When joining queries, the smallest table should be placed on the far right, because oracle's parser processes the tables in FROM from right to left. 2) The order of the conditions in the WHERE clause should be such that the condition that filters out the most records is the lowest, because oracle's parser parses the WHERE clause from bottom to top. 3) Try to take out all records at once, do not repeatedly access the database. Multiple visits to the database increase the number of I/O operations and affect efficiency. 4) Minimize the number of table associations when connecting. Do not associate useless tables. 5) In the case of complex SQL statements with many UNION, try to filter out as many records as possible in each word query in UNION to get a minimum record set. 6) Do not use calculations above the index. If you use computation on an index, the index is not used. 7) Use>= instead of>; for example num>3, rewrite num>=4; 8) If multiple values above the index column are conditions, UNION should be used instead of OR. Testing is divided into unit testing and integration testing. Unit testing is when developers test their own code for logical errors. Once the unit tests are complete, the next step is integration testing. Integration testing requires the cooperation of business personnel and must check the correctness of the data. Unit testing It is best to communicate and discuss with users before unit testing. Discuss whether your program logic is correct, so you can reduce the workload of integration testing. In the process of unit testing, we should pay attention to testing anti-cases. Generally, developers only test positive cases, so anti-cases often appear to deal with incorrect situations. 2. Integration testing The core of integration testing is business personnel. Program developers work with business testers. Listen to them and discuss with them. Only in this way their own procedures will be more robust and perfect.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.