zoukankan      html  css  js  c++  java
  • 总结应该遵循的编码、调试规则

    I spend more than a week to debug a problem about program crash,feeling funstrated all the week until the day I finally solove the problem.

    In order not to commit such kind of mistake, I write this article to summary the note point when I write code in the future and should obey the rule as much as possible.

    • We should sort the whole thing with a clear flow chart before we write code. And we should check the flow chart before we examine our code, in order to check if we have some unexpected conditions
    • check if we have a memory leak. Memory leak can cause some odd phenomenon
    • Don't work complicate code
    • especially when writing complicate code, we should pay attention to the return value of one function, also the reference manual.
    • According to above ,we should always return proper value, and always validate the parameters, return the error code if not illegal , unless we really no need to.
    • Use single thread instead of multi-thread as much as possible , cuz debugging multi-thread is very difficult. Passing parameters instead of global parameters.
    • Keep a clear mind when we write and debug, instead of digging into the problem when feeling dizzy
  • 相关阅读:
    Java多线程:ThreadLocal
    selenium安装环境
    http常用标签
    http与https区别,get与post请求区别
    测试评审清单
    python面向对象之方法
    python正则之模式re.I re.M
    python 正则之字母匹配
    python正则之特殊表达式 .*?{}
    python正则之match search findall
  • 原文地址:https://www.cnblogs.com/no7dw/p/2856123.html
Copyright © 2011-2022 走看看