| This paper introduces how to detect kinds of suspicious code models and bad programming practices which are collected by the author. This paper also proposes a method to detect duplicated code.Suspicious code makes code reviewer feel suspicious, and when running, suspicious code always outputs unexpected data. Suspicious code also breaks the rules which keep programmers far away from bugs. Our static analyzing tool Defect Detecting System (DTS) reads in the source code and constructs abstract syntax trees (AST), control flow graphs (CFG) and context information to detect defects. The author does some research on suspicious code and designs some detecting methods and implements those methods under the testing framework of DTS. Duplicated code makes people delusive and could be eliminated by refracting. The author proposes a method based on abstract syntax tree to parameterize match similar code, and make use of context information to reasonably decide the searching distance. The method is proved to be efficient on detecting inconsecutive duplicated code. |