117

重构与模式系列(一)简化函数

 6 years ago
source link: https://juejin.im/post/59dd722ef265da432b49c9fb
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
函数多长合适? Functions should do one thing每一个函数应该都只做一件事情,如果一个函数做了过多的事情,那么它极为不稳定,这种耦合性得到的是低内聚和脆弱的设计,且不方便维护与阅读。在人的常规思维中,总是习惯把一组相关的行为放到一起

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK