TL;DR:明确哪些会发生突变,哪些不会发生突变。
com/how-to-find-the-stinky-parts-of-your-code-part-xxxii。
com/how-to-find-the-stinky-parts-of-your-code-part-xxvi。
com/how-to-find-the-stinky-parts-of-your-code-part-xxiv。
永远不会改变其值的变量并不是真正的变量。
将它们转换为常量会缩小开发人员必须跟踪的状态空间。
来源:HackerNoon






