天天看點

《JavaScript應用程式設計》導讀

在本書中我們先後提到了不少web開發類書籍,但對于那些想從頭開始學習建構完整javascript應用的讀者來說,市面上真正值得推薦的javascript教程又顯得十分稀缺。與此同時,現在幾乎每一個網際網路創業公司的人員配備中都少不了資深javascript應用程式開發者的角色。本書旨在幫助人們了解如何建構易于擴充和維護的完整javascript應用。

本書并不打算向讀者詳細講解javascript語言基礎,它基于你現有的javascript知識結構,向你展示那些會讓你的編碼工作長久受益的javascript特性與技巧。一般來說,随着應用程式的規模不斷擴大,添加新功能與缺陷修複開始變得越來越難以下手,代碼随之變得脆弱、臃腫,甚至一個非常小的改動都可能帶來大範圍的代碼重構。如果你在編碼過程中遵循了本書中介紹的設計模式,你會發現代碼開始變得靈活而富有伸縮性,對代碼的細微變更不會再對其他子產品産生負面影響。

本書的内容主要聚焦在用戶端javascript應用設計上,同時也會穿插一些較為基礎的node、restful api等服務端技術介紹。應用邏輯前端化已經是大勢所趨,以往我們常常将模闆渲染、與第三方服務通信等任務交給服務端去處理,諸如此類的工作如今通常在浏覽器中完成。

事實上,現今的javascript應用已經在浏覽器中扮演起了傳統桌面級應用的角色。當然,這一切仍然離不開服務端的技術支撐,像靜态資源托管、動态子產品加載、資料持久化、記錄檔記錄以及第三方api服務調用等,這些都屬于服務端的職能範疇。

本書内容涵蓋:

面向應用開發者的javascript特性與最佳實踐。

代碼組織、子產品化與複用。

· 用戶端關注點分離(mvc等)。

· 服務端與api的通信機制。

· 用node.js設計并實作restful api。

· 建構、測試、團隊協作、應用部署與擴充。

· 應用工程的國際化。

本書目标讀者

具備一定的javascript開發基礎,有至少1或2年的javascript實踐經驗,并想了解如何使用javascript開發大規模web或企業級應用的開發者。

抱有強烈的學習熱情,尤其是對閉包、函數式程式設計、原型繼承這些javascript語言獨有的強大特性想做了解與嘗試的程式設計入門者。(即使你是第一次聽到這些概念。)

也許你想在下一個具有挑戰性的javascript項目中使用tdd(測試驅動開發)技術,本書所有的代碼範例中均包含測試用例。在你讀完本書後,代碼自測的意識與方法也會随之建立起來。

不太适合本書的讀者

google與維基百科同樣是資訊查閱的好幫手,對軟體設計模式來說,維基百科是一份非常不錯的參考資料。

單元測試

很難估量單元測試在應用中的重要性,本書中幾乎所有的代碼樣例中均附有單元測試用例。編寫測試用例讓你對功能實作了解得更為透徹,對方案與接口設計的把握越來越謹慎,設計測試用例的過程同樣是迫使你思考将代碼解耦的過程。保持編寫單元測試與解耦代碼的習慣會使你在今後的工作中持續受益,相信在讀完本書之後你會收獲這種編碼習慣。

關于單元測試與編碼風格的更多内容,請參見本書附錄a。

<a href="https://yq.aliyun.com/articles/107836">1.1 javascript的特性</a>

<a href="https://yq.aliyun.com/articles/107858">1.2 性能</a>

<a href="https://yq.aliyun.com/articles/107863">1.3 對象</a>

<a href="https://yq.aliyun.com/articles/107865">1.4 文法</a>

<a href="https://yq.aliyun.com/articles/107869">1.5 函數是一等公民</a>

<a href="https://yq.aliyun.com/articles/107877">1.6 事件</a>

<a href="https://yq.aliyun.com/articles/107881">1.7 複用性</a>

<a href="https://yq.aliyun.com/articles/107884">1.8 結論</a>

<a href="https://yq.aliyun.com/articles/107886">1.9 解構現代javascript應用</a>

<a href="https://yq.aliyun.com/articles/107891">1.10 基礎架構</a>

<a href="https://yq.aliyun.com/articles/107892">1.11 json ——資料存儲與通信</a>

<a href="https://yq.aliyun.com/articles/107894">1.12 nosql資料庫</a>

<a href="https://yq.aliyun.com/articles/107898">1.13 restful json web services</a>

<a href="https://yq.aliyun.com/articles/107908">2.1 減少隐式副作用</a>

<a href="https://yq.aliyun.com/articles/107919">2.2 函數聲明</a>

<a href="https://yq.aliyun.com/articles/107921/">2.3 lambdas</a>

<a href="https://yq.aliyun.com/articles/107924">2.4 立即執行函數表達式</a>

<a href="https://yq.aliyun.com/articles/107927/">2.5 方法上下文</a>

<a href="https://yq.aliyun.com/articles/107929">2.6 函數作用域</a>

<a href="https://yq.aliyun.com/articles/107932">2.7 變量提升</a>

<a href="https://yq.aliyun.com/articles/107940">2.8 閉包</a>

<a href="https://yq.aliyun.com/articles/107942">2.9 方法api的設計</a>

<a href="https://yq.aliyun.com/articles/107947">2.10 參數命名</a>

<a href="https://yq.aliyun.com/articles/107954">2.11 多态函數</a>

<a href="https://yq.aliyun.com/articles/107959/">2.12 範型程式設計與集合多态</a>

<a href="https://yq.aliyun.com/articles/107966">2.13 鍊式調用與流式api</a>

<a href="https://yq.aliyun.com/articles/107973">2.14 函數式程式設計</a>

<a href="https://yq.aliyun.com/articles/107976">2.15 無狀态函數(純函數)</a>

<a href="https://yq.aliyun.com/articles/107981/">2.16 偏函數應用與函數加裡化</a>

<a href="https://yq.aliyun.com/articles/107983">2.16 異步操作</a>

<a href="https://yq.aliyun.com/articles/107988/">2.17 回調函數</a>

<a href="https://yq.aliyun.com/articles/107991">2.18 promises與deferreds</a>

<a href="https://yq.aliyun.com/articles/107994">2.19 小結</a>

<a href="https://yq.aliyun.com/articles/107999">3.1 過時的類繼承</a>

<a href="https://yq.aliyun.com/articles/108003">3.2 流式javascript</a>

<a href="https://yq.aliyun.com/articles/108016">3.3 原型</a>

<a href="https://yq.aliyun.com/articles/108019/">3.4 原型代理</a>

<a href="https://yq.aliyun.com/articles/108022">3.5 原型克隆</a>

<a href="https://yq.aliyun.com/articles/108026">3.6 享元模式</a>

<a href="https://yq.aliyun.com/articles/108029">3.7 建立對象</a>

<a href="https://yq.aliyun.com/articles/108032/">3.8 工廠函數</a>

<a href="https://yq.aliyun.com/articles/108042">3.9使用stamps進行原型繼承</a>

<a href="https://yq.aliyun.com/articles/108046">3.10 小結</a>

繼續閱讀