JavaScript Framework Design (2nd Edition) cover

JavaScript Framework Design (2nd Edition)

Rating 3.5
Word count
715K words
Chapters
18
ISBN
9787115464293

Tags

Summary

This is the second edition of JavaScript Framework Design, written by front-end developer Zhong Qincheng (online name Situ Zhengmei), which systematically dissects the internal structure of mainstream JavaScript frameworks along the thread of "what modules are needed to build a framework from scratch." The book has 16 chapters: it first covers the seed module (modularity, object extension, array conversion, type detection, domReady, no-conflict handling) and the language module (extensions and fixes for strings, arrays, numbers, functions, and dates), then moves on to browser sniffing and feature detection, the class factory, the selector engine, the node module, the data cache module, the style module, and the attribute module, followed by separate discussions of the event systems for PC and mobile, the asynchronous model (including the evolution of async solutions such as Promise), the data interaction module, and the animation engine. The latter half turns to the two major themes of modern frameworks: MVVM and componentization, explaining front-end static templates, MVVM dynamic templates, the performance wall and the complexity wall, and comparing the component approaches of the jQuery era, avalon2, and React. The second edition rewrites the language module content in response to the language changes brought by ES6/ES7, and adds new practices in mobile events, asynchronous programming, and componentization; its depth clearly exceeds ordinary "API usage" books, focusing on explaining design trade-offs and implementation principles.

Editor's review

市面上讲 jQuery、React 用法的书很多,愿意把“框架为什么这样写”剖开讲的书很少,这本算是其中之一。作者司徒正美是开源框架 avalon 的作者,长期在做框架本身,因此书里讨论的不是 API 怎么调,而是模块怎么切、兼容怎么写、性能墙在哪。全书按“一个框架的骨架”排序:种子模块、语言模块、特征侦测是地基,选择器引擎、节点、缓存、样式、属性是砖瓦,事件系统、异步模型、数据交互、动画是血管,最后落到 MVVM 与组件化这两块现代前端的主战场。第2版在 ES6 普及后重写了语言部分,并引入了移动端事件与 React 组件方案的对照,比第1版更贴近当下的工程环境。需要提醒的是:这是一本“实现原理”书,不是入门书,代码密度高、章节跳跃感强,读起来需要动手对照源码。适合已经写过若干项目、想从“会用框架”跨到“看得懂框架”的前端工程师,也适合准备面试深水区问题、或想自己动手造轮子的人。

Who it's for

A good fit for

  • 有 1~3 年经验、日常使用 jQuery 或 React/Vue 的前端工程师
  • 想读懂框架源码、理解模块划分与设计取舍的开发者
  • 准备自研组件库或内部框架的技术负责人
  • 计算机相关专业想补足前端工程认知的高年级学生

Not a good fit for

  • 完全没有 JavaScript 基础、尚未写过页面的初学者
  • 只想快速学会某个框架 API 的业务开发者
  • 主要做后端或其他语言、偶尔了解前端的读者

Reading tips

  1. 先通读第1章与第2章,把种子模块与语言修复的思路吃透,再进后续章节。
  2. 配合书中提到的 jQuery、avalon2、React 源码边读边查,遇到不懂的函数直接到控制台试跑。
  3. 第15、16章的 MVVM 与组件部分建议放在最后读,前置的事件与缓存知识会直接影响理解。
  4. 不必按顺序死磕,可把本书当工具书,按“选择器引擎/事件系统/异步模型”等主题分块攻关。

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Preface / InfoQ Interview
  2. Chapter 1 Seed Module
  3. Chapter 2 Language Module
  4. Chapter 3 Browser Sniffing and Feature Detection
  5. Chapter 4 Class Factory
  6. Chapter 5 Selector Engine
  7. Chapter 6 Node Module
  8. Chapter 7 Data Caching Module
  9. Chapter 8 Style Module
  10. Chapter 9 Attribute Module
  11. Chapter 10 Event System for Desktop
  12. Chapter 11 Event System for Mobile
  13. Chapter 12 Asynchronous Model
  14. Chapter 13 Data Interaction Module
  15. Chapter 14 Animation Engine
  16. Chapter 15 MVVM
  17. Chapter 16 Components
  18. Easter Egg

FAQ

这本书和第1版有什么区别?
第1版 2014 年出版,约 528 千字;第2版 2017 年出版,扩充到约 715 千字、457 页,重写了语言模块以适配 ES6/ES7,并新增移动端事件系统、异步模型与 React 组件方案等内容。
零基础适合读这本书吗?
不太适合。书中大量讨论框架内部实现与源码细节,默认读者熟悉 JavaScript 语言基础、DOM 操作和常见框架用法。零基础建议先读语言入门书,再回来看这本。
书里的内容现在会不会过时?
书中以 jQuery 与 avalon2 为主要案例,部分 API 与写法已不是当下主流,但模块划分、事件系统、异步模型、MVVM 与组件化这些底层思路仍然通用,建议对照现代框架源码阅读。
作者司徒正美是谁?
本名钟钦成,开源前端框架 avalon 的作者,曾任去哪儿网前端架构师,是国内较早系统研究框架实现的前端开发者之一,《JavaScript框架设计》为其代表作。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

About the author

司徒正美 Author

Situ Zhengmei is a technical author in the field of front-end development in China. Publicly available information about the author is limited, and the best-known representative work is JavaScript Framework Design (2nd Edition). This book falls under programming design and focuses on the design ideas and implementation methods of JavaScript frameworks, targeting learners and developers who want to understand the underlying mechanisms of front-end frameworks in depth. In terms of subject matter, the author attends to abstraction and engineering practice at the framework level rather than listing scattered syntax tips, and the writing tends to move from design principles to code implementation, helping readers build an overall understanding of framework structure. Because only one work by this author is included in the collection, details such as biography and professional experience cannot be verified; readers may turn to the book itself to learn about the author's technical grounding and expressive style in JavaScript framework design.

More by the same author

Top rated in the same category