看板 [ Ruby ]
討論串[問題] 一個MVC pattern和composite pattern的 …
共 4 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓0(0推 0噓 1→)留言1則,0人參與, 最新作者jackace時間17年前 (2007/10/12 13:32), 編輯資訊
1
0
0
內容預覽:
假如我的model中用到composite pattern 例如. A <---- B. A <---- C. 那麼在view中 如果要在遇到A,B,C時 在畫面上畫出不同的圖形. 有辦法規避掉. if(p instanceof A){. ...... }else if(p instanceof B
(還有133個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者godfat (godfat 真常)時間17年前 (2007/10/12 13:45), 編輯資訊
0
0
0
內容預覽:
fix typo. 引述《jackace》之銘言:. 我看不出來這跟 composite pattern 有什麼關係?. composite pattern 是指自己包含自己喔.... 如. class Thing; end. class Container < Thing; end. 然後 C
(還有482個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者jackace (inevitable......)時間17年前 (2007/10/12 14:03), 編輯資訊
1
0
0
內容預覽:
抱歉喔 我可能沒敘述的很好 我是用ruby沒錯.... 我的結構是這樣:. class Content. end. class Section < Content. def initialize(title). @items = Array.new. @title = title. end. end
(還有185個字)

推噓1(1推 0噓 0→)留言1則,0人參與, 最新作者godfat (godfat 真常)時間17年前 (2007/10/12 22:42), 編輯資訊
0
0
0
內容預覽:
edit typo. 這個...我是覺得不是這樣說的,因為你這邊 @items 可以放 Section 或 Text,. 跟 static typing 下以 interface 達到的 composite pattern 完全無關,. 這邊純粹是 ruby dynamic typing 下的結果。
(還有972個字)
首頁
上一頁
1
下一頁
尾頁