C. Programming growth notes (three copies vs. reuse)

Source: Internet
Author: User

(Part 1)
"I understand. He said to implement it in any object-oriented language, that means to implement it in an object-oriented programming method, right? OK, I learned this, but I didn't expect it at the time ."
Laruence: "All Programming beginners will have this problem, that is, they will intuitively use the logic that computers can understand to describe and express the problem to be solved and the specific process of solving it. This is actually a computer-based approach. For example, the calculator program requires two numbers and operator numbers first, and then determines how to calculate the number based on the operator number, this is not wrong, but this thinking makes our program only to meet the current needs, the program is not easy to maintain, not easy to expand, not easy to reuse. This does not meet the requirements of high-quality code ."
Side dish: "I am confused, laruence. How can I make it easy to maintain, expand, and reuse? Can I be specific ?"
Laruence: "For example, if I want you to write another windows Calculator, can your current code be reused ?"

"That's not easy. Just copy the code? ."
Laruence: "It seems that it is still a small dish. Some people say that the job of junior programmers is Ctrl + C and Ctrl + V. This is actually a very bad coding habit, it may be a disaster to maintain your repeated code to a certain extent. The larger the system, the more serious the problem is. The principle of programming is to avoid repetition in the best way possible. Think about it. Which of the code you wrote has nothing to do with the console, but is only related to the calculator ?" (To be continued)

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.