8 bad habits to overcome in web development

Source: Internet
Author: User

In the field of website development, many problems are caused by some bad programming habits, eliminate these bad habits, make your development easier and more efficient. 1. Do not be surprised by the spelling mistakes in the code, which is a very common problem, and what makes you mad is that it has nothing to do with your programming ability. Nonetheless, a misspelled variable name or function name can have disastrous consequences, and they are not easily detectable. So how to solve it? You should use a good integrated development environment (IDE) or a programming-specific code editor that can greatly help you reduce spelling errors. Another way to do this is to deliberately choose names that are easily spelled as variables and function names, which makes it easy to find errors. Avoid words that are easy to misspell, like receive is easy to write wrong into recieve, and they are hard to find. 2. The code does not indent or format the code in an indented or uniform format, making it easier to read and to locate errors. In addition, because it is a coherent format, it is also easier for others to maintain your code. If the IDE you're using doesn't automatically format the code, consider using a code-uncrustify like the one that formats your code based on your settings. 3. The code is not modularized so that each function is implemented and only one function is implemented, which makes the function shorter, and the corresponding understanding and maintenance is good. Long functions often have many paths, which can be difficult for testing. A good rule of thumb is that the length of a function should not exceed your screen. Also, if there are more than 10 if statements or loop statements in a function, it is too complex to be rewritten. 4. You mistakenly think your IDE is safe. Ides and other tools can improve the efficiency of writing code, and they can suggest (complete) your variable name or other content based on your existing input and scope. However, this kind of tool is not safe enough, you will choose it because some options seem to want the one you need, in fact you are not he is that you want. In fact, it just reduces your thinking, but you still need to be sure. 5. Premature optimization Code The legendary programmer Donaldknuth once said: "Programmers spend a lot of time thinking about the non-critical parts of the code, and such optimizations have a negative effect on subsequent debugging and maintenance." "It's hard to make it run a little faster, but it makes your code harder to debug and maintain. A really good strategy is to write your code clearly, and then do it if a part of the program really needs to be optimized to improve performance. 6. What do you plan to do without planning your project in advance? What size do you expect it to be? How many users will use it? How fast can it run? The answers to these questions are not readily available and deterministic, but if you make a wrong estimate of them, how do you choose a suitable development framework to meet the needs? 7. IncreasePeople are speeding up. Almost all software development projects lag behind the plan, and the manpower to increase the project is theoretically possible and very good. But this is a common misconception, in fact, that it usually lowers overall efficiency. 8. Use the wrong time to expect the same, do not exist illusions, you can catch up with the progress of the backward. If you are already behind schedule, this is because your estimated time is wrong, then you should reassess the whole project cycle instead of blindly sticking to the wrong time plan. Free Brother even php original video tutorial CD-ROM, more information on the website customer service: http://www.lampbrother.net
  • 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.