﻿<?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++博客-chlf-随笔分类-代码架构之组件化编程</title><link>http://www.cppblog.com/chlf/category/917.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 20 May 2008 17:50:57 GMT</lastBuildDate><pubDate>Tue, 20 May 2008 17:50:57 GMT</pubDate><ttl>60</ttl><item><title>多人开发基础：组件化编程的简化实现</title><link>http://www.cppblog.com/chlf/archive/2006/02/13/3240.html</link><dc:creator>VC进阶</dc:creator><author>VC进阶</author><pubDate>Mon, 13 Feb 2006 13:55:00 GMT</pubDate><guid>http://www.cppblog.com/chlf/archive/2006/02/13/3240.html</guid><description><![CDATA[<DIV class=postbody>
<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'">引言：</SPAN><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"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&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>COM</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">架构。尽管相对于</SPAN><SPAN lang=EN-US>COM</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而言它已经相当的简单了，但总的来说它仍是比较复杂。本文引入了另一种组件化编程的实现架构，相对于仿</SPAN><SPAN lang=EN-US>COM</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">篇而言，它的结构更加清晰，实现更加简单。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<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'">组件化编程再分析：</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&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>DLL</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">版本问题也必须要解决，防止出现不兼容的组件版本破坏程序的稳定性。只需要达到几个目的就行了，我们没必要把事情做得太过于复杂。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<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'">实现：</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&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>DLL</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">去实现。通常因为面向对象、函数同名、函数地址偏移，使用方便等等原因，我们不希望直接使用</SPAN><SPAN lang=EN-US>DLL</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">导出</SPAN><SPAN lang=EN-US>API</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，而希望能使用接口，以面向对象的方式编程。为了解决版本问题，我们给每个接口的实现版本加个标示。既我们可以要求</SPAN><SPAN lang=EN-US>DLL</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">给出</SPAN><SPAN lang=EN-US>1.0</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">版的接口实现。</SPAN><SPAN lang=EN-US>2.0</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">版的接口实现等。还有，我们还要告诉</SPAN><SPAN lang=EN-US>DLL</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我们想获得哪个接口。于是统一起来，给每个接口加个唯一</SPAN><SPAN lang=EN-US>ID,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">因为通常我们的程序不会在全球发行，所以也没必要使用</SPAN><SPAN lang=EN-US>GUID</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，使用字符串标示就行了。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">每个接口的实现都有自己的创建函数，所以我们在每个模块中建立一张表，维护接口标示与接口创建函数的关系</SPAN></P>
<TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 480; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext" cellSpacing=0 cellPadding=0 border=1>
<TBODY>
<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: teal; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 131.4pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt" vAlign=top width=175>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center><B style="mso-bidi-font-weight: normal"><SPAN style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口标示</SPAN><SPAN lang=EN-US style="COLOR: blue"><o:p></o:p></SPAN></B></P></TD>
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: teal; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 294.7pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" vAlign=top width=393>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center><B style="mso-bidi-font-weight: normal"><SPAN style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">全局创建函数</SPAN><SPAN lang=EN-US style="COLOR: blue"><o:p></o:p></SPAN></B></P></TD></TR>
<TR style="mso-yfti-irow: 1">
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 131.4pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=175>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>“VUIManager<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:chmetcnv TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="1" UnitName="”" w:st="on">001”</st1:chmetcnv></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 294.7pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=393>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">__g_Create</SPAN><SPAN lang=EN-US>VUIManager001</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">interfaceNam_reg()</SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 2">
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 131.4pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=175>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>“VUIManager<st1:chmetcnv TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="2" UnitName="”" w:st="on">002”</st1:chmetcnv></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 294.7pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=393>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">__g_Create</SPAN><SPAN lang=EN-US>VUIManager002</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">interfaceNam_reg()</SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 3">
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 131.4pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=175>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>“VSkin<st1:chmetcnv TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="1" UnitName="”" w:st="on">001”</st1:chmetcnv></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 294.7pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=393>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">__g_Create</SPAN><SPAN lang=EN-US>VSkin001</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">interfaceNam_reg()</SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 4; mso-yfti-lastrow: yes">
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 131.4pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=175>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>“VSkin<st1:chmetcnv TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="2" UnitName="”" w:st="on">002”</st1:chmetcnv></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 294.7pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=393>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">__g_Create</SPAN><SPAN lang=EN-US>VSkin002</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">interfaceNam_reg()</SPAN></P></TD></TR></TBODY></TABLE>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN lang=EN-US>DLL</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中导出接口创建</SPAN><SPAN lang=EN-US>API </SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;</SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: #a000a0; mso-font-kerning: 0pt">DLL_EXPORT</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt"> </SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: blue; mso-font-kerning: 0pt">void</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">*</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: #880000; mso-font-kerning: 0pt">CreateInterface</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">(</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: blue; mso-font-kerning: 0pt">const</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt"> </SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: blue; mso-font-kerning: 0pt">char</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt"> *</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: gray; mso-font-kerning: 0pt">pInterfaceName</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">, </SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: blue; mso-font-kerning: 0pt">int</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt"> *</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: gray; mso-font-kerning: 0pt">pReturnCode</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US><?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><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'"><IMG height=366 alt=简化接口的创建过程.bmp src="http://www.cppblog.com/images/cppblog_com/chlf/组件化编程的简化实现/简化接口的创建过程.bmp" width=554 border=0><BR>小结：</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&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>COM</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">篇》，它所实现的功能也不如《仿</SPAN><SPAN lang=EN-US>COM</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">篇》那么强大，例如它需要实现知道接口所在的</SPAN><SPAN lang=EN-US>DLL</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，不能实现自扩展等。但对于一般的程序而言，它更简单使用。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">还可以使用宏定义</SPAN> <SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">把接口标示和接口创建函数与创建过程关联起来，将接口创建</SPAN><SPAN lang=EN-US>API</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">也包装起来，开发中将更加方便。只需一个宏就可以搞定这些操作。</SPAN></P></DIV><img src ="http://www.cppblog.com/chlf/aggbug/3240.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/chlf/" target="_blank">VC进阶</a> 2006-02-13 21:55 <a href="http://www.cppblog.com/chlf/archive/2006/02/13/3240.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>多人开发的基础---组件化编程,仿COM篇</title><link>http://www.cppblog.com/chlf/archive/2006/01/25/3029.html</link><dc:creator>VC进阶</dc:creator><author>VC进阶</author><pubDate>Wed, 25 Jan 2006 13:07:00 GMT</pubDate><guid>http://www.cppblog.com/chlf/archive/2006/01/25/3029.html</guid><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 引言：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在大型项目的开发中，随着开发进度的进行，我们经常碰到模块之间耦合度太高的问题：由于开发人员经常要在别的模块中调用自己实现的功能，经常随意在某个函数中随意添加调用代码，造成了被修改的那个函数体过长，逻辑混乱。另一个问题是随意包含头文件：开发人员在开发中经常为了要使用某些类的功能而包含引用类的头文件造成类之间的耦合度太...&nbsp;&nbsp;<a href='http://www.cppblog.com/chlf/archive/2006/01/25/3029.html'>阅读全文</a><img src ="http://www.cppblog.com/chlf/aggbug/3029.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/chlf/" target="_blank">VC进阶</a> 2006-01-25 21:07 <a href="http://www.cppblog.com/chlf/archive/2006/01/25/3029.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>