最近中文字幕完整版高清,宅男宅女精品国产av天堂,亚洲欧美日韩综合一区二区,最新色国产精品精品视频,中文字幕日韩欧美就去鲁

首頁 > 考試輔導 > 計算機考試 > JAVA認證 > JAVA認證考試動態(tài) > 網(wǎng)站程序員如何應對web標準(1)

網(wǎng)站程序員如何應對web標準(1)

本文討論的是在web標準普及的形勢下,網(wǎng)站程序員的定位以及如何與設計師配合開發(fā)符合web標準的網(wǎng)站項目。

本文適合的讀者是傳統(tǒng)table布局下分工不是非常明晰的程序員。

1:學習web標準,讓你的工作變得更加簡單。

web標準是大勢所趨,所以作為網(wǎng)站程序員。你必須洗腦,必須去學習web標準。去重新認識html標簽,去了解如何讓程序輸出頁面需要的代碼。

比如:

 

 

上邊是美工出來的效果圖,下邊是符合標準的程序代碼:

dim ohtml

set rs=server.createobject("adodb.recordset")

sql = "select top 10 id,title from tbl_news order by id desc"

rs.open sql,conn,1,1

ohtml="<ul>"

do while not rs.eof

ohtml=ohtml & "<li><a href=""shownews.asp?id=" & rs("id") & """ title=""" & rs("title") & """>" & rs("title") & "</a></li>"

rs.movenext

loop

ohtml=ohtml & "</ul>"

rs.close

set rs=nothing

response.write (ohtml)

而如果是傳統(tǒng)的table布局下,程序員要寫的html代碼就會多很多,要寫出table、要判斷什么時候輸出tr來換行、要在每條新聞的前邊加個一個img來輸出小圖標、要用程序去控制輸出的標題長度。所有的工作都需要先出頁面代碼,程序員才能去寫出這段程序。

對于程序員而言,你應該把web標準當成是一種福音,你應該把它當圣經(jīng)一樣去讀,去了解頁面代碼到底需要什么,明白之后你就會發(fā)現(xiàn)。你比以前要輕松多了。由于web標準注重的是表現(xiàn)與內(nèi)容相脫離,而程序只負責內(nèi)容數(shù)據(jù)。從此你就不再需要考慮用程序代碼如何控制隔行換色、一行分幾列輸出等等。你需要去做的,就是向頁面輸出最直接的內(nèi)容,沒有任何裝飾的內(nèi)容。

當然如果你是用.net開發(fā)的話,你就可以更徹底一點了。你可以完全將工作重點放在建立對象、類庫、數(shù)據(jù)訪問等,向表現(xiàn)層提供方法即可。下邊的例子是我以前做項目的,應該有點參考價值。

2:網(wǎng)站程序員,別讓html標簽阻擋了你的視線。

如果你覺得你真的非常討厭繁瑣的html標簽,而且自己的學習方向也不在網(wǎng)站的表現(xiàn)層,那你就和html標簽徹底地說再見吧。

我曾經(jīng)在傳統(tǒng)桌面軟件開發(fā)的公司工作,程序員都不會html,網(wǎng)站項目緊的時候又不得不讓他們來幫忙。我們就拿著visual studio .net 2003自帶的幾個例子仔細分析,按照面向?qū)ο蟮慕Y(jié)構(gòu)化分層開發(fā)模式,也能非常好的進行配合。以新聞模塊的開發(fā)為例:

第一步:網(wǎng)站程序員可以按需求分析進行數(shù)據(jù)庫設計,你可以負責建表、編寫存儲過程。這類的事情程序員都非常的熟悉。

第二步:定義對象。將網(wǎng)站的信息對象化,比如:

public class news

protected _id as integer

protected _typeid as integer

protected _title as string

protected _author as string

protected _original as string

protected _updatetime as datetime

protected _content as string

protected _clickcount as integer

public property id() as integer

get

return _id

end get

set(byval value as integer)

_id = value

end set

end property

public property typeid() as integer

get

return _typeid

end get

set(byval value as integer)

_typeid = value

end set

end property

public property title() as string

end property

public property author() as string

end property

public property original() as string

end property

public property updatetime() as datetime

end property

public property content() as string

end property

public property clickcount() as integer

end property

end class

就像這樣,把網(wǎng)站里所有的表都試著對象化。然后再定義對象相關的記錄集,上邊定義的是單個的新聞對象,再定義一個新聞的記錄集。

public class newss

......

end class