<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dysfunctional Programming &#187; object oriented</title>
	<atom:link href="http://ra3s.com/wordpress/dysfunctional-programming/category/object-oriented/feed/" rel="self" type="application/rss+xml" />
	<link>http://ra3s.com/wordpress/dysfunctional-programming</link>
	<description>(λ (a b) a) vs (λ (a b) b)</description>
	<lastBuildDate>Fri, 02 Mar 2012 08:56:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Trouble with OOP</title>
		<link>http://ra3s.com/wordpress/dysfunctional-programming/trouble-with-oop/</link>
		<comments>http://ra3s.com/wordpress/dysfunctional-programming/trouble-with-oop/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 18:37:05 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[object oriented]]></category>
		<category><![CDATA[repost]]></category>

		<guid isPermaLink="false">http://ra3s.com/wordpress/dysfunctional-programming/?p=209</guid>
		<description><![CDATA[Subtyping, Subclassing, and Trouble with OOP. Excerpt: What makes this problem more unsettling is that both you and I tried to do everything by the book. We wrote a safe, typechecked code. We eschewed casts. g++ (2.95.2) compiler with flags &#8230; <a href="http://ra3s.com/wordpress/dysfunctional-programming/trouble-with-oop/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://okmij.org/ftp/Computation/Subtyping/">Subtyping, Subclassing, and Trouble with OOP</a>.</p>
<p>Excerpt:</p>
<blockquote><p>What makes this problem more unsettling is that both you and I tried to do everything by the book. We wrote a safe, typechecked code. We eschewed casts. g++ (2.95.2) compiler with flags -W and -Wall issued not a single warning. […] And yet, despite all my efforts to separate interface and implementation, I failed. Should a programming language or the methodology take at least a part of the blame?</p></blockquote>
<p>A lot of people miss the point with Object Oriented Programming (OOP) – this author gets it.</p>
<p><span id="more-209"></span>Painfully few programmers are aware of the <a href="http://en.wikipedia.org/wiki/Liskov_substitution_principle">Liskov Substitution Principle</a> (LSP), and its violations incur the wrath of some distant cousin of the the side effect monster, the violated invariant monster. LSP is incredibly tricky to apply – generally, the object metaphor actually gets in the way of verifying LSP properties. The general guidance of OO spends far too little time on these implications. Inevitably, a programmer does something totally reasonable but everything breaks anyway.</p>
<p>I try to follow the LSP when designing green-field. This rarely permits me to use inheritance of implementation. Rather, <a href="http://en.wikipedia.org/wiki/Composite_pattern">composition</a> dominates my designs.</p>
<p>For the curious, the author&#8217;s program strengthened a precondition – the derived class CSet required the element be unique for insert to &#8216;succeed&#8217;, where CBag required nothing. As such, LSP predicts that CSets cannot be transparently substituted where CBags are predicted; if they are, different behavior may (and did) result.</p>
]]></content:encoded>
			<wfw:commentRss>http://ra3s.com/wordpress/dysfunctional-programming/trouble-with-oop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

