Home > Backend Development > PHP Tutorial > Always want to refactor the entire project

Always want to refactor the entire project

WBOY
Release: 2016-07-06 13:51:57
Original
954 people have browsed it

I have been in the IT industry for 7 months, and I am a programmer who has just wet my shoes

Under development, need to learn various knowledge

There are html css javascript vuejs various web front-end frameworks regular expressions php and thinkphp frameworks
and databases

There are too many aspects involved and I haven’t learned much in the past six months. I have to use what I need to read, so I will encounter many problems.

When making bs software, I often find some problems. After solving the problem, I will find that the code I wrote before has left bugs that I never thought of before.

At this time, I had an idea to get rid of all the previous bugs. At this time, the problem came. Some problems were not considered carefully at the beginning, so I just wrote the code directly. If you want to correct it, many places will be affected. You may get dizzy, and if you don't pay attention, you will go back to the previous strange circle.

At this time, I wanted to refactor the entire project code, but another problem arose. The development time required by the product manager was not enough (the function he wanted was expected to be developed in one day, but it actually took me 3 days) , when refactoring code time is more valuable than gold. And the product manager will say every day that it is too slow and needs to be accelerated (the product manager is the company CEO and also my teacher).

Every time this happens, I feel very impetuous and can’t write code with peace of mind. I always think about the bugs in the project.

Let me ask some experts who have the same sentiment as me how to solve this problem.

It is to continue development. After the first version of the product is developed, it is better to develop the second version.

It is better to refactor directly. I personally want to refactor directly so that the program is safer.

This question has been closed due to non-technical discussion

Reply content:

I have been in the IT industry for 7 months, and I am a programmer who has just wet my shoes

Under development, need to learn various knowledge

There are html css javascript vuejs various web front-end frameworks regular expressions php and thinkphp frameworks
and databases

There are too many aspects involved and I haven’t learned much in the past six months. I have to use what I need to read, so I will encounter many problems.

When making bs software, I often find some problems. After solving the problem, I will find that the code I wrote before has left bugs that I never thought of before.

At this time, I had an idea to get rid of all the previous bugs. At this time, the problem came. Some problems were not considered carefully at the beginning, so I just wrote the code directly. If you want to correct it, many places will be affected. You may get dizzy, and if you don't pay attention, you will go back to the previous strange circle.

At this time, I wanted to refactor the entire project code, but another problem arose. The development time required by the product manager was not enough (the function he wanted was expected to be developed in one day, but it actually took me 3 days) , when refactoring code time is more valuable than gold. And the product manager will say every day that it is too slow and needs to be accelerated (the product manager is the company CEO and also my teacher).

Every time this happens, I feel very impetuous and can’t write code with peace of mind. I always think about the bugs in the project.

Let me ask some experts who have the same sentiment as me how to solve this problem.

It is to continue development. After the first version of the product is developed, it is better to develop the second version.

It is better to refactor directly. I personally want to refactor directly so that the program is safer.

You choose a mature PHP framework, such as YII2, Laravel, etc., and learn it solidly, so that you can get twice the result with half the effort.
If you are always indecisive, you will only waste your time. Otherwise you will always feel this way:
Always want to refactor the entire project

My personal suggestion is to focus on modularization and divide and conquer when writing code. You might as well consciously try unit testing in the next project. When writing code, try to think about what content may change and what will not change. Is it necessary? Think about encapsulation and whether you should consider the overall framework. I once borrowed a project and completed a mobile UI component library. Although there were many bugs, I did not continue to maintain it. Later, when I wrote the mobile terminal, even if I used other people's frameworks, I felt that it was very smooth because I had to think by myself. After that, you will naturally understand the pain points that framework developers want to solve, and be able to understand some of their ideas, which will be good for the integrity of your code.

Code is never truly perfect. It's just that it's constantly getting closer to perfection. It's good to be able to see the shortcomings of the past, which shows progress.

In fact, it is not just newcomers who encounter this situation. If the project is large enough and the cycle is long enough, as the business volume and complexity of the business increase, it is understandable that the previous model is not suitable.
Unless you can foresee these at the beginning and choose the appropriate model or framework.

However, now that you have encountered this situation, what should you do if you don’t change it and feel uncomfortable? At this time, it is necessary to "gradually renovate" and modify and reconstruct some related codes while making new functions. , after one version iteration is completed, the refactoring you want will be completed.

The above is for reference only.

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template