Bad taste in the code

Source: Internet
Author: User

Write the code for half a year, the object-oriented or only a preliminary understanding, still can not reach the point of proficiency, but from six months of coding, vaguely feel the code structure of the bad taste of the code.

  1. The first is to repeat the code, a program of repeated code too much, resulting in maintenance once the changes will need to all the duplicated code to modify it again. In particular, some logic complex code or too many parameters of the code, it is easy to have a place where the modification is incorrect or not modified to such problems.
  2. Property placement is not correct, such as updateui as the controller of the UI, which directly defines a window's panel in the UI as a UpdateUI property, although it is convenient to operate the panel in UpdateUI, But UpdateUI as the control of the entire UI, and not necessarily only for one window, if UpdateUI controls multiple windows, it causes the UpdateUI to be overweight and most of the properties that are not used for the current window.
  3. The role of the class is unclear, such as window is used to build windows, then the logic about the business should not be placed in the UI (window), for example, the method of turning on statistics should belong to the Updateui,window to create various UI and save the child component reference.

It's not over yet, it will continue tomorrow.

Measures

Bad taste in the code

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.