﻿<?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>C++博客-no pains no gains</title><link>http://www.cppblog.com/ydy0102/</link><description /><language>zh-cn</language><lastBuildDate>Tue, 14 Apr 2026 23:08:09 GMT</lastBuildDate><pubDate>Tue, 14 Apr 2026 23:08:09 GMT</pubDate><ttl>60</ttl><item><title>面向对象设计过程中的设计模式</title><link>http://www.cppblog.com/ydy0102/archive/2005/10/13/670.html</link><dc:creator>paradise</dc:creator><author>paradise</author><pubDate>Thu, 13 Oct 2005 08:13:00 GMT</pubDate><guid>http://www.cppblog.com/ydy0102/archive/2005/10/13/670.html</guid><wfw:comment>http://www.cppblog.com/ydy0102/comments/670.html</wfw:comment><comments>http://www.cppblog.com/ydy0102/archive/2005/10/13/670.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ydy0102/comments/commentRss/670.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ydy0102/services/trackbacks/670.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">面向对象设计过程中的设计模式<BR></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 17.95pt; mso-char-indent-count: 1.71; mso-char-indent-size: 10.45pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一般<B>通过以下信息来描述设计模式：</B></SPAN><B><SPAN lang=EN-US><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; mso-char-indent-count: 1.71; mso-char-indent-size: 10.5pt; mso-list: l1 level1 lfo7; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-bidi-font-weight: bold">l<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模式的名字</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; mso-char-indent-count: 1.71; mso-char-indent-size: 10.5pt; mso-list: l1 level1 lfo7; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-bidi-font-weight: bold">l<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模式的意图</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; mso-char-indent-count: 1.71; mso-char-indent-size: 10.5pt; mso-list: l1 level1 lfo7; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-bidi-font-weight: bold">l<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">激发模式动机的“设计压力”</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; mso-char-indent-count: 1.71; mso-char-indent-size: 10.5pt; mso-list: l1 level1 lfo7; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-bidi-font-weight: bold">l<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">缓解这些压力的解决方案</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; mso-char-indent-count: 1.71; mso-char-indent-size: 10.5pt; mso-list: l1 level1 lfo7; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-bidi-font-weight: bold">l<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实现该解决方案所需的类</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; mso-char-indent-count: 1.71; mso-char-indent-size: 10.5pt; mso-list: l1 level1 lfo7; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-bidi-font-weight: bold">l<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">解决方案类中的责任和协作</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; mso-char-indent-count: 1.71; mso-char-indent-size: 10.5pt; mso-list: l1 level1 lfo7; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-bidi-font-weight: bold">l<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">导致有效设计的指导原则</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; mso-char-indent-count: 1.71; mso-char-indent-size: 10.5pt; mso-list: l1 level1 lfo7; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-bidi-font-weight: bold">l<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">原代码例子或原代码模板</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; mso-char-indent-count: 1.71; mso-char-indent-size: 10.5pt; mso-list: l1 level1 lfo7; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-bidi-font-weight: bold">l<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对相关设计模式的交叉引用</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">&nbsp;&nbsp;&nbsp;&nbsp;设计模式名字本身是一个抽象，它传达关于其适用性和意图的有意义的信息；设计压力描述和模式将被应用到的软件部位相关的数据、功能和行为需求，压力也限制了设计将被导出的方式，本质上来说，<B>设计压力描述使得设计模式可以被应用所必须存在的环境和条件</B>。<B>模式特征指明了设计中可以被调整以使得模式能够适应一系列问题的属性，这些属性表示了设计中可以被搜索（通过数据库）以使得合适模式能够被找到的特征</B>。从中也能看出，<B>软件复用中的一个关键问题是如何在成百上千候选模式中找到合用的模式</B>。<B>在设计阶段一般采用的模式形式主要是“导致有效设计的知道原则”</B>，通过使用在特定任务或问题下适用的设计模式，在原则的指导下可以帮助设计者在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">OOD</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">的过程中尽量使用这些广为使用并能导致优秀设计的思维方式进行设计。</SPAN><img src ="http://www.cppblog.com/ydy0102/aggbug/670.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ydy0102/" target="_blank">paradise</a> 2005-10-13 16:13 <a href="http://www.cppblog.com/ydy0102/archive/2005/10/13/670.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个显示当前时间的面板程序，当在主窗口中点击视图菜单项的子菜单TimeBorad时，跳出时间显示。</title><link>http://www.cppblog.com/ydy0102/archive/2005/10/12/666.html</link><dc:creator>paradise</dc:creator><author>paradise</author><pubDate>Wed, 12 Oct 2005 15:07:00 GMT</pubDate><guid>http://www.cppblog.com/ydy0102/archive/2005/10/12/666.html</guid><wfw:comment>http://www.cppblog.com/ydy0102/comments/666.html</wfw:comment><comments>http://www.cppblog.com/ydy0102/archive/2005/10/12/666.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ydy0102/comments/commentRss/666.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ydy0102/services/trackbacks/666.html</trackback:ping><description><![CDATA[<P><FONT color=#000000><STRONG>// TimeBoard.cpp </STRONG></FONT></P>
<P><FONT color=#000000><STRONG>#include "stdafx.h"<BR>#include "ThreadTestB.h"<BR>#include "TimeBoard.h"</STRONG></FONT></P>
<P><FONT color=#000000><STRONG>#ifdef _DEBUG<BR>#define new DEBUG_NEW<BR>#undef THIS_FILE<BR>static char THIS_FILE[] = __FILE__;<BR>#endif</STRONG></FONT></P>
<P><FONT color=#000000><STRONG>/////////////////////////////////////////////////////////////////////////////<BR>// CTimeBoard</STRONG></FONT></P>
<P><FONT color=#000000><STRONG>CTimeBoard::CTimeBoard()<BR>{<BR>}</STRONG></FONT></P>
<P><FONT color=#000000><STRONG>CTimeBoard::~CTimeBoard()<BR>{<BR>}</STRONG></FONT></P>
<P><BR><FONT color=#000000><STRONG>BEGIN_MESSAGE_MAP(CTimeBoard, CStatic)<BR> //{{AFX_MSG_MAP(CTimeBoard)<BR> ON_WM_TIMER()<BR> ON_WM_CREATE()<BR> //}}AFX_MSG_MAP<BR>END_MESSAGE_MAP()</STRONG></FONT></P>
<P><FONT color=#000000><STRONG>void CTimeBoard::OnTimer(UINT nIDEvent) <BR>{<BR> CTime time=CTime::GetCurrentTime();<BR> CString s;<BR> s.Format("it is %2d:%2d:%2d now.",time.GetHour(),time.GetMinute(),time.GetSecond());<BR> SetWindowText(s);</STRONG></FONT></P>
<P><FONT color=#000000><STRONG> CStatic::OnTimer(nIDEvent);<BR>}</STRONG></FONT></P>
<P><FONT color=#000000><STRONG>int CTimeBoard::OnCreate(LPCREATESTRUCT lpCreateStruct) <BR>{<BR> if (CStatic::OnCreate(lpCreateStruct) == -1)<BR>  return -1;<BR> <BR> SetTimer(0,5000,NULL);</STRONG></FONT></P>
<P><FONT color=#000000><STRONG> return 0;<BR>}<BR></STRONG></FONT></P><img src ="http://www.cppblog.com/ydy0102/aggbug/666.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ydy0102/" target="_blank">paradise</a> 2005-10-12 23:07 <a href="http://www.cppblog.com/ydy0102/archive/2005/10/12/666.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>