Functions rules 函数原则
Small.
Do one thing.
Use descriptive names.
Prefer fewer arguments.
Have no side effects.
Don't use flag arguments. Split method into several independent methods that can be called from the client without the flag.
小。
只做一件事情。
使用描述性名字。
参数要少,不超过3个。
无副作用。
不要用标识性参数,应该分成几个函数,不用该标识也可以单独调用。
Last updated
Was this helpful?