<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>冒号论坛 &#187; Tag: OOP - Recent Topics</title>
		<link>http://bbs.zhenghui.org/tags/oop</link>
		<description>冒号论坛 &raquo; Tag: OOP - Recent Topics</description>
		<language>en-US</language>
		<pubDate>Wed, 08 Sep 2010 13:14:32 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://bbs.zhenghui.org/search.php</link>
		</textInput>
		<atom:link href="http://bbs.zhenghui.org/rss/tags/oop/topics" rel="self" type="application/rss+xml" />

		<item>
			<title>Todd on "迪米特法则"</title>
			<link>http://bbs.zhenghui.org/topic/%e8%bf%aa%e7%b1%b3%e7%89%b9%e6%b3%95%e5%88%99#post-184</link>
			<pubDate>Fri, 03 Sep 2010 22:00:29 +0000</pubDate>
			<dc:creator>Todd</dc:creator>
			<guid isPermaLink="false">184@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;目前，我能够识别并避免违背迪米特法则，但是总感觉对迪米特法则的认识深度还不够，还不能说清楚到底迪米特法则本质上意味着什么。我目前思考的结果是：&#60;br /&#62;
OOP中，对象间的交互是消息传递模型，而消息是值语义的；而obj.GetAnotherObject()的结果是引用，违背了对象消息传递模型。所以，违背迪米特法则的设计其实是不符合OOP的。
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Todd on "subtype和subclass"</title>
			<link>http://bbs.zhenghui.org/topic/subtype%e5%92%8csubclass#post-130</link>
			<pubDate>Mon, 14 Jun 2010 00:13:36 +0000</pubDate>
			<dc:creator>Todd</dc:creator>
			<guid isPermaLink="false">130@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;虽然subtype和subclass是OOP中最基本的问题之一，但我是在读《冒号课堂》的时候才开始注意到这个问题。我想国内的程序员不能区分subtype和subclass的不在少数。下面这个资料对于subtype和subclass讨论得比较深入，贴上来分享：&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.cs.princeton.edu/courses/archive/fall98/cs441/mainus/mainus.html&#34; rel=&#34;nofollow&#34;&#62;http://www.cs.princeton.edu/courses/archive/fall98/cs441/mainus/mainus.html&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Todd on "数据是什么？"</title>
			<link>http://bbs.zhenghui.org/topic/%e6%95%b0%e6%8d%ae%e6%98%af%e4%bb%80%e4%b9%88%ef%bc%9f#post-85</link>
			<pubDate>Fri, 19 Mar 2010 10:22:32 +0000</pubDate>
			<dc:creator>Todd</dc:creator>
			<guid isPermaLink="false">85@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;今天看了SCIP的数据抽象一节，然后结合之前《冒号课堂》的内容，我感觉对数据的认识又深入了一些。&#60;/p&#62;
&#60;p&#62;我现在对数据的认识是：数据在程序中是一个符号和该符号上的操作规则。比如：定义了一个符号pair，若pair = make_pair(x, y)则left(pair) == x, right(pair) == y。pair本身只是一个符号，它的特征是由其相关的一系列操作（包括构造和使用两类）所体现的。OOP的数据抽象正是以数据为中心组织操作。不知道理解对不对？&#60;/p&#62;
&#60;p&#62;参考文章：&#60;br /&#62;
&#60;a href=&#34;http://mitpress.mit.edu/sicp/full-text/sicp/book/node30.html&#34; rel=&#34;nofollow&#34;&#62;http://mitpress.mit.edu/sicp/full-text/sicp/book/node30.html&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Todd on "成员方法的疑问"</title>
			<link>http://bbs.zhenghui.org/topic/%e6%88%90%e5%91%98%e6%96%b9%e6%b3%95%e7%9a%84%e7%96%91%e9%97%ae#post-73</link>
			<pubDate>Tue, 02 Mar 2010 22:09:24 +0000</pubDate>
			<dc:creator>Todd</dc:creator>
			<guid isPermaLink="false">73@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;OOP是以数据为中心组织算法的。OOP把面向过程的函数变成了类的成员方法的过程，也是过程抽象到数据抽象的转变过程。但我发现，即使在OOP中过程抽象似乎还有存在的意义，特别是，我常对成员方法的设计还是有感觉拿不准的地方。比如：&#60;/p&#62;
&#60;p&#62;1.STL中的算法多是作为函数提供的，没有作为容器类的成员方法。对于这个问题，我觉得STL的设计有它的合理的一面：因为sort，transform等算法本身也是一种被人所熟知的概念，它的独立存在是对概念的直接表达；独立性也增强了算法的普适性。但这样的设计也有缺点：对象的行为不够饱满；用户不仅需要获取对象，还需要依赖额外的算法，没有达到数据抽象的高内聚效果。了解mixin以后，我觉得也许mixin是解决这个问题的更好方法：既保持算法的独立性；又可以方便地混入对象达到数据对算法的吸附作用。&#60;/p&#62;
&#60;p&#62;2.对于存在交互情况，比如：画笔在画纸上作画，我觉得不管是paper.draw(pen)还是pen.draw(paper)都不如用函数表达为draw(paper,pen)来得自然。据我所知，这种情况在建模中常抽象为一种服务来表达某一功能，比如：DrawService。&#60;/p&#62;
&#60;p&#62;请问有没有一个比较好的方法来分析算法什么情况下适合设计为类的成员方法呢？什么情况下又应该作为独立的函数(C++)或者是抽象为服务呢？
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
