Comments (1)
类名要简单,易懂。子类名有两重职责,不仅要描述这些类像什么,还要说明它们之间的区别是什么。类名,为了让代码可以更好的和人沟通,而不是计算机沟通。
继承虽然可以减少代码量,会比原封不动地把超类的内容复制粘贴到所有子类精简得多。和所有减少代码量的技巧一样,它会让代码变得更难读懂;*因为必须理解超类的上下文,然后才能有可能理解子类。*
每一次的增加间接层,都会增加理解的成本。因为需要了解这层抽象,才能知道如何完成下一个具象。
减少类的数量是对系统的改进,只要剩下的类不因此而变得臃肿就好。
from refactoring-kata.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from refactoring-kata.