<?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; shared-nothing</title>
	<atom:link href="http://www.procata.com/blog/archives/tag/shared-nothing/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>PHP Development From Java Architects Eye</title>
		<link>http://www.procata.com/blog/archives/2005/04/23/php-development-from-java-architects-eye/</link>
		<comments>http://www.procata.com/blog/archives/2005/04/23/php-development-from-java-architects-eye/#comments</comments>
		<pubDate>Sat, 23 Apr 2005 18:04:02 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[language-comparison]]></category>
		<category><![CDATA[performance-optimization]]></category>
		<category><![CDATA[shared-nothing]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2005/04/23/php-development-from-java-architects-eye/</guid>
		<description><![CDATA[Simple Thoughts blog has a post on PHP development from a Java architects eyes.  This post highlights the paradigm difference between programming in PHP and programming in Java:

In PHP multi-threaded programming using ticks is rather primitive, to put it politely. I couldn&#8217;t find any way to share data between multiple invocations of the script, [...]]]></description>
			<content:encoded><![CDATA[<p>Simple Thoughts blog has a post on <a href="http://blog.taragana.com/index.php/archive/php-development-from-java-architects-eye/">PHP development from a Java architects eyes</a>.  This post highlights the paradigm difference between programming in PHP and programming in Java:</p>
<blockquote><p>
In PHP multi-threaded programming using ticks is rather primitive, to put it politely. I couldn&#8217;t find any way to share data between multiple invocations of the script, without resorting to file or SQL. I missed saving in servlet context and singletons (evil!).
</p></blockquote>
<blockquote><p>
I however kept looking for a uber-global which will allow me to persist data across sessions.
</p></blockquote>
<blockquote><p>
I couldn&#8217;t find simple way to cache data in PHP. File or DB based caching was unattractive to me.
</p></blockquote>
<p>This pretty much sums up the fundamental difference.  PHP shuns threads in favor of simplicity and relies on files and databases to &#8220;share data between multiple invocations of the script.&#8221;  The author doesn&#8217;t make this paradigm shift and erroneously implies that PHP is not scalable.  At the same time, he offers this insight into the mindset of Java programmers:</p>
<blockquote><p>
I think it is because Java think-tank wants to encourage programming with resource constraints in mind. remember Java had an Oak background, a language targeted for limited resource devices.</p>
<p>The sad part is that most Java developers get bogged down by such trivialities and cannot see the forest for trees. I know, I know you are an exception.</p>
<p>Most of the time you hear Java programmers thinking of scalability and performance when his PHP counterparts are happily coding away in a world with unlimited resources (they think). Unfortunately Java developers as a group tend to get bogged down with resource conservation mindset.
</p></blockquote>
<p>There is a name for this.  It is called premature optimization.  And it often leads to code that is slower and less scalable.  <a href="http://www.procata.com/blog/archives/2004/06/30/php-scalability-and-perforamnce/">Scalable applications can be written in PHP</a>.  One just uses a different set of patterns to write them in PHP than in Java.</p>
<p>Speaking of mindset&#8230;</p>
<blockquote><p>
Overall a large part of the difference is in the mindset of a Java and PHP developer. How do you perform SQL queries in PHP? You just create a SQL statement string in code concatenating proper parameters as necessary.</p>
<p>Tell that to a Java programmers worth his salt. If he doesn&#8217;t half-die in shock, I would be surprised. &#8230; At the very least he must stow away his SQL code in a separate class and use the functionality by invoking methods in that object.
</p></blockquote>
<p>PHP pitches a large tent.  There are many amateur and professional programmers using PHP.  I don&#8217;t know many of the professionals using this technique.  Most people I know are using a data base abstraction library, such as PEAR:DB, PEAR:MDB2, or ADODB, Creole or perhaps even PDO.</p>
<p>The interesting thing is that some of the most popular PHP applications are not the ones that I would point to and tell people &#8220;this is a good example of programming in PHP.&#8221;  I won&#8217;t name names, but I would hate for people to form their opinions about PHP solely on the design of these applications.</p>
<p>I got my first paid full time programming job over the summer when I was 17 and worked as a full time professional programmer during all but two years of my college career.  Eventually I came to a realization that caused me to change my major from computer science to business.  That realization was that project success has far more to do with how closely your software meets requirements than how technically advanced it is.  I have personally witnessed far more &#8220;high architecture&#8221; projects that never finished or met the users needs than &#8220;low architecture&#8221; projects that couldn&#8217;t be made to scale when necessary.</p>
<p>That is why software built by their users, such as many visible PHP projects are, can be very successful.  They do exactly what the users would want them to do.  Then we professional programmers look under the hood and and turn a little green. However, sometimes <a href="http://www.sitepoint.com/forums/showthread.php?t=155043">worse is better</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2005/04/23/php-development-from-java-architects-eye/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>

