Skip to Content
JAVASCRIPT網頁應用程式設計
book

JAVASCRIPT網頁應用程式設計

by Alex MacCaw
January 2013
Intermediate to advanced
332 pages
5h 23m
Chinese
GoTop Information, Inc.
Content preview from JAVASCRIPT網頁應用程式設計
模型(Model)和資料
|
39
如果想了解更多關於命名空間的資訊,建議你到 Peter Michaux 的部落格,裡面有一篇
非常棒的文章(
http://michaux.ca/articles/javascript-namespacing
)就是在介紹命名空間。
建立 ORM
物件- 關聯式對應(Object-relational mappers,或簡稱為ORMs),一般是用在
JavaScript 以外的程式語言上。不過,它是一種非常實用的資料管理技術,同時也會是
協助你將模型概念實際運用在 JavaScript 應用程式的絕佳利器。有了 ORM,就可以將模
型和遠端伺服器綁在一起—模型物件實體所發生的任何變動,都會透過背景程式將 Ajax
請求發送給伺服器。或著,也可以把模型物件實體和 HTML 網頁元件綁在在一起—模型
物件實體所發生的任何變動,都會反應至檢視器的內容。稍後將會再詳盡介紹上述兩種
做法的實際範例,首先先來說明,該如何建立 ORM 物件。
基本上,所謂的 ORM 指的是用來包裝某些資料的物件層程式介面。一般而言,ORM
用途是將 SQL 資料庫轉化為抽象的物件,但以我們現在的情形而言,ORM 只是用來將
JavaScript 資料型態轉化為抽象的物件。多包一層物件介面的好處,是能讓我們在這層
物件裡隨心所欲的加上自訂的函式和屬性,讓原先平凡無奇的基本資料,具備更多額外
的功能。我們可以藉此新增諸如資料驗證、觀察模型資料變動、儲存模型資料,以及伺
服器回叫…之類的功能,同時還能讓這些程式碼都可以被重複使用。 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

初めてのJavaScript 第3版 ―ES2015以降の最新ウェブ開発

初めてのJavaScript 第3版 ―ES2015以降の最新ウェブ開発

Ethan Brown, 武舎 広幸, 武舎 るみ
PHP编程:第4版

PHP编程:第4版

Kevin Tatroe, Peter MacIntyre
Strange Code

Strange Code

Ronald T. Kneusel
Perfecting Your Thinking Skills

Perfecting Your Thinking Skills

MIT Sloan Management Review

Publisher Resources

ISBN: 9789862766811