Clean Code in JavaScript
暫譯: JavaScript 中的整潔代碼

James Padolsey

買這商品的人也買了...

相關主題

商品描述

Building robust apps starts with creating clean code. In this book, you’ll explore techniques for doing this by learning everything from the basics of JavaScript through to the practices of clean code. You’ll write functional, intuitive, and maintainable code while also understanding how your code affects the end user and the wider community.

The book starts with popular clean-coding principles such as SOLID, and the Law of Demeter (LoD), along with highlighting the enemies of writing clean code such as cargo culting and over-management. You’ll then delve into JavaScript, understanding the more complex aspects of the language. Next, you’ll create meaningful abstractions using design patterns, such as the Class Pattern and the Revealing Module Pattern. You’ll explore real-world challenges such as DOM reconciliation, state management, dependency management, and security, both within browser and server environments. Later, you’ll cover tooling and testing methodologies and the importance of documenting code. Finally, the book will focus on advocacy and good communication for improving code cleanliness within teams or workplaces, along with covering a case study for clean coding.

By the end of this book, you’ll be well-versed with JavaScript and have learned how to create clean abstractions, test them, and communicate about them via documentation.

  • Understand the true purpose of code and the problems it solves for your end-users and colleagues
  • Discover the tenets and enemies of clean code considering the effects of cultural and syntactic conventions
  • Use modern JavaScript syntax and design patterns to craft intuitive abstractions
  • Maintain code quality within your team via wise adoption of tooling and advocating best practices
  • Learn the modern ecosystem of JavaScript and its challenges like DOM reconciliation and state management
  • Express the behavior of your code both within tests and via various forms of documentation
  • Write maintainable JS code using internal abstraction, well-written tests, and well-documented code
  • Understand the agents of clean coding like SOLID principles, OOP, and functional programming
  • Explore solutions to tackle common JavaScript challenges in building UIs, managing APIs, and writing states

商品描述(中文翻譯)

建立穩健的應用程式始於撰寫乾淨的程式碼。在這本書中,您將透過學習從 JavaScript 的基礎知識到乾淨程式碼的實踐,探索實現這一目標的技術。您將撰寫功能性、直觀且可維護的程式碼,同時了解您的程式碼如何影響最終使用者和更廣泛的社群。

本書首先介紹流行的乾淨程式碼原則,例如 SOLID 和迪米特法則(Law of Demeter, LoD),並強調撰寫乾淨程式碼的敵人,如貨物崇拜(cargo culting)和過度管理。接著,您將深入了解 JavaScript,理解這門語言的更複雜方面。然後,您將使用設計模式創建有意義的抽象,例如類別模式(Class Pattern)和揭示模組模式(Revealing Module Pattern)。您將探索現實世界中的挑戰,如 DOM 協調、狀態管理、依賴管理和安全性,無論是在瀏覽器還是伺服器環境中。稍後,您將涵蓋工具和測試方法論,以及記錄程式碼的重要性。最後,本書將專注於倡導和良好的溝通,以改善團隊或工作場所中的程式碼整潔性,並涵蓋一個關於乾淨程式碼的案例研究。

在本書結束時,您將熟悉 JavaScript,並學會如何創建乾淨的抽象、測試它們,並通過文檔進行溝通。

- 了解程式碼的真正目的及其為最終使用者和同事解決的問題
- 探索乾淨程式碼的原則和敵人,考慮文化和語法慣例的影響
- 使用現代 JavaScript 語法和設計模式來創建直觀的抽象
- 通過明智地採用工具和倡導最佳實踐來維護團隊內的程式碼質量
- 學習 JavaScript 的現代生態系統及其挑戰,如 DOM 協調和狀態管理
- 在測試中和通過各種形式的文檔表達程式碼的行為
- 使用內部抽象、良好編寫的測試和良好記錄的程式碼來撰寫可維護的 JS 程式碼
- 了解乾淨程式碼的代理,如 SOLID 原則、物件導向程式設計(OOP)和函數式程式設計
- 探索解決在構建 UI、管理 API 和撰寫狀態時常見的 JavaScript 挑戰的解決方案

作者簡介

James Padolsey is a passionate JavaScript and UI engineer with over 12 years' experience. James began his journey into JavaScript as a teenager, teaching himself how to build websites for school and small freelance projects. In the early years, he was a prolific blogger, sharing his unique solutions to common problems in the domains of jQuery, JavaScript, and the DOM. He later contributed to the jQuery library itself and authored a chapter within the jQuery Cookbook published by O'Reilly Media. Over subsequent years, James has been exposed to many unique software projects in his employment at Stripe, Twitter, and Facebook, informing his philosophy on what clean coding truly means in the ever-changing ecosystem of JavaScript.

作者簡介(中文翻譯)

詹姆斯·帕多爾西是一位熱情的 JavaScript 和 UI 工程師,擁有超過 12 年的經驗。詹姆斯在青少年時期開始他的 JavaScript 之旅,自學如何為學校和小型自由職業項目建立網站。在早期,他是一位多產的部落客,分享他在 jQuery、JavaScript 和 DOM 領域中對常見問題的獨特解決方案。後來,他對 jQuery 庫本身做出了貢獻,並在 O'Reilly Media 出版的《jQuery Cookbook》中撰寫了一章。在隨後的幾年中,詹姆斯在 Stripe、Twitter 和 Facebook 的工作中接觸了許多獨特的軟體項目,這些經歷塑造了他對於在不斷變化的 JavaScript 生態系統中,乾淨編碼真正意義的哲學。

目錄大綱

  1. Setting the Scene
  2. The Tenets of Clean Code
  3. The Enemies of Clean Code
  4. SOLID and Other Principles
  5. Naming Things is Hard
  6. Primitive and Built-In Types
  7. Dynamic Typing
  8. Operators
  9. Parts of Syntax and Scope
  10. Control Flow
  11. Design Patterns
  12. Real-World Challenges
  13. The Landscape of Testing
  14. Writing Clean Tests
  15. Tools for Cleaner Code
  16. Documenting Your Code
  17. Other Peoples' Code
  18. Communication & Advocacy
  19. Case Study

目錄大綱(中文翻譯)


  1. Setting the Scene

  2. The Tenets of Clean Code

  3. The Enemies of Clean Code

  4. SOLID and Other Principles

  5. Naming Things is Hard

  6. Primitive and Built-In Types

  7. Dynamic Typing

  8. Operators

  9. Parts of Syntax and Scope

  10. Control Flow

  11. Design Patterns

  12. Real-World Challenges

  13. The Landscape of Testing

  14. Writing Clean Tests

  15. Tools for Cleaner Code

  16. Documenting Your Code

  17. Other Peoples' Code

  18. Communication & Advocacy

  19. Case Study