IBM Developer is your one-stop location for getting hands-on training and learning in-demand skills on relevant technologies such as generative AI, data science, AI, and open source.
Welcome Welcome to the Yahoo! Design Pattern Library. We're thrilled to be sharing patterns and code with the web design and development community, we hope it's useful, and we look forward to your feedback. In fact, we've just launched two new Design Pattern forums: one for discussing this pattern library and another for talking about the ins and out of writing design patterns and maintain
突然ですが、きっとあなたも使っているデザインパターンシリーズ 何気なく書いていたあのクラスが無意識的にNullObjectパターンやHook Operationパターンを適用していることがここ最近多い気がしませんか? 僕の場合はS2Daoを通して見付けた(身に着けた)ものが多いんですが、今回はそのS2Daoより、簡単に書けるHook OperationパターンとNullObjectパターンをPHP5で書いてみます。 Hook Operationパターン 「Hook Operationパターン」にも書かれていますが、あるクラスの処理の前と後ろに、別の処理を実行したいことがあります。 AOPとか特別なことはせずに、あるクラスの前処理と後処理を呼び出します。 あるクラスの処理を「Process」クラスの「execute」処理とし、別の処理(前・後)は「Hook」インタフェースを実装するクラス
このプログラムでは全体の処理の流れが決まっています. その中で,youGotMailPopup()の部分のみの動作が変更できることが望まれています. ここで利用できるパターンを考えてみます.振舞に分類されるパターンのなか で,TemplateMethod と呼ばれるパターンがあります.GoFを参照すると, TemplateMethod 目的: 1つのオペレーションにアルゴリズムのスケルトンを定義しておき,そ の中のいくつかのステップについてはサブクラスでの定義に任せることにする. TemplateMethodパターンでは,アルゴリズムの構造を変えずに,アルゴリズ ムの中のあるステップをサブクラスで再定義する. とあります.今回の例では,全体の処理の流れを規定するrun()メソッドが上 記の「スケルトン」に当たります.また,youGotMailPopup()が「いくつかの ステップ」に当ては
RestWiki をたまに見直すと新たな発見があって面白い。 たとえば先日、「ステートレスなやりとりとは何か(What is Stateless Interaction?)」という箇所を見つけて、興味深く読んだ。このページは以前も絶対に読んでいるはずなのだが、 人間は忘れてしまうものである。 RestWiki の例でも充分わかりやすいのだけれど、自分でも例を思いついたので書きとめておく。 ステートフルサーバとステートレスサーバはどう違うのか。 まずは、ステートフルの例: 客: こんにちは 店員: いらっしゃいませ。○○バーガーへようこそ 客: ハンバーガーセットをお願いします 店員: サイドメニューは何になさいますか? 客: ポテトで 店員: ドリンクは何になさいますか? 客: ジンジャーエールで 店員: +50円でドリンクをLサイズにできますがいかがですか? 客: Mでいいです 店員:
はてなのPHP keywordを付けているところを眺めていたら、僕と同じようにデザインパターンを実践している人がいた。参考にしよう ref - ルーで一気にクマー デザパタについては以前「デザパタ本には載らないデザパタ」にも書いたことあったけど、GoFとかJ2EEとかPofEAA(これはちょっと大きいか)で色んなパターンが転がってるけど、実際にやっていることは、「同じような実装を2度も書きたくない」から、書きやすく整理する手法をパターンっていってるんだなーと思う。 んで、ここはid:shimookaが上手いことまとめてくれていて、突き詰めれば勝手にデザパタされるんじゃないかと。 (中略) 僕なんかは、もともとjavaで一定のプログラミング設計(?)とかインタフェースについて見てきた(Seasar含めて)からinterfaceみたいなものが大好きなんだけど、んなもんいらん!実装クラスだけで
http://blog.xole.net/article.php?id=525を読んで、前からパターンについて思っていることを絡めてつらつらと。。。 多くの書籍で紹介されているパターンはあくまでGoFの23個だけです。実際にはハタさんの書いてあるとおり「デザパタ本には載らないデザパタ」自体はかなりの数があると思います。というより、「○○パターン」と名前が付いていない属人的なテクニックの方が多いんじゃないでしょうかね。 #こういう本はあったら面白いかも知れません :-) で、「なぜGoFか」ということについては、関連する情報が多いとか、エライ人らがまとめたものだからとか、GoFはウケが良いからとか色々理由はあると思いますが、やっぱり他のパターンの基底となるものが多いからじゃないでしょうかね。 #やっぱり、基本大事 ここからつらつらと。。。 個人的にデザインパターンを扱っていて強く思ったのが、
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く