About the project refactoring, the programmer who knows the truth tears laughed

Source: Internet
Author: User

This article authorizes reprint, non-famous programmer (Public number: smart_android)

In fact, after the end of the year, our project has been emphasizing refactoring, in the practice of refactoring, but so far, basically no progress. On the reconstruction of the project, I said: "Basically most of them are deceptive." Do you believe it or not? Then you might ask: Why not write the code better and be more logical in the first place? So welcome to see me write this article "Poor code quality, many bugs?" We are all forced to read you will feel the same.

On the question of project refactoring, why not finish it? It was not until I browsed the microblog that I saw a very interesting conversation: empathy and empathy. Know the truth of me, tears are quick to laugh out, estimated to see the following dialogue, you will feel the same, the scene is possible. The dialogue is as follows:

A: Refactoring 80% will fail, because the demand for business lines will never stop, resources are limited, so do not spend a large price, easy not to refactor, rather than develop slowly, write well. B: In fact, the industry is a large part of the product manager level 99% of the project will not survive the reconstruction of the day, so the volume of business to re-construct more provincial resources. Dialogue from @easy's Weibo

See the first sentence a said, a look is deeply affected by the programmer said, is not speaking of your heart. The students in the Recruit please raise your hands, as we have the responsibility of programmers can only shouts: the intention to write code, powerless and efficient. The bug is many, the pain is painful! The next time your boss and Product Manager urge you to make progress, you shout: Time is not enough, code blind, ruined software, finished the project. After the online, if the user experience is not good, the boss came to you to talk or train you, you said: This pot we programmers do not back. B said, the vision is very long-term, so to speak, it is indeed more resource-saving. If the product manager and the boss see it, he is not expected to open Sen.

in fact, Project refactoring is a great exercise in the ability of programmers, and refactoring is a process of continuous optimization and learning . The importance of project refactoring, not to mention, by adjusting the program code to improve the quality of software, performance, so that its program design patterns and architecture more reasonable, improve software extensibility and maintainability. You may ask: Why not start the project well and write better code quality? Although it may be time problems caused by poor code quality, the programmer in order to catch the deadline, but even to the programmer enough time, he can not foresee the future needs of the changes, scalability and maintainability can not talk about, today you think good code these, tomorrow estimated demand will change again. So a good long-lasting project can not avoid the occurrence of refactoring, writing code of the master and the Great God also have to go through this stage.

When will it trigger the refactoring? The answer is simple, you can't tolerate confusing code or feel poor readability. Your endurance determines the timing of the refactoring. Of course, if you're writing a program that's been crashing, you're probably forced to refactor and optimize it. In fact, the starting condition of code refactoring should be a few points:

    • Modification of reaching

    • There is too much duplicate code in the code

    • Coupling of transitions

    • Too long methods and classes (too long code, logic complex, bug may increase probability)

    • Too many code without comments, you can not understand

If you have a few of these, you should think about refactoring the code. Do not be passive to refactor, the initiative to refactor or is very necessary, can avoid many problems occur.

Code refactoring is in fact the most important, the most should pay attention to two points, but also should achieve the purpose is: The code is concise, strict logic and performance optimization . This is the meaning and connotation of the reconstruction.

Writing here, you may ask me: How to reconstruct it? Yes, I've written so much, and you're sure you want to know the answer to that question, how do you refactor it? Then I'll tell you the answer seriously: if the boss and the product manager do not treat the programmer well, you will not be able to reconstruct the project day. A and B say the truth, do you obey?

If not, I am afraid that you hit me, I will say two more seriously, how to refactor: without changing the external behavior of the software system under the premise of improving its internal structure can be. Tools can also be done, and refactoring tools can modify the code and modify all references to that code at the same time .

Please forward this article to the circle of friends, let your boss and product manager to see it, let them understand the seriousness of the problem, give themselves more development time. Next time if the product manager urges you to progress, you must remember to shout together: Time is not enough, code blind, ruined software, finished the project.

About the project refactoring, the programmer who knows the truth tears laughed

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.