Bad taste of code 04: long parameter list)

Source: Internet
Author: User

If one request is sent to an existing object to replace one parameter, replace parameter with methods (replace the parameter with a function) is used ). Here, the "existing object" may be a field in the class to which the function belongs, or it may be another parameter. You can also use the preserve whole object to collect a bunch of data from the same object and replace them with this object. If some data lacks a reasonable object ownership, you can use introduce parameter object to create a parameter object for them.

Important exception: If you obviously do not want to create a dependency between the "called object" and "Large Object. At this time, it is reasonable to split the data from the object as a separate parameter. However, pay attention to the cost. If the parameter columns are too long or change too frequently, you need to reconsider your dependency structure.

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.