Book Description
Like it or not, JavaScript is not going away. No matter what framework or ”compiles-to-js” language or library you use, bugs and performance concerns will always be an issue if the underlying quality of your JavaScript is poor. Rewrites, including porting to the framework of the month are terribly expensive and unpredictable. The bugs won’t magically go away, and can happily reproduce themselves in a new context. To complicate things further, features will get dropped, at least temporarily.
The other popular method of fixing your JS is playing “JavaScript Jenga,” where each developer slowly and carefully takes their best guess at how the out-of-control system can be altered to allow for new features, hoping that this doesn’t bring the whole stack of blocks down. This book provides clear guidance on how best to avoid these pathological approaches to writing JavaScript:
Recognize you have a problem with your JavaScript quality.
Forgive the code you have now, and the developers who made it.
Learn repeatable, memorable, and time-saving refactoring techniques.
Apply these techniques as you work, fixing things along the way.
Internalize these techniques, and avoid writing as much problematic code to begin with.
Bad code doesn’t have to stay that way. And making it better doesn’t have to be intimidating or unreasonably expensive.
Table of Contents
Chapter 1. What is Refactoring?
Chapter 2. Which JavaScript Are You Using?
Chapter 3. Testing
Chapter 4. Testing in action
Chapter 5. Basic Refactoring Goals
Chapter 6. Refactoring Simple Structures
Chapter 7. Refactoring Functions and Objects
Chapter 8. Refactoring Within a Hierarchy
Chapter 9. Refactoring to OOP Patterns
Chapter 10. Asynchronous Refactoring
Chapter 11. Functional Refactoring
Chapter 12. Conclusion
中文:
书名:重构JavaScript:把坏代码变成好代码
不管你喜不喜欢,JavaScript都不会消失。无论您使用哪种框架或“编译为js”的语言或库,如果您的JavaScript的底层质量很差,错误和性能问题将始终是一个问题。重写,包括移植到这个月的框架,都是非常昂贵和不可预测的。这些虫子不会魔术般地消失,它们可以在新的环境中愉快地自我复制。让事情进一步复杂化的是,功能将被放弃,至少是暂时的。
修复JS的另一种流行方法是玩“JavaScript Jenga”,每个开发人员缓慢而谨慎地猜测如何更改失控的系统以支持新功能,希望这不会导致整个代码栈崩溃。本书就如何最好地避免使用这些病态的方法编写JavaScript提供了明确的指导:
认识到您的JavaScript质量有问题。
原谅你现在拥有的代码,以及开发它的开发人员。
学习可重复、令人难忘和节省时间的重构技术。
Apply these techniques as you work, fixing things along the way.
将这些技术内部化,并从一开始就避免编写太多有问题的代码。
糟糕的代码不一定要一直保持这种状态。而且,让它变得更好并不一定会让人望而生畏,也不会花费不合理的代价。
目录表
Chapter 1. What is Refactoring?
第2章.您使用的是哪种Java脚本?
第三章.测试
Chapter 4. Testing in action
Chapter 5. Basic Refactoring Goals
Chapter 6. Refactoring Simple Structures
第7章重构函数和对象
第8章.层次结构中的重构
Chapter 9. Refactoring to OOP Patterns
Chapter 10. Asynchronous Refactoring
Chapter 11. Functional Refactoring
Chapter 12. Conclusion
评论前必须登录!
注册