<?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/"
	
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Slacy's Blog &#187; programming</title>
	<atom:link href="http://slacy.com/blog/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://slacy.com/blog</link>
	<description>This site is solar powered!</description>
	<lastBuildDate>Tue, 07 Feb 2012 18:43:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Subject Oriented Programming (SOP) vs. Object Oriented Programming (OOP)</title>
		<link>http://slacy.com/blog/2010/03/suject-oriented-programming-sop-vs-object-oriented-programming-oop/</link>
		<comments>http://slacy.com/blog/2010/03/suject-oriented-programming-sop-vs-object-oriented-programming-oop/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 23:03:13 +0000</pubDate>
		<dc:creator>slacy</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[direct object]]></category>
		<category><![CDATA[indirect object]]></category>
		<category><![CDATA[object-oriented]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[subject-oriented]]></category>

		<guid isPermaLink="false">http://slacy.com/blog/?p=1141</guid>
		<description><![CDATA[When I&#8217;m programming, I usually anthroporporphize the code and the actors involved, and that means when I&#8217;m thinking about program flow, I think of it as if they&#8217;re real actors doing the tasks needed, and then I convert that back &#8230; <a href="http://slacy.com/blog/2010/03/suject-oriented-programming-sop-vs-object-oriented-programming-oop/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When I&#8217;m programming, I usually anthroporporphize the code and the actors involved, and that means when I&#8217;m thinking about program flow, I think of it as if they&#8217;re real actors doing the tasks needed, and then I convert that back into code.  But, when reading other people&#8217;s code, I often times find it hard to convert back into my internal actor-based representation.  I realized that this is because the term &#8220;Object Oriented Programming&#8221; should likely be called &#8220;Subject Oriented Programming&#8221;  I&#8217;m using the term Subject the way you use it when describing English sentence structure.  Take a look at this:</p>
<p>&#8220;The boy put the box in the bag.&#8221;</p>
<p>Just to refresh your grade school English (which I had to do as well), take a brief look at the <a href="http://en.wikipedia.org/wiki/Sentence_diagram">sentence diagramming article on wikipedia</a>.  Our sentence above boils down to:</p>
<p>Subject: &#8220;The boy&#8221;<br />
Predicate &amp; Direct object: &#8220;put the box&#8221;<br />
Indirect object: &#8220;in the bag&#8221;</p>
<p>How would you represent that in code? Think about it for a second before continuing.  So, here are the possibilities of how this could be written with a single method call:</p>
<pre>// Subject-Oriented programming:
// "The boy put the box in the bag"
boy.PutIn(box, bag);

// Direct-object oriented programming:
// "The box was put in the bag by the boy"
box.PutIn(bag, boy);

// Indirect-object oriented programming:
// "The bag, to which was added a box, was done by the boy."  OR
// "A bag now has a box that was put there by the boy."
bag.AddTo(box, boy);</pre>
<p>So, which is correct via the principles of OOP?  What&#8217;s the correct place for the method that does the work?  Is it on the Subject of the sentence?  The Direct Object?  Were you taught how to design this?  (i.e. in school?)</p>
<p>In practice, method placement is one of the biggest factors in how maintainable &amp; testable your code is, and code is rarely as simple as what I&#8217;ve shown above.  How do you figure out where the right place for your methods are?</p>
<p>One code base where this was thought about a lot was in Python&#8217;s handling of string &amp; list methods.   The split() and join() methods in Python are both on the string type.  In other words:  The list type is rigid in that its methods contain no string-manipulation.  This seems good at first until you read the code:</p>
<pre>s = "Hello, world"
# Split the string into a list of "Hello" and "world":
l = s.split(',')
# Now, take that resulting list, and join it back together:
j = ','.join(l)</pre>
<p>Wow, that last line looks weird!  What&#8217;s going on there?  We&#8217;re creating a temporary string &#8220;,&#8221; and then calling the join() method!  Weird!  For that last line, I would have much preferred to write:</p>
<pre>j = l.join(',')</pre>
<p>To be symmetric with the original splitting code, but to write things that way would place a string generating method &#8220;join()&#8221; on the list class, which also seems wrong.</p>
]]></content:encoded>
			<wfw:commentRss>http://slacy.com/blog/2010/03/suject-oriented-programming-sop-vs-object-oriented-programming-oop/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
	</item>
		<item>
		<title>If you program, you should watch this.</title>
		<link>http://slacy.com/blog/2010/01/if-you-program-you-should-watch-this/</link>
		<comments>http://slacy.com/blog/2010/01/if-you-program-you-should-watch-this/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 22:11:00 +0000</pubDate>
		<dc:creator>slacy</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[kata]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://slacy.com/blog/?p=1054</guid>
		<description><![CDATA[The video linked below sort of blew my mind. The integration and instant feedback between test &#38; code The notion of &#8220;spec&#8221; (not &#8220;unittest&#8221;) The spliraling nature of the way he writes the code. Here&#8217;s the blog post with the &#8230; <a href="http://slacy.com/blog/2010/01/if-you-program-you-should-watch-this/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The video linked below sort of blew my mind.</p>
<p>The integration and instant feedback between test &amp; code</p>
<p>The notion of &#8220;spec&#8221; (not &#8220;unittest&#8221;)</p>
<p>The spliraling nature of the way he writes the code.</p>
<p><a href="http://katas.softwarecraftsmanship.org/?p=128">Here&#8217;s the blog post with the embedded video, but the embedding size is too small to see what&#8217;s going on.</a></p>
<p><a href="http://vimeo.com/8569257">Here&#8217;s the direct link to the video on Vimeo, which won&#8217;t make too much sense unless you read the blog post first. </a></p>
]]></content:encoded>
			<wfw:commentRss>http://slacy.com/blog/2010/01/if-you-program-you-should-watch-this/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	</item>
		<item>
		<title>Can we all agree that &#8220;Programming Language&#8221; := &#8220;Turing Complete&#8221;</title>
		<link>http://slacy.com/blog/2009/08/can-we-all-agree-that-programming-language-turing-complete/</link>
		<comments>http://slacy.com/blog/2009/08/can-we-all-agree-that-programming-language-turing-complete/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 05:53:55 +0000</pubDate>
		<dc:creator>slacy</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[turing complete]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://slacy.com/blog/?p=912</guid>
		<description><![CDATA[I&#8217;m tired of articles like this one that say things like XML essentially is a programming language that allows users to customize the underlying format of their word-processing documents It peeves me a lot when people refer to things like &#8230; <a href="http://slacy.com/blog/2009/08/can-we-all-agree-that-programming-language-turing-complete/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m tired of articles like <a href="http://blog.seattlepi.com/microsoft/archives/176223.asp">this one</a> that say things like</p>
<blockquote><p>XML essentially is a programming language that allows users to customize the underlying format of their word-processing documents</p></blockquote>
<p>It peeves me a <em>lot</em> when people refer to things like XML and HTML as &#8220;programming languages&#8221; because there&#8217;s no actual programming (i.e. control flow of execution and conditional statements, to start) involved in using them.  They&#8217;re document or data formats, and that&#8217;s it.  HTML is as much a programming language as a typewriter is a computer.</p>
<p>I hereby propose that we stop using the term &#8220;Programming Language&#8221; to refer to anything that&#8217;s not <a href="http://en.wikipedia.org/wiki/Turing_completeness#Examples">turing complete</a>.</p>
<p>We can also <a href="http://www.google.com/search?hl=en&amp;q=%22html+is+a+programming+language%22&amp;aq=f&amp;oq=&amp;aqi=">ask google</a> what it thinks <a href="http://www.google.com/search?hl=en&amp;q=%22xml+is+a+programming+language%22&amp;aq=f&amp;oq=&amp;aqi=">about the matter</a>&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://slacy.com/blog/2009/08/can-we-all-agree-that-programming-language-turing-complete/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
	</item>
		<item>
		<title>Perl in place replacement syntax</title>
		<link>http://slacy.com/blog/2009/05/perl-in-place-replacement-syntax/</link>
		<comments>http://slacy.com/blog/2009/05/perl-in-place-replacement-syntax/#comments</comments>
		<pubDate>Wed, 13 May 2009 20:41:42 +0000</pubDate>
		<dc:creator>slacy</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://slacy.com/blog/2009/05/perl-in-place-replacement-syntax/</guid>
		<description><![CDATA[I always forget how to do this, so I&#8217;m writing it down: perl -pi -e &#8220;s/foo/bar/g&#8221; Is there a way to do this in Python and be as concise? That would be really nice, and would eliminate one more place &#8230; <a href="http://slacy.com/blog/2009/05/perl-in-place-replacement-syntax/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I always forget how to do this, so I&#8217;m writing it down:</p>
<p>perl -pi -e &#8220;s/foo/bar/g&#8221; </p>
<p>Is there a way to do this in Python and be as concise?  That would be really nice, and would eliminate one more place where I end up using Perl and tearing my hair out every time. </p>
]]></content:encoded>
			<wfw:commentRss>http://slacy.com/blog/2009/05/perl-in-place-replacement-syntax/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
	</item>
	</channel>
</rss>

