<?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>Professional PHP &#187; dynamic-typing</title>
	<atom:link href="http://www.procata.com/blog/archives/tag/dynamic-typing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.procata.com/blog</link>
	<description>PHP Programming, Web Development, PHP Advocacy and PHP Best Practices.</description>
	<lastBuildDate>Fri, 10 Dec 2010 17:23:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Comparing PHP with other languages</title>
		<link>http://www.procata.com/blog/archives/2006/02/09/comparing-php-with-other-languages/</link>
		<comments>http://www.procata.com/blog/archives/2006/02/09/comparing-php-with-other-languages/#comments</comments>
		<pubDate>Fri, 10 Feb 2006 02:51:10 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[dynamic-typing]]></category>
		<category><![CDATA[garbage-collection]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[language-comparison]]></category>
		<category><![CDATA[memory-management]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[programming-language]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[static-typing]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/?p=174</guid>
		<description><![CDATA[Chris Shiflett posted some thoughts on PHP and Ruby on Rails which has generated some interesting discussion.  Chris divides programming languages into two categories:

Flexible and powerful: PHP, C, C++, and Perl.
Structured and organized: Java, Ruby, and ASP.NET.

I don&#8217;t disagree with the cultural grouping.  PHP&#8217;s cultural heritage is definitely in the Unix programming, C/Perl [...]]]></description>
			<content:encoded><![CDATA[<p>Chris Shiflett posted some thoughts on <a href="http://shiflett.org/archive/190">PHP and Ruby on Rails</a> which has generated some interesting discussion.  Chris divides programming languages into two categories:</p>
<ul>
<li>Flexible and powerful: PHP, C, C++, and Perl.</li>
<li>Structured and organized: Java, Ruby, and ASP.NET.</li>
</ul>
<p>I don&#8217;t disagree with the cultural grouping.  PHP&#8217;s cultural heritage is definitely in the Unix programming, C/Perl camp as I suggested in <a href="http://www.procata.com/blog/archives/2006/01/13/building-a-culture-of-objects-in-php/">building a culture of objects in PHP</a> and <a href="http://www.procata.com/blog/archives/2005/09/29/why-isnt-php-the-natural-successor-to-java/">Why isn&#8217;t PHP the natural successor to Java?</a></p>
<p>I prefer to group languages in  a different way.</p>
<h4>Garbage Collection</h4>
<p>To me, this is the single biggest language comparison issue.  Managing memory is orthogonal to the task most programmers are trying to accomplish.  Thats a fancy way of saying a waste of time.  Additionally, memory management is easy to screw up.  Any process that relies on humans repeatedly doing something correctly is destined for disappointment.  Sure, there are tools that help avoid memory management bugs.  The best of these is to take it off the programmers plate entirely with garbage collection and let the programmer concentrate on other things.</p>
<p>Sure, there can be resource usage and performance issues.  However, for most cases computer hardware is cheaper than computer programmers.</p>
<p>We can divide our languages along this axis:</p>
<ul>
<li>Quickly runs: PHP, Java, Ruby, C#, Perl, Python, Smalltalk</li>
<li>Runs quickly: C, C++, Objective C, Delphi</li>
</ul>
<p>Interestingly, this corresponds fairly closely with native executable versus virtual machine.</p>
<h4>Static or Dynamic Typing</h4>
<p>The next most important axis of comparison is dynamic or static typing.  In static typing type information is associated with the variable.  In dynamic typing type information is associated with the value in the variable.</p>
<p>The benefit of dynamic typing is that you do not waste programmer time and attention with typecasting (&#8221;static types get in my way&#8221;).  The benefit of static typing is that the compiler can catch certain errors (&#8221;The compiler finds my mistakes&#8221;).</p>
<ul>
<li>Risk tolerant: PHP, Ruby, Python, Smalltalk, Perl</li>
<li>Risk averse: Java, C#</li>
</ul>
<h4>Interactive or Batch</h4>
<p>Some might call this axis interpreted versus compiled.  The issue is how long does it take to switch contexts from coding to running?  Is there a lengthy build process or a deployment stage?  The shorter the build process, the more productive development can be.</p>
<ul>
<li>Interactive: PHP, Ruby</li>
<li>Batch: Java</li>
</ul>
<p>A good example of this in the PHP world is to look at Smarty and Propel.  They both generate code to execute.  Smarty does it interactively, while Propel requires a build process.  The build process is the primary reason I don&#8217;t use Propel.</p>
<h4>Scope</h4>
<p>One should not underestimate the importance of this factor.  Why is Java considered so complicated?  One reason is that it is designed to run on everything from servers to cell phones, from desktops to dishwashers.  It&#8217;s scope is impossibly general.  Of course, specialized tools such as Rails and PHP are more productive for their sweet spot applications.</p>
<ul>
<li>General: Java, .NET</li>
<li>Specific: PHP, Rails</li>
</ul>
<h4>PHP and Ruby on Rails are two peas in a pod</h4>
<p>Looking at these factors so far, PHP and Ruby on Rails are two peas in a pod. Lets start looking at some of the factors where Ruby and PHP begin to diverge.</p>
<h4>Popularity</h4>
<p>Popularity brings better tools, more available developers, better documentation, and better productivity.  Programming on a discontinued or rarely used platform is more difficult.</p>
<ul>
<li>Popular: PHP, .NET, Java</li>
<li>Rare: Python, Ruby, Smalltalk</li>
</ul>
<h4>Abstraction</h4>
<p>Working at a higher level of abstraction allows the programmer to be more productive.  The computer industry has continuously been heading up the abstraction scale without looking back.  Professional programmers want to work with higher level constructs because they are more expressive.  One can get more done with less code.  The draw back is that higher level language features can require more programmer skill to use well.  </p>
<ul>
<li>Simple: PHP, C, Java</li>
<li>Powerful: Ruby, Smalltalk, Lisp</li>
</ul>
<p>I&#8217;m talking about the language, not the libraries when I classify Java as simple.  Dynamic versus static typing aside, I see the Java and PHP languages as similarly expressive.</p>
<p>I have alot of respect for <a href="http://en.wikipedia.org/wiki/Anders_Hejlsberg">Anders Hejlsberg</a> and there is some serious innovation going on in the C# world on this front.  Java can barely keep up.</p>
<p>The Rails folks are fond of saying that Rails couldn&#8217;t be written without the expressive features of the Ruby language.  It would be interesting to get the opinions of some of the cake developers on this idea.</p>
<h4>Library Organization</h4>
<p>Not my favorite part of PHP.</p>
<ul>
<li>Function oriented: C, PHP</li>
<li>Object oriented: Java, .Net, Python, Ruby</li>
</ul>
<h4>Stiffies?</h4>
<p>I think Ruby is misclassified when placed with Java and C#.  Ruby is closer to PHP than it is to either Java or C#.  Rails and PHP share most of the same sources of productivity: garbage collection, dynamic typing, interactivity, and focus on web applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2006/02/09/comparing-php-with-other-languages/feed/</wfw:commentRss>
		<slash:comments>43</slash:comments>
		</item>
		<item>
		<title>The Evolution of Design Patterns</title>
		<link>http://www.procata.com/blog/archives/2006/01/31/the-evolution-of-design-patterns/</link>
		<comments>http://www.procata.com/blog/archives/2006/01/31/the-evolution-of-design-patterns/#comments</comments>
		<pubDate>Tue, 31 Jan 2006 18:59:22 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Agile Methods]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Design]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[design-patterns]]></category>
		<category><![CDATA[dynamic-typing]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/?p=172</guid>
		<description><![CDATA[Rebecca Wirfs-Brock suggests that it may be time for the GoF Design Patterns book to be refreshed.  She points out that the C++ and graphics programming examples may be less relevant to today&#8217;s C# and Java programmers.  She implies that state of the art has advanced in the twelve years since the book [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.wirfs-brock.com/2006/01/pattern-drift.html">Rebecca Wirfs-Brock suggests</a> that it may be time for the GoF <a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&#038;tag=procata&#038;camp=1789&#038;creative=9325&#038;path=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fproduct%2F0201633612%2Fqid%3D1138731933%2Fsr%3D2-1%2Fref%3Dpd_bbs_b_2_1%3Fs%3Dbooks%26v%3Dglance%26n%3D283155">Design Patterns</a> book to be refreshed.  She points out that the C++ and graphics programming examples may be less relevant to today&#8217;s C# and Java programmers.  She implies that state of the art has advanced in the twelve years since the book was written.  She also suggests that the GoF authors may have made some of the wrong tradeoffs when they specified some of the patterns.  </p>
<p>I know I would like to see an update to this groundbreaking work with more modern interpretations of what have become the canonical patterns.</p>
<p>Rebecca talks about how the interface type has come to replace the C++ abstract class.  One area that I am interested in is how <a href="http://en.wikipedia.org/wiki/Duck_typing">Duck typing</a> may replace the interface construct in many of the classic patterns.  I&#8217;m not sure that patterns intended for statically typed languages such as C++ and java necessarily have the same implementation in dynamically typed languages, such as smalltalk, Ruby and of course, PHP.</p>
<p>For the last few weeks, I&#8217;ve been doing an interesting educational exercise. I&#8217;ve been simultaneously reading <a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&#038;tag=procata&#038;camp=1789&#038;creative=9325&#038;path=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fproduct%2F0201633612%2Fqid%3D1138731933%2Fsr%3D2-1%2Fref%3Dpd_bbs_b_2_1%3Fs%3Dbooks%26v%3Dglance%26n%3D283155">Design Patterns</a>, <a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&#038;tag=procata&#038;camp=1789&#038;creative=9325&#038;path=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fproduct%2F0201485672%2Fqid%3D1138732395%2Fsr%3D2-1%2Fref%3Dpd_bbs_b_2_1%3Fs%3Dbooks%26v%3Dglance%26n%3D283155">Refactoring</a>, <a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&#038;tag=procata&#038;camp=1789&#038;creative=9325&#038;path=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fproduct%2F0321213351%2Fqid%3D1138732395%2Fsr%3D2-2%2Fref%3Dpd_bbs_b_2_2%3Fs%3Dbooks%26v%3Dglance%26n%3D283155">Refactoring to Patterns</a>, and <a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&#038;tag=procata&#038;camp=1789&#038;creative=9325&#038;path=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fproduct%2F0135974445%2Fqid%3D1138732599%2Fsr%3D2-1%2Fref%3Dpd_bbs_b_2_1%3Fs%3Dbooks%26v%3Dglance%26n%3D283155">Agile Software Development</a>.  I&#8217;m finding the cross-referencing between each of these highly complementary books to be be educational.  I&#8217;m hoping to add <a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&#038;tag=procata&#038;camp=1789&#038;creative=9325&#038;path=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fproduct%2F0201184621%2Fref%3Dwl_it_dp%3F%255Fencoding%3DUTF8%26colid%3D340RCXJY0586F%26coliid%3DISXN6HUYWJS3O%26v%3Dglance%26n%3D283155">Design Patterns Smalltalk Companion</a> and <a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&#038;tag=procata&#038;camp=1789&#038;creative=9325&#038;path=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fproduct%2F0973589825%2Fqid%3D1138732845%2Fsr%3D1-1%2Fref%3Dsr_1_1%3Fs%3Dbooks%26v%3Dglance%26n%3D283155">PHP|Architect&#8217;s Guide to PHP Design Patterns</a> (<a href="http://blog.casey-sweat.us/">Jason Sweat&#8217;s</a> book) to get a more dynamic perspective in the mix.  This is my reading project for the next few months.</p>
<p>That 10 years after first reading the Design Patterns book, i am still studying from it shows how much of a classic this book has become.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2006/01/31/the-evolution-of-design-patterns/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

