From the perspective of technical debt, talk about reconstruction

First, what is meant by reconstruction (Refactoring)? 

It is Definitions: The software for adjusting the internal structure aimed at changing the software without observable behavior improve reliability reduce cost modifications thereof .

So reconstruction in our eyes it should look like this

 

On technical debt (Technical Debt): 

Development team in the design or architecture selection, from the perspective of short-term effects of a selected program easy to implement. But in the long term, this program will bring more negative impact on the debt that is owed by the development team.

Simply put, it is to solve the problem quickly, and take non-standard solutions, thus worse retribution, ha ha.

Technical debt may cause we can not expect to deliver projects

for example

For the mortgage, I am sure you all remember a month still to go.

However, for technical debt, so we do not seem to care.

For example, a white student in a class owed in the technical debt, for example, wrote a 15-line 300 large method parameters are not the responsibility of a few weeks after he extend this class, modify, boss reminder of the urgency, the wrongs, final: a 20 parameters, super perverted method 600 lines produced.

However, this thing is not necessarily who borrow who might be one thing, it could be a team thing,

Let us assume it: this white students left the company .....

So, the debt on the pressure in the body of work of a successor, the ancient language: Father son subordinated debt, then this should be called: TM so and so love it .........

Before long, the entire development team will find that we have been unable to repay this debt technical matter, it can only be reconstructed, and the reconstruction is part of the most difficult, the most costly way to a reconstruction, planned reconstruction (Planed refactoring) , which is the reconstruction plan will have to be added to the product backlog inside.

The cost of reconstruction increases as the project progresses

 

刚才讲了什么是计划性重构(Planed Refactoring), 我们接着来说下一种: 理解性重构(Comprehension Refactoring)

直接上图

直观的变量名就是最好的注释

 

这段代码的注释是多余的, 导致了我们理解不够直观, 所以我们应该删掉注释, 用变量名来直接和变量意义关联, 简单直接 !

 

上面的都了解了吧

接着来!

 

预先重构(preparatory refactoring)

与重构花费的时间相比, 技术债务才是时间的真凶! 

大家还记得这张图吧, 最后走曲线的小球先到达了重点, 所以当我们着手新的feature时, 我们不妨进下心来, 审视下代码, 是否在coding之前, 先优化一下, 重构一下现有的代码, 然后再心情舒畅的, 高效率的实现新功能呢?

增加feature之前多想想

 

最后一个

计划性重构(Planed Refactoring) 它爸爸 

长期重构(Long Term Refactoring)

技术债务已经积累到极其严重, 重构需要分配一个开发团队, 占用整个一次或多次敏捷迭代才能完成, 这种情况和计划性重构(Planed Refactoring) 都要尽量避免

长期重构(Long Term Refactoring)不多说 你懂得!

 

码字不易, 谢谢大家!

发布了125 篇原创文章 · 获赞 236 · 访问量 2万+

Guess you like

Origin blog.csdn.net/qq_33709508/article/details/102648205