java - 如何很好的对代码进行重构?
PHP中文网
PHP中文网 2017-04-18 09:42:24
0
4
539

在写代码实现业务场景的过程中,要不断对代码进行重构,有什么原则啊?还有,在核心代码处要加日志,一般要怎么组织关键字,对于有性能损耗的地方,需要不需要刚开始就日志记录执行时间呢?日志打太多会影响程序的性能的,所以日志也应该不要太多为好的吧。

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(4)
迷茫

Looking at some design patterns will help

Ty80

There is a good book about refactoring, step by step,

左手右手慢动作

The principle is: Refactoring should be considered only when development efficiency or operating efficiency encounters a bottleneck

迷茫
  1. Please learn the setting mode for reconstruction issues

  2. For log issues, it is generally recommended to log in key places. As for too many logs affecting performance, a very simple way is to set a switch:

if (ENABLE_LOG){
    log(TAG, something);
}

ENABLE_LOG is set to true in the development version and to false in the release version, so that the log can be used without affecting performance in the official version.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template