﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>博客园-game-over</title><link>http://www.cnblogs.com/game-over/</link><description /><language>zh-cn</language><lastBuildDate>Wed, 27 Aug 2008 23:03:15 GMT</lastBuildDate><pubDate>Wed, 27 Aug 2008 23:03:15 GMT</pubDate><ttl>60</ttl><item><title>郁闷啊郁闷</title><link>http://www.cnblogs.com/game-over/archive/2008/07/30/1256492.html</link><dc:creator>Game_over</dc:creator><author>Game_over</author><pubDate>Wed, 30 Jul 2008 07:12:00 GMT</pubDate><guid>http://www.cnblogs.com/game-over/archive/2008/07/30/1256492.html</guid><wfw:comment>http://www.cnblogs.com/game-over/comments/1256492.html</wfw:comment><comments>http://www.cnblogs.com/game-over/archive/2008/07/30/1256492.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cnblogs.com/game-over/comments/commentRss/1256492.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/game-over/services/trackbacks/1256492.html</trackback:ping><description><![CDATA[从6月30号离职开始，就一直不顺利。<br>7月初来到上海，找工作，面试了几家公司，有两家给了Offer，薪水待遇都是差不多的，不过一家是做外包的，一家是日企，经过一顿抉择之后，拒绝了外包，投入日企，结果因为办居住证的问题，一直拖到现在，到处求人，不好使啊。<br>总不能让我再来一遍，重新找工作吧。<br><img src ="http://www.cnblogs.com/game-over/aggbug/1256492.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41924/" target="_blank">[新闻]中国软件协会：SAP羞辱国产软件是不正当竞争</a>]]></description></item><item><title>新工作找到了</title><link>http://www.cnblogs.com/game-over/archive/2008/07/23/1249583.html</link><dc:creator>Game_over</dc:creator><author>Game_over</author><pubDate>Wed, 23 Jul 2008 06:53:00 GMT</pubDate><guid>http://www.cnblogs.com/game-over/archive/2008/07/23/1249583.html</guid><wfw:comment>http://www.cnblogs.com/game-over/comments/1249583.html</wfw:comment><comments>http://www.cnblogs.com/game-over/archive/2008/07/23/1249583.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/game-over/comments/commentRss/1249583.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/game-over/services/trackbacks/1249583.html</trackback:ping><description><![CDATA[6月30号离职，7月2号离开沈阳，去北京玩了两天，7月5号来到上海，开始新的里程。<br>7月17号第一份Offer被我拒绝，理由：薪资太少，才4。<br>7月23号第二份Offer接受，试用期6，转正7，还可以。<br>两周多的面试经历，在酷暑中奔波，真是很辛苦啊，不过最终结果还是基本令我满意的。<br>下周就进公司报道了，希望能有所收获。<br><img src ="http://www.cnblogs.com/game-over/aggbug/1249583.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41923/" target="_blank">[新闻]福布斯：Facebook网站十大最火爆游戏</a>]]></description></item><item><title>第一話（1998）</title><link>http://www.cnblogs.com/game-over/archive/2008/05/26/1207894.html</link><dc:creator>Game_over</dc:creator><author>Game_over</author><pubDate>Mon, 26 May 2008 11:34:00 GMT</pubDate><guid>http://www.cnblogs.com/game-over/archive/2008/05/26/1207894.html</guid><wfw:comment>http://www.cnblogs.com/game-over/comments/1207894.html</wfw:comment><comments>http://www.cnblogs.com/game-over/archive/2008/05/26/1207894.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/game-over/comments/commentRss/1207894.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/game-over/services/trackbacks/1207894.html</trackback:ping><description><![CDATA[<P>問題１<BR><BR>問１　航空①会社は、万一②の事故に備えて③、いつも救助④態勢をととのえている。<BR>　　　航空：こうくう　万一：まんいち　備えて：そなえて　救助：きゅうじょ　態勢：たいせい<BR><BR>問２　おおぜいの留学生①が集会②に参加③して意見を交換④した。<BR>　　　留学生：りゅうがくせい　集会：しゅうかい　参加：さんか　交換：こうかｎ<BR><BR>問３　珍しい①植物②を見つけたら、くわしく調べ③て記録④してください。<BR>　　　珍しい：めずらしい　植物：しょくぶつ　調べ：しらべ　記録：きろく<BR><BR>問４　自転車に乗っていた老人①がバスと接触②して倒れ③、足の骨を折った④。<BR>　　　老人：ろうじｎ　接触：せっしょく　倒れ：たおれ　折った：おった<BR><BR>問５　環境汚染①を恐れた②住民③は、新しい鉱山④の開発に反対している。<BR>　　　汚染：おせん　恐れた：おそれた　住民：じゅうみｎ　鉱山：こうざん<BR><BR>問題２<BR><BR>問１　2階①へのぼるエスカレーター付近②で財布③を拾った④。<BR>　　　階：かい　付近：ふきん　財布：さいふ　拾った：ひろった<BR><BR>問２　あなたは宇宙①は永遠②に続く③と思いますか。<BR>　　　宇宙：うちゅう　永遠：えいえん　続く：つづく<BR><BR>問３　決められた①位置②に車を移動③しなさい。<BR>　　　決められた：きめられた　位置：いち　移動：いどう<BR><BR>問４　来年度の予算①は2億②円を超える③と言われている。<BR>　　　予算：よさん　億：おく　超える：こえる<BR><BR>問５　貯金①を全額②引き出して③楽器④を買った。<BR>　　　貯金：ちょきん　全額：ぜんがく　引き出して：ひきだして　楽器：がっき<BR><BR>問６　コンピューターを使えば、複雑①な部品②も容易③に製造④することができる。<BR>　　　複雑：ふくざつ　部品：ぶひん　容易：ようい　製造：せいぞう<BR><BR>問題３<BR><BR>問１　今年の文学賞をもらった作家に、新聞記者が<FONT color=#ff0000>インタビュー</FONT>をして記事を書いた。<BR>問２　悪い人にだまされて、財産をすべて<FONT color=#ff0000>失って</FONT>しまった。<BR>問３　祖父は体が弱くなってからは、<FONT color=#ff0000>ほとんど</FONT>家の中で過ごしている。<BR>問４　親が自分の子供をかわいいと思いますのは<FONT color=#ff0000>あたりまえだ</FONT>。<BR>問５　有名なレストランに出かけたが、店は休みで<FONT color=#ff0000>シャッター</FONT>が閉じまっていた。<BR><BR>続く。。。</P><img src ="http://www.cnblogs.com/game-over/aggbug/1207894.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41922/" target="_blank">[新闻]谷歌允许用户评论搜索结果调整顺序</a>]]></description></item><item><title>堕落啊堕落</title><link>http://www.cnblogs.com/game-over/archive/2008/04/27/1173338.html</link><dc:creator>Game_over</dc:creator><author>Game_over</author><pubDate>Sun, 27 Apr 2008 10:25:00 GMT</pubDate><guid>http://www.cnblogs.com/game-over/archive/2008/04/27/1173338.html</guid><wfw:comment>http://www.cnblogs.com/game-over/comments/1173338.html</wfw:comment><comments>http://www.cnblogs.com/game-over/archive/2008/04/27/1173338.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnblogs.com/game-over/comments/commentRss/1173338.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/game-over/services/trackbacks/1173338.html</trackback:ping><description><![CDATA[今天是4月27号，上一篇Blog是2月27号。<BR>堕落啊堕落，也是工作太忙的原因。<BR>前几天还有个哥们催我写下去呢，不过看样子，估计要持续到6月下旬我才能有些功夫。<BR>预订5月底出差，6月中旬回来，回来就会轻松一段时间了，等着吧。<img src ="http://www.cnblogs.com/game-over/aggbug/1173338.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41921/" target="_blank">[新闻]Internet 另一超级漏洞被公布</a>]]></description></item><item><title>步步为营，重构出模式（2） </title><link>http://www.cnblogs.com/game-over/archive/2008/02/27/1084115.html</link><dc:creator>Game_over</dc:creator><author>Game_over</author><pubDate>Wed, 27 Feb 2008 12:33:00 GMT</pubDate><guid>http://www.cnblogs.com/game-over/archive/2008/02/27/1084115.html</guid><wfw:comment>http://www.cnblogs.com/game-over/comments/1084115.html</wfw:comment><comments>http://www.cnblogs.com/game-over/archive/2008/02/27/1084115.html#Feedback</comments><slash:comments>9</slash:comments><wfw:commentRss>http://www.cnblogs.com/game-over/comments/commentRss/1084115.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/game-over/services/trackbacks/1084115.html</trackback:ping><description><![CDATA[上回说到Command的雏形被高手改过之后，高手让我再对代码进行一下重构和完善，并且还特意嘱咐不要出现那么多的字符串。饿滴神啊，该怎么办呢？<BR>外事不决问Google，果然，有办法了：<BR>我用一个配置文件，把用户输入的命令和实际的Command类一一对应，然后利用反射实例化这个类。<BR>好，那就开始做吧。<BR>首先创建app.config文件，这个是工程默认会读取的，就不用自己解析XML了，这个文件里面是这样的： 
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG id=Code_Closed_Image_201155 onclick="this.style.display='none'; Code_Closed_Text_201155.style.display='none'; Code_Open_Image_201155.style.display='inline'; Code_Open_Text_201155.style.display='inline';" height=16 src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width=11 align=top><IMG id=Code_Open_Image_201155 style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text_201155.style.display='none'; Code_Closed_Image_201155.style.display='inline'; Code_Closed_Text_201155.style.display='inline';" height=16 src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width=11 align=top><SPAN id=Code_Closed_Text_201155 style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Code</SPAN><SPAN id=Code_Open_Text_201155 style="DISPLAY: none"><BR><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">&lt;?</SPAN><SPAN style="COLOR: #ff00ff">xml&nbsp;version="1.0"&nbsp;encoding="utf-8"&nbsp;</SPAN><SPAN style="COLOR: #0000ff">?&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">configuration</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">appSettings</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">add&nbsp;</SPAN><SPAN style="COLOR: #ff0000">key</SPAN><SPAN style="COLOR: #0000ff">="echo"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;value</SPAN><SPAN style="COLOR: #0000ff">="Command.EchoCommand"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">add&nbsp;</SPAN><SPAN style="COLOR: #ff0000">key</SPAN><SPAN style="COLOR: #0000ff">="exit"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;value</SPAN><SPAN style="COLOR: #0000ff">="Command.ExitCommand"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">appSettings</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">configuration</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></SPAN></DIV><BR>指令跟对应的类是一一对应的，然后再创建一个Class，用来读取配置文件，生成对应的实例，这个类起什么名字好呢？<BR>它会生成很多不同类型的实例，好，暂且就叫它CommandFactory吧，然后给它一个静态方法，一个参数，返回值就是ICommand。 
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG id=Code_Closed_Image_201500 onclick="this.style.display='none'; Code_Closed_Text_201500.style.display='none'; Code_Open_Image_201500.style.display='inline'; Code_Open_Text_201500.style.display='inline';" height=16 src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width=11 align=top><IMG id=Code_Open_Image_201500 style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text_201500.style.display='none'; Code_Closed_Image_201500.style.display='inline'; Code_Closed_Text_201500.style.display='inline';" height=16 src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width=11 align=top><SPAN id=Code_Closed_Text_201500 style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Code</SPAN><SPAN id=Code_Open_Text_201500 style="DISPLAY: none"><BR><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000">&nbsp;ICommand&nbsp;getCommand(String&nbsp;comName)<BR><IMG id=Codehighlighter1_50_339_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_50_339_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_50_339_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_50_339_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_50_339_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_50_339_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_50_339_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_50_339_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_50_339_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_50_339_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;comClsName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;ConfigurationSettings.AppSettings[comName];<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(comClsName&nbsp;</SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)<BR><IMG id=Codehighlighter1_152_262_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_152_262_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_152_262_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_152_262_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_152_262_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_152_262_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_152_262_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_152_262_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_152_262_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_152_262_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type&nbsp;type&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;Type.GetType(comClsName);<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_cmd&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;(ICommand)Activator.CreateInstance(type);<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000"><BR><IMG id=Codehighlighter1_276_320_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_276_320_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_276_320_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_276_320_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_276_320_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_276_320_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_276_320_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_276_320_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_276_320_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_276_320_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_cmd&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;UnknownCommand();<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;_cmd;<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN></SPAN></DIV><BR>我都有点儿佩服我自己了，一个很好的解决办法，嗯，厉害！！！<BR>Processor类也需要修改，以前是只能添加新的Command，但是如果用户第二次输入同样指令，就不应该添加，而应该是替换了。<BR>到现在，最终的主方法已经是这样子的了： 
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG id=Code_Closed_Image_201907 onclick="this.style.display='none'; Code_Closed_Text_201907.style.display='none'; Code_Open_Image_201907.style.display='inline'; Code_Open_Text_201907.style.display='inline';" height=16 src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width=11 align=top><IMG id=Code_Open_Image_201907 style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text_201907.style.display='none'; Code_Closed_Image_201907.style.display='inline'; Code_Closed_Text_201907.style.display='inline';" height=16 src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width=11 align=top><SPAN id=Code_Closed_Text_201907 style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Code</SPAN><SPAN id=Code_Open_Text_201907 style="DISPLAY: none"><BR><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">String&nbsp;command&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #800000">""</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>Processor&nbsp;p&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Processor();<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">)<BR><IMG id=Codehighlighter1_65_443_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_65_443_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_65_443_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_65_443_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_65_443_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_65_443_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_65_443_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_65_443_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_65_443_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_65_443_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;command&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;Console.ReadLine();<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;cmdName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;command.Split(SPACE.ToCharArray())[</SPAN><SPAN style="COLOR: #800080">0</SPAN><SPAN style="COLOR: #000000">];<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;ICommand&nbsp;cmd&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;CommandFactory.getCommand(cmdName);<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(command.IndexOf(SPACE)&nbsp;</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #800080">1</SPAN><SPAN style="COLOR: #000000">)<BR><IMG id=Codehighlighter1_259_299_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_259_299_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_259_299_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_259_299_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_259_299_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_259_299_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_259_299_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_259_299_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_259_299_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_259_299_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd.setRequest(command);<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000"><BR><IMG id=Codehighlighter1_313_391_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_313_391_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_313_391_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_313_391_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_313_391_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_313_391_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_313_391_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_313_391_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_313_391_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_313_391_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd.setRequest(command.Substring(command.IndexOf(SPACE)&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #800080">1</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;p.setCommand(cmdName,&nbsp;cmd);<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;p.request();<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN></SPAN></DIV><BR>比以前简洁了不少，而且每那么多的if else 和常量了，我的工作完成了。<BR><BR>高手看我沾沾自喜的样子，走过来，说：做完了，我看看。<BR>看了一眼，又说：你比我当年不差啊，看过设计模式，是吧。<BR>我老老实实的说：没看过，我就是觉得这么做应该就是比较好的做法，也不知道什么模式不模式的。<BR>高手自言自语：是啊，你<FONT style="BACKGROUND-COLOR: #0000ff">不受GOF设计模式的束缚，不强迫自己往他给定的UML类图上靠，而思想上却是相通的</FONT>，小伙儿有前途啊。<BR>听了高手这一顿白话，我信心倍增。<BR>高手看我信心爆膨，说：别高兴的太早，刚才客户又有新的需求了，这回看你能不能瞎猫碰到死耗子身上，给我整出来。<BR>我说：没问题。<BR>不过，过了三分钟，我满面愁容的坐在电脑前，不知道如何下手。<BR><BR>代码：<A href="/Files/game-over/Command2.rar">http://www.cnblogs.com/Files/game-over/Command2.rar</A><img src ="http://www.cnblogs.com/game-over/aggbug/1084115.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41920/" target="_blank">[新闻]3 个独特的未来搜索引擎</a>]]></description></item><item><title>步步为营，重构出模式（1）</title><link>http://www.cnblogs.com/game-over/archive/2008/02/23/1079047.html</link><dc:creator>Game_over</dc:creator><author>Game_over</author><pubDate>Sat, 23 Feb 2008 14:12:00 GMT</pubDate><guid>http://www.cnblogs.com/game-over/archive/2008/02/23/1079047.html</guid><wfw:comment>http://www.cnblogs.com/game-over/comments/1079047.html</wfw:comment><comments>http://www.cnblogs.com/game-over/archive/2008/02/23/1079047.html#Feedback</comments><slash:comments>9</slash:comments><wfw:commentRss>http://www.cnblogs.com/game-over/comments/commentRss/1079047.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/game-over/services/trackbacks/1079047.html</trackback:ping><description><![CDATA[<P>公司每年都招聘很多刚毕业的新员工，在实习的时候，每每有人向他们推荐代码大全、设计模式这两本书的时候，我都劝诫他们，代码大全是很好的书，设计模式你们看还太早，没有几万行的代码经验，你们是看不明白滴。结果还是这样的结果：看了设计模式后，只是知道概念，却不知道如何运用，貌似理解，实则不然。我就打算写一个例子，把经常会见到的模式都能体现出来，就从今天做起吧。<BR>首先声明一下，这些文章只对新手有帮助，高手可以帮帮我改进改进，呵呵。<BR><BR>假设这么一个需求：一个控制台程序，需要根据用户输入的指令进行不同的处理，比如，有echo、exit，那么，我下笔就写下了下面的代码：</P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG id=Code_Closed_Image_210323 onclick="this.style.display='none'; Code_Closed_Text_210323.style.display='none'; Code_Open_Image_210323.style.display='inline'; Code_Open_Text_210323.style.display='inline';" height=16 src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width=11 align=top><IMG id=Code_Open_Image_210323 style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text_210323.style.display='none'; Code_Closed_Image_210323.style.display='inline'; Code_Closed_Text_210323.style.display='inline';" height=16 src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width=11 align=top><SPAN id=Code_Closed_Text_210323 style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Code</SPAN><SPAN id=Code_Open_Text_210323 style="DISPLAY: none"><BR><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">command&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;Console.ReadLine();<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(command.IndexOf(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">echo</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #800080">0</SPAN><SPAN style="COLOR: #000000">)<BR><IMG id=Codehighlighter1_64_132_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_64_132_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_64_132_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_64_132_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_64_132_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_64_132_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_64_132_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_64_132_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_64_132_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_64_132_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(command.Substring(</SPAN><SPAN style="COLOR: #800080">4</SPAN><SPAN style="COLOR: #000000">,&nbsp;command.Length&nbsp;</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #800080">4</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(command.IndexOf(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">exit</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #800080">0</SPAN><SPAN style="COLOR: #000000">)<BR><IMG id=Codehighlighter1_172_208_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_172_208_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_172_208_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_172_208_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_172_208_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_172_208_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_172_208_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_172_208_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_172_208_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_172_208_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;System.Environment.Exit(</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #800080">1</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000"><BR><IMG id=Codehighlighter1_214_270_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_214_270_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_214_270_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_214_270_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_214_270_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_214_270_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_214_270_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_214_270_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_214_270_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_214_270_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">Unknown&nbsp;Command:</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;command);<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN></SPAN></DIV>
<P>这样的代码恰好就被一个高手看到了，高手对我说：你这样不行啊，你把对用户输入指令的接收、解析和执行统统放到一起了，耦合度太高，你需要重构，把每个不同的职责分开，不要搞得一团浆糊。<BR>我一想，对啊，是挺乱的，怎么改呢？<BR>对，我先把对指令的执行抽出来，单做成一个类，给它做一个方法：execute，让这个方法执行具体的动作。<BR>过了一会儿，代码出来了，已经是如下模样了：</P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG id=Code_Closed_Image_210617 onclick="this.style.display='none'; Code_Closed_Text_210617.style.display='none'; Code_Open_Image_210617.style.display='inline'; Code_Open_Text_210617.style.display='inline';" height=16 src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width=11 align=top><IMG id=Code_Open_Image_210617 style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text_210617.style.display='none'; Code_Closed_Image_210617.style.display='inline'; Code_Closed_Text_210617.style.display='inline';" height=16 src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width=11 align=top><SPAN id=Code_Closed_Text_210617 style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Code</SPAN><SPAN id=Code_Open_Text_210617 style="DISPLAY: none"><BR><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">command&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;Console.ReadLine();<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(command.IndexOf(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">echo</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #800080">0</SPAN><SPAN style="COLOR: #000000">)<BR><IMG id=Codehighlighter1_64_140_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_64_140_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_64_140_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_64_140_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_64_140_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_64_140_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_64_140_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_64_140_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_64_140_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_64_140_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;EchoCommand(command.Substring(</SPAN><SPAN style="COLOR: #800080">4</SPAN><SPAN style="COLOR: #000000">,&nbsp;command.Length&nbsp;</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #800080">4</SPAN><SPAN style="COLOR: #000000">)).execute();<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(command.IndexOf(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">exit</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #800080">0</SPAN><SPAN style="COLOR: #000000">)<BR><IMG id=Codehighlighter1_180_216_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_180_216_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_180_216_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_180_216_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_180_216_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_180_216_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_180_216_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_180_216_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_180_216_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_180_216_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;ExitCommand().execute();<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000"><BR><IMG id=Codehighlighter1_222_268_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_222_268_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_222_268_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_222_268_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_222_268_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_222_268_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_222_268_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_222_268_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_222_268_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_222_268_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;UnknownCommand(command).execute();<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN></SPAN></DIV>
<P>做成了三个类，EchoCommand、ExitCommand、UnknownCommand，虽然多出来三个类的代码，但是主程序看起来比以前工整多了，顺眼多了。<BR>这个时候，高手过来看我的成果，面有喜色，说：小伙儿，不过啊，这俨然是Command模式雏形了。<BR>啥，这就是模式了？<BR>高手就开始说教：只是雏形而已，还有很多要做的，比如，应该对用户指令进行统一调度，三个Command类为什么不是用接口？等等等等。<BR>我就犯愁了，这我也搞不定啊。<BR>高手坐下来，奋笔疾书。在之前的代码基础上，加了一个接口ICommand，让三个Command类实现这个接口；加了个Processor类，对指令统一管理，最终代码如下：</P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG id=Code_Closed_Image_213958 onclick="this.style.display='none'; Code_Closed_Text_213958.style.display='none'; Code_Open_Image_213958.style.display='inline'; Code_Open_Text_213958.style.display='inline';" height=16 src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width=11 align=top><IMG id=Code_Open_Image_213958 style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text_213958.style.display='none'; Code_Closed_Image_213958.style.display='inline'; Code_Closed_Text_213958.style.display='inline';" height=16 src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width=11 align=top><SPAN id=Code_Closed_Text_213958 style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Code</SPAN><SPAN id=Code_Open_Text_213958 style="DISPLAY: none"><BR><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">String&nbsp;command&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #800000">""</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>Processor&nbsp;p&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Processor();<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>p.addCommand(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">Unknown</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;UnknownCommand());<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>p.addCommand(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">Exit</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;ExitCommand());<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>p.addCommand(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">Echo</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;EchoCommand());<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">)<BR><IMG id=Codehighlighter1_194_600_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_194_600_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_194_600_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_194_600_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_194_600_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_194_600_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_194_600_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_194_600_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_194_600_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_194_600_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;command&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;Console.ReadLine();<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(command.IndexOf(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">echo</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #800080">0</SPAN><SPAN style="COLOR: #000000">)<BR><IMG id=Codehighlighter1_272_380_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_272_380_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_272_380_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_272_380_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_272_380_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_272_380_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_272_380_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_272_380_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_272_380_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_272_380_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p.resetRequest(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">Echo</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;command.Substring(</SPAN><SPAN style="COLOR: #800080">4</SPAN><SPAN style="COLOR: #000000">,&nbsp;command.Length&nbsp;</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #800080">4</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p.request(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">Echo</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(command.IndexOf(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">exit</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #800080">0</SPAN><SPAN style="COLOR: #000000">)<BR><IMG id=Codehighlighter1_428_503_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_428_503_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_428_503_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_428_503_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_428_503_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_428_503_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_428_503_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_428_503_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_428_503_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_428_503_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p.resetRequest(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">Exit</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;command);<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p.request(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">Exit</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000"><BR><IMG id=Codehighlighter1_517_598_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_517_598_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_517_598_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_517_598_Closed_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_517_598_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_517_598_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_517_598_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_517_598_Open_Text').style.display='inline';" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_517_598_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_517_598_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p.resetRequest(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">Unknown</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;command);<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p.request(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">Unknown</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN></SPAN></DIV>
<P>写完之后，高手喘了口气，说，现在的代码风格不好，你还需要重构一下。<BR>我想，这次重构也就是把字符串定义为常量了吧。<BR>高手很严肃地说：今天快下班就不说了，明天下午我CodeReview的时候不希望看到这么多的字符串。<BR>啊？！这该怎么办？？？？？？<BR><BR>(代码：<A href="/Files/game-over/Command.rar">http://www.cnblogs.com/Files/game-over/Command.rar</A>)</P><img src ="http://www.cnblogs.com/game-over/aggbug/1079047.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41919/" target="_blank">[新闻]诺基亚新机N85 N79发布</a>]]></description></item><item><title>第二十一天</title><link>http://www.cnblogs.com/game-over/archive/2008/01/25/1053731.html</link><dc:creator>Game_over</dc:creator><author>Game_over</author><pubDate>Fri, 25 Jan 2008 12:55:00 GMT</pubDate><guid>http://www.cnblogs.com/game-over/archive/2008/01/25/1053731.html</guid><wfw:comment>http://www.cnblogs.com/game-over/comments/1053731.html</wfw:comment><comments>http://www.cnblogs.com/game-over/archive/2008/01/25/1053731.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cnblogs.com/game-over/comments/commentRss/1053731.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/game-over/services/trackbacks/1053731.html</trackback:ping><description><![CDATA[<P>唉，前一段时间Hotle不能上网了，真是郁闷。</P>
<P>来日本整整三个星期了，天天写文档，真是烦死了。</P>
<P>不过幸好我的客户是个大美女，不到三十，还没结婚呢，哈哈。前两天他们举行新年会的时候，还给哥们斟酒呢，不错啊。</P>
<P>这几天日本也是挺冷的，前两天还下雪了，雪花那个大啊，不过落到地上就化了，地表温度还是蛮高的。</P>
<P>日本的小女生还真是可怜啊，那么冷，还都是超短裙，光光腿，都不穿丝袜的，冻得那个红啊，看着都害怕。</P>
<P>上周末去了趟新宿，花了一大笔钱啊，买了个IPOD，80G的classic，黑色版的。</P>
<P>日元是29,800，换算成人民币大概是1900多一点点，比国内是便宜，不过还是蛮贵的。</P>
<P>忍了，就当是自己的新年礼物了。</P>
<P>IPOD是买了，不过MP4资源太少啊，80G这个空啊，都不知道放些什么好了，总不能当移动硬盘吧。</P>
<P>各位有什么好的MP4资源分享的话，一定要留言啊。</P>
<P>最后放几张照片，注意，播放的是《投名状》，呵呵。<BR><IMG height=415 alt=image002.jpg src="http://www.cnblogs.com/images/cnblogs_com/game-over/ipod/image002.jpg" width=553 border=0><IMG height=415 alt=image004.jpg src="http://www.cnblogs.com/images/cnblogs_com/game-over/ipod/image004.jpg" width=553 border=0><IMG height=415 alt=image006.jpg src="http://www.cnblogs.com/images/cnblogs_com/game-over/ipod/image006.jpg" width=553 border=0></P><img src ="http://www.cnblogs.com/game-over/aggbug/1053731.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41918/" target="_blank">[新闻]数据库市场:微软和甲骨文快速进步 威胁IBM</a>]]></description></item><item><title>第十天</title><link>http://www.cnblogs.com/game-over/archive/2008/01/14/1038863.html</link><dc:creator>Game_over</dc:creator><author>Game_over</author><pubDate>Mon, 14 Jan 2008 13:37:00 GMT</pubDate><guid>http://www.cnblogs.com/game-over/archive/2008/01/14/1038863.html</guid><wfw:comment>http://www.cnblogs.com/game-over/comments/1038863.html</wfw:comment><comments>http://www.cnblogs.com/game-over/archive/2008/01/14/1038863.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnblogs.com/game-over/comments/commentRss/1038863.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/game-over/services/trackbacks/1038863.html</trackback:ping><description><![CDATA[昨天没写，原因呢：去喝酒了。<br>有一家啤酒厂，做宣传，打了一车人去喝啤酒，哈哈，有此好事，当然去了。<br>到那儿，听了一个小时的宣传，然后就喝了十分钟，也就是两杯吧，还有一些零食，真不错，哈哈。<br><br>今天据说是日本这边的成人式，大家都不上班，可是呢，我们还得去上班，唉，真是的。<br><br>真的是想回家了！！！<br><img src ="http://www.cnblogs.com/game-over/aggbug/1038863.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41917/" target="_blank">[新闻]深度分析：全球千亿美元市值IT企业7月榜单点评</a>]]></description></item><item><title>第八天</title><link>http://www.cnblogs.com/game-over/archive/2008/01/13/1036735.html</link><dc:creator>Game_over</dc:creator><author>Game_over</author><pubDate>Sun, 13 Jan 2008 01:19:00 GMT</pubDate><guid>http://www.cnblogs.com/game-over/archive/2008/01/13/1036735.html</guid><wfw:comment>http://www.cnblogs.com/game-over/comments/1036735.html</wfw:comment><comments>http://www.cnblogs.com/game-over/archive/2008/01/13/1036735.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnblogs.com/game-over/comments/commentRss/1036735.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/game-over/services/trackbacks/1036735.html</trackback:ping><description><![CDATA[天公不作美啊，本来打算去迪斯尼的，早上六点的时候开始下起蒙蒙细雨来了，只能是放弃了。<br><br>只好睡觉，一觉睡到十二点多，然后买了便当，烧了点儿汤，就算是午饭了。<br><br>晚上看电视的时候竟然还有中国产的电视剧，不过在国内没看过，而且几个主角都不是很打牌的，<br><br>反正是我都叫不上名字的，中国的电视剧，说的都是日语，有点奇怪啊。哈哈。<br><br>躲在寝室睡觉，看电视，这一天真没意思。<br><img src ="http://www.cnblogs.com/game-over/aggbug/1036735.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41916/" target="_blank">[新闻]中移动上半年净利549亿元 每天盈利3亿</a>]]></description></item><item><title>第六天</title><link>http://www.cnblogs.com/game-over/archive/2008/01/13/1036730.html</link><dc:creator>Game_over</dc:creator><author>Game_over</author><pubDate>Sun, 13 Jan 2008 01:15:00 GMT</pubDate><guid>http://www.cnblogs.com/game-over/archive/2008/01/13/1036730.html</guid><wfw:comment>http://www.cnblogs.com/game-over/comments/1036730.html</wfw:comment><comments>http://www.cnblogs.com/game-over/archive/2008/01/13/1036730.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/game-over/comments/commentRss/1036730.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/game-over/services/trackbacks/1036730.html</trackback:ping><description><![CDATA[<p>想打电话给老婆，又不能上网，只能通过电话机了。</p>
<p>找了一圈，电话卡得5000日元，投币的1000日元也就能说几分钟，只好忍了。</p>
<p>回到寝室，竟然有一个台在播《醉拳2》，对白全都是日文的，也挺有意思，梅艳芳，成龙，黄日华，呵呵，都是老面孔了。</p>
<p>下周播的是李连杰的，看来他们还是有一定的影响力的。记得上次出差的时候电影院里都还放李连杰的电影呢。</p>
<p>生活真单调，九点半上班，一直到十二点，然后下午一点开始，一直到晚上七八点，然后吃饭，都累死了。</p>
<p>还是洗洗睡吧。</p><img src ="http://www.cnblogs.com/game-over/aggbug/1036730.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41916/" target="_blank">[新闻]中移动上半年净利549亿元 每天盈利3亿</a>]]></description></item></channel></rss>