論理構造を文脈に読み換えながら class 名を考える
最近、一部で話題に上がっている POSH にも、"Use good semantic-class-names" という実践項目がありますが、今日はその class 名のつけ方について、最近、思い至ったことから。
POSH encapsulates the best practices of using semantic HTML to author web pages. Semantic HTML is the subset of HTML 4.01 (or XHTML 1.0) elements and attributes that are semantic rather than presentational.
基本的にはより論理構造を意識した class名をつけることが、今日のお話の目的なんですが、semantic-class-names のリンク先にない新味は、論理構造を文脈に読み換えながら class 名を考えるという点。(ただし、普段から意識的に文書全体の構造に照らして class名をつけている方には、それほど新味はないかも。)
例によって、あくまで試案であり、選択肢です。(というか、そもそも僕自身が試行錯誤の最中。)是非や取捨は各自でご判断ください。
関連リソース
- Naming conventions table(And all that Malarkey)
- Web Authoring Statistics: Classes(Google Code)
- コード共有のためのネーミングルール(我的春秋)
| 固定リンク | コメント (7) | トラックバック (0)
最近のコメント