1)web開發(fā)的特點是是:沒有太復(fù)雜的技術(shù)難點,一切在于迅速的把握需求,其實這正式敏捷開發(fā)的要旨所在,一切都可以非常快速的建立,非常快速的重構(gòu),我們的開發(fā)工具,底層庫和框架,包括搜索引擎和web文檔提供的幫助,都提我們供給了敏捷的能力。
2)此外,相應(yīng)的,最有效率的交流方式必須留給web開發(fā),那就是face2face(面對面),不要太擔(dān)心你的設(shè)計不能被完備的文檔所保留下來,他們會以交流,代碼和小卡片的方式保存下來
3)人的因素會更加重要,無論是對用戶的需求,還是開發(fā)人員的素質(zhì)。
另:有關(guān)web效率,有著名的14條規(guī)則,由yahoo性能效率小組所總結(jié),并廣為流傳。業(yè)已出現(xiàn)相關(guān)插件(YSlow),14 rules列在下面:
1. Make Fewer HTTP Requests
減少http請求次數(shù)
Image maps 圖像中增加url可以將多個圖片合為一個,減少http請求。
CSS Sprites 通過css 將圖片引入到頁面中減少頁面請求http 。
Combined files合并文件不如合并多個請求的javascript為一個。減少http請求。
http://developer.yahoo.net/blog/archives/2007/04/rule_1_make_few.html
2. Use a Content Delivery Network
3. Add an Expires Header
在下載的css、js、image組件里增加過期時間
4. Gzip Components
(對下載的組件進(jìn)行壓縮)
毫無疑問,對站點內(nèi)容進(jìn)行壓縮是一個比較常用的 Web 優(yōu)化手段.但是并不一定都能達(dá)到理想的效果.原因在于 mod-gzip 模塊不但消耗服務(wù)器端 CPU資源,也消耗客戶端 CPU資源. 而且, mod_gzip 壓縮文件后創(chuàng)建的臨時文件是放到磁盤上的,這也會給磁盤 IO帶來嚴(yán)重的問題.
Flickr 采用的是 Httpd 2.x 以后支持的 mod_deflate 模塊.壓縮操作都在內(nèi)存中進(jìn)行.mod_deflate 在 Httpd 1.x 是不可用的, 不過可以通過創(chuàng)建 RAM盤的方式來間接提高性能.
當(dāng)然, mod_gzip 到也不是一無是處, 對于預(yù)壓縮的文件, 還是有好處的. 而且, 采用壓縮的時候,也要注意策略. 圖片文件壓縮就沒什么必要了(Flickr 上圖像多, 而且壓縮得不到什么好處). Flickr 只對JavaScript 和 CSS進(jìn)行壓縮. mod_gzip 新一點的版本能夠自動通過配置 mod_gzip_update_static 選項自動處理預(yù)壓縮的文件. Cal 也指出這個特性在一些舊版本的瀏覽器上會出問題.
壓縮的另一個主要手段是內(nèi)容的壓縮. 針對 JavaScript 可以進(jìn)行通過減少注釋、合并空格、使用緊湊的語法等小技巧(Google 的所有腳本都非常難讀,而且非常緊湊,思想類似).當(dāng)然,經(jīng)過這樣處理的 JavaScript 可能帶了很多括號不容易解析,Flickr 使用了 Dojo Compressor 來構(gòu)建解析樹。Dojo Compressor 開銷很低,而且對于最終用戶是透明的. JavaScript 的處理方法介紹過,CSS 處理則相對簡單.通過簡單的正則表達(dá)式替換(比如把多個空格替換為一個空格符), 最高可以獲得 50% 的壓縮比。
5. Put CSS at the Top
css文件盡可能放在頁面的最上面
· Move Scripts to the Bottom
js文件盡可能放在頁面的最下面
6。Put JS components as close to the bottom of the page as possible.
(js文件盡可能放在頁面的最下面)
7。Avoid CSS Expressions
(在css文件中慎用表達(dá)式)
8。Make JavaScript and CSS External
(在外部包含js和css文件)
9。Reduce DNS Lookups
(減少請求中域名的解析次數(shù))
10。Minify JavaScript
(js代碼壓縮)
11。Avoid doing redirects.
(避免重定向)
12。Remove Duplicates Scripts
(避免請求重復(fù)的js文件)
13。Configure ETags
(配置好ETag)
Flickr 的開發(fā)者充分利用了 Http 1.1 規(guī)范定義的 Etag 與 Last-Modified 機制 來提高 Caching 的效率. 值得注意的是,Cal 介紹了一個在負(fù)載均衡條件下的 e-Tag 小技巧. 即可以設(shè)定 Apache 通過文件調(diào)整時間與文件大小獲得 E-Tag ,而默認(rèn)情況下, Apache 是通過文件節(jié)點獲取 e-Tag 的。當(dāng)然,這也不是很完美,因為會影響 if-modified-since 。
但是有的網(wǎng)站的e-Tag,如yahoo,其產(chǎn)生規(guī)則是基于節(jié)點的。相同的css或js腳本在不同節(jié)點服務(wù)器上的e-Tag不同,所以如果有n個服務(wù)器,那么瀏覽器獲得304應(yīng)答消息的概率是1/n。
14。Make Ajax Cacheable
(緩存Ajax請求)
以下幾點是新增的準(zhǔn)則,還沒有正式公布,所以大家要注意,
15。Flush the Header
(先發(fā)送Header里的信息)
We improved the page load times by flushing the apache output buffer after the document HEAD was generated.This had two benefits.
First, the HEAD contains SCRIPT and LINK tags for scripts and stylesheets. By flushing the HEAD, those tags are received and parsed by the browser sooner, and in turn the browser starts downloading those components earlier.
Second, the HEAD is flushed before actually generating the search results. This is a win for any property doing a significant backend computation or especially making one or more backend web service calls.
16。Split Static Content Across Multiple Hostnames
(把較大的靜態(tài)文件分割成不同域的請求)
If you have many (10 or more) components downloaded from a single hostname, it might be better to split those across two hostnames.
17。Reduce the Size of Cookies
(不要讓Cookie內(nèi)容過大)
Reduce the amount of data in the cookie by storing state information on the backend, and abbreviating names and values stored in the cookie. Set expiration dates on your cookies, and make them as short as possible.
18。Host Static Content on a Different Top-Level Domain
(把靜態(tài)文件放在不同的頂級域名下)
19。Minify CSS
(Css代碼壓縮)
20。Use GET for XHR
(有XHR時使用GET請求)
Iain Lamb did a deep study of how using POST for XMLHttpRequests is inefficient, especially in IE. His recommendation: “If the amount of data you have to send to the server is small (less than 2k), I suggest you design your webservice / client application to use GET rather than POST。
21。Avoid IFrames
(盡量避免使用IFrame)
Don’t use SRC (set it via JS instead). Each IFrame takes 20-50ms, even if it contains nothing
22。Optimize images
(優(yōu)化圖片)