Bad smells in Code

Source: Internet
Author: User

1.Duplicated Code Same expression in two methods to the Same Class:extract method Same expression in two sibling Su Bclass:extract method, then Pull up Field duplicated code into two unrelated Classs:extract method class/the In one class and is invoked by the other class.

2.Long Method A Heuristic We follow be that whenever we feel the Needd to comment something,we write a method instead (Ex Tract method). A Good technology to identify the clumps of code to extract are to look for comments. Conditionals and loops also give signs for extraction.

3.Large Class Extract method

4.Long Parameters List Replace Parameter with method, Preserve Whole object, introduce Parameter object.

5.Divergent Change Extract Class.

6.Shotgun surgery Move method, move Field, Inline Class,.

7.Feature Envy Move method, Extract method,.

8.Data clumps Extract Class, introduce Parameter object, Preserve Whole object

9 Primitive Obseesion

10.Switch Statements Extract method

11.Parallel Inheritance Hierarchis

12.Lazy Class

13.Speculative generality

14.Temporary Field

15.Message chains

16.Middle Mans

17.Inappropriate Intimacy

18.Alternative Classes with different interfaces

19.Incomplete Library Class

20.Data Class

21.Refused bequest push down and push down Field

22.Comments


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.