<?xml version="1.0" encoding="UTF-8"?><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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHPundamentals Series: A Background on Statics (Part 1 on Statics)</title>
	<atom:link href="http://ralphschindler.com/2010/05/06/phpundamentals-series-a-background-on-statics-part-1-on-statics/feed" rel="self" type="application/rss+xml" />
	<link>http://ralphschindler.com/2010/05/06/phpundamentals-series-a-background-on-statics-part-1-on-statics</link>
	<description>Ralph Schindler</description>
	<lastBuildDate>Thu, 24 Nov 2011 17:44:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: phpcurious</title>
		<link>http://ralphschindler.com/2010/05/06/phpundamentals-series-a-background-on-statics-part-1-on-statics/comment-page-1#comment-53176</link>
		<dc:creator>phpcurious</dc:creator>
		<pubDate>Fri, 04 Nov 2011 18:45:22 +0000</pubDate>
		<guid isPermaLink="false">http://ralphschindler.com/?p=86#comment-53176</guid>
		<description>Great article, when are you going to publish the follow up? Any solution on how to remedy the issue posed by PHP architecture?</description>
		<content:encoded><![CDATA[<p>Great article, when are you going to publish the follow up? Any solution on how to remedy the issue posed by PHP architecture?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dirk Louwers</title>
		<link>http://ralphschindler.com/2010/05/06/phpundamentals-series-a-background-on-statics-part-1-on-statics/comment-page-1#comment-10418</link>
		<dc:creator>Dirk Louwers</dc:creator>
		<pubDate>Tue, 19 Oct 2010 08:25:30 +0000</pubDate>
		<guid isPermaLink="false">http://ralphschindler.com/?p=86#comment-10418</guid>
		<description>&quot;If you need to persist state – whether it’s data, objects, or whatever – then persist it correctly. Use MySql, or Sqlite, or memcached, or CouchDB, or who cares.&quot;

I couldn&#039;t disagree more. Apart from the quirky UTF support in PHP5 the lack of a true application scope is something I miss most! In most of my applications there is plenty of data that is already properly persisted, like in a configuration file or annotations for instance. Often parsing this data on a per request basis is unacceptable from a performance standpoint. Serializing this data alleviates the pain somewhat but still carries a performance penalty. The best solution I&#039;ve found so far is translating such data to PHP classes so that in combination with an opcode cache the data can be made available as quickly as possible, but this is by far more contrived than using application scope for this. Just my two cents.</description>
		<content:encoded><![CDATA[<p>&#8220;If you need to persist state – whether it’s data, objects, or whatever – then persist it correctly. Use MySql, or Sqlite, or memcached, or CouchDB, or who cares.&#8221;</p>
<p>I couldn&#8217;t disagree more. Apart from the quirky UTF support in PHP5 the lack of a true application scope is something I miss most! In most of my applications there is plenty of data that is already properly persisted, like in a configuration file or annotations for instance. Often parsing this data on a per request basis is unacceptable from a performance standpoint. Serializing this data alleviates the pain somewhat but still carries a performance penalty. The best solution I&#8217;ve found so far is translating such data to PHP classes so that in combination with an opcode cache the data can be made available as quickly as possible, but this is by far more contrived than using application scope for this. Just my two cents.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giorgio Sironi</title>
		<link>http://ralphschindler.com/2010/05/06/phpundamentals-series-a-background-on-statics-part-1-on-statics/comment-page-1#comment-4527</link>
		<dc:creator>Giorgio Sironi</dc:creator>
		<pubDate>Sat, 08 May 2010 10:03:58 +0000</pubDate>
		<guid isPermaLink="false">http://ralphschindler.com/?p=86#comment-4527</guid>
		<description>I disagree with calling &#039;static&amp;global&#039; what is really an application scope. :)
The important difference is between the shared-nothing architecture of PHP applications and the shared application scope of a Java Servlet application, but there&#039;s nothing inherently static in them.
In fact, a good rule to see if you&#039;re doing things right is the ability to run two identical applications in the same JVM. Global [variables] are hidden dependencies; static [variables, method, classes] are similarly hidden dependencies.
An example of this is Zend Framework&#039;s Zend_Test component, which because of the singletons usage for sessions and front controller, has to reset the various components manually between tests, instead of simply creating a new application object.</description>
		<content:encoded><![CDATA[<p>I disagree with calling &#8216;static&amp;global&#8217; what is really an application scope. <img src='http://ralphschindler.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
The important difference is between the shared-nothing architecture of PHP applications and the shared application scope of a Java Servlet application, but there&#8217;s nothing inherently static in them.<br />
In fact, a good rule to see if you&#8217;re doing things right is the ability to run two identical applications in the same JVM. Global [variables] are hidden dependencies; static [variables, method, classes] are similarly hidden dependencies.<br />
An example of this is Zend Framework&#8217;s Zend_Test component, which because of the singletons usage for sessions and front controller, has to reset the various components manually between tests, instead of simply creating a new application object.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George Mauer</title>
		<link>http://ralphschindler.com/2010/05/06/phpundamentals-series-a-background-on-statics-part-1-on-statics/comment-page-1#comment-4490</link>
		<dc:creator>George Mauer</dc:creator>
		<pubDate>Sat, 08 May 2010 01:03:27 +0000</pubDate>
		<guid isPermaLink="false">http://ralphschindler.com/?p=86#comment-4490</guid>
		<description>Ok, I&#039;ll bite...

You deserve a berating for not mentioning the biggest thing about statics: (public) statics have no limitations on visibility.  Fully allowing that I might be missing something, but statics in PHP are conceptually equivalent to global variables. Presumably you&#039;re going to argue that that is not necessarily bad - and from a memory management perspective you&#039;re right.  From a making-your-application-maintainable perspective globals - as you know - are a nightmare.  Especially since its usually perfectly possible to limit the scope of your variables.  Heck, with the shared-nothing thing, I&#039;ve never quite understood why php went head-first into OO, a functional paradigm with tight immutability rules seems like a much better fit. 

Now, regarding Java/.Net - statics are generally allowable only in situations where you do not persist state such as helper methods or DSLs.  Even there they are discouraged.  The only place I would ever see a static state in a well-constructed C# application (stupid ASP.Net framework nonsense aside) is when using a Service Locator - and even that I&#039;m generally uncomfortable with as there is almost always a better way. 

If you need to persist state - whether it&#039;s data, objects, or whatever - then persist it correctly. Use MySql, or Sqlite, or memcached, or CouchDB, or who cares.  Statics are a tempting way to do it, but its way too easy to get into trouble with them.  Yes, the fact that PHP limits them to the scope of the request limits their damage potential but reading your average PHP code is difficult enough - please don&#039;t recommend people to make it harder.</description>
		<content:encoded><![CDATA[<p>Ok, I&#8217;ll bite&#8230;</p>
<p>You deserve a berating for not mentioning the biggest thing about statics: (public) statics have no limitations on visibility.  Fully allowing that I might be missing something, but statics in PHP are conceptually equivalent to global variables. Presumably you&#8217;re going to argue that that is not necessarily bad &#8211; and from a memory management perspective you&#8217;re right.  From a making-your-application-maintainable perspective globals &#8211; as you know &#8211; are a nightmare.  Especially since its usually perfectly possible to limit the scope of your variables.  Heck, with the shared-nothing thing, I&#8217;ve never quite understood why php went head-first into OO, a functional paradigm with tight immutability rules seems like a much better fit. </p>
<p>Now, regarding Java/.Net &#8211; statics are generally allowable only in situations where you do not persist state such as helper methods or DSLs.  Even there they are discouraged.  The only place I would ever see a static state in a well-constructed C# application (stupid ASP.Net framework nonsense aside) is when using a Service Locator &#8211; and even that I&#8217;m generally uncomfortable with as there is almost always a better way. </p>
<p>If you need to persist state &#8211; whether it&#8217;s data, objects, or whatever &#8211; then persist it correctly. Use MySql, or Sqlite, or memcached, or CouchDB, or who cares.  Statics are a tempting way to do it, but its way too easy to get into trouble with them.  Yes, the fact that PHP limits them to the scope of the request limits their damage potential but reading your average PHP code is difficult enough &#8211; please don&#8217;t recommend people to make it harder.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ralph Schindler</title>
		<link>http://ralphschindler.com/2010/05/06/phpundamentals-series-a-background-on-statics-part-1-on-statics/comment-page-1#comment-4343</link>
		<dc:creator>Ralph Schindler</dc:creator>
		<pubDate>Thu, 06 May 2010 20:07:24 +0000</pubDate>
		<guid isPermaLink="false">http://ralphschindler.com/?p=86#comment-4343</guid>
		<description>Hey Bruce, I basically mean &quot;Do you not get how they work?&quot;.  The point of this article is to fully understand the scope of static members.  Originally, this article was much longer, but when I realized how long this way, I decided to make a series of them.  This is just a background article.  The next articles will attempt to describe the persistence problem we have in PHP, look at the solutions.. then move into the &quot;static argument&quot; - what are they good for? Are they really as evil as globals? And, of course, we&#039;ve all heard the expression: &quot;Singletons are evil, never use them..&quot;, we&#039;ll discuss where that argument came from and how it applies to PHP.

Hopefully you&#039;ll stay tuned, I&#039;ll try to deliver the point in a few days- I am just laying some ground work.

-ralph</description>
		<content:encoded><![CDATA[<p>Hey Bruce, I basically mean &#8220;Do you not get how they work?&#8221;.  The point of this article is to fully understand the scope of static members.  Originally, this article was much longer, but when I realized how long this way, I decided to make a series of them.  This is just a background article.  The next articles will attempt to describe the persistence problem we have in PHP, look at the solutions.. then move into the &#8220;static argument&#8221; &#8211; what are they good for? Are they really as evil as globals? And, of course, we&#8217;ve all heard the expression: &#8220;Singletons are evil, never use them..&#8221;, we&#8217;ll discuss where that argument came from and how it applies to PHP.</p>
<p>Hopefully you&#8217;ll stay tuned, I&#8217;ll try to deliver the point in a few days- I am just laying some ground work.</p>
<p>-ralph</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rafaelxy</title>
		<link>http://ralphschindler.com/2010/05/06/phpundamentals-series-a-background-on-statics-part-1-on-statics/comment-page-1#comment-4335</link>
		<dc:creator>rafaelxy</dc:creator>
		<pubDate>Thu, 06 May 2010 19:07:04 +0000</pubDate>
		<guid isPermaLink="false">http://ralphschindler.com/?p=86#comment-4335</guid>
		<description>Great article, I&#039;m looking forward to read the next one =)</description>
		<content:encoded><![CDATA[<p>Great article, I&#8217;m looking forward to read the next one =)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruce Weirdan</title>
		<link>http://ralphschindler.com/2010/05/06/phpundamentals-series-a-background-on-statics-part-1-on-statics/comment-page-1#comment-4334</link>
		<dc:creator>Bruce Weirdan</dc:creator>
		<pubDate>Thu, 06 May 2010 18:56:35 +0000</pubDate>
		<guid isPermaLink="false">http://ralphschindler.com/?p=86#comment-4334</guid>
		<description>&gt; Still don’t get it?
Don&#039;t get what exactly? What is the point you&#039;re trying to drive home?</description>
		<content:encoded><![CDATA[<p>&gt; Still don’t get it?<br />
Don&#8217;t get what exactly? What is the point you&#8217;re trying to drive home?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mandi</title>
		<link>http://ralphschindler.com/2010/05/06/phpundamentals-series-a-background-on-statics-part-1-on-statics/comment-page-1#comment-4326</link>
		<dc:creator>Mandi</dc:creator>
		<pubDate>Thu, 06 May 2010 18:13:12 +0000</pubDate>
		<guid isPermaLink="false">http://ralphschindler.com/?p=86#comment-4326</guid>
		<description>Very good starting article! Can&#039;t wait to see how the series of these articles continues :)</description>
		<content:encoded><![CDATA[<p>Very good starting article! Can&#8217;t wait to see how the series of these articles continues <img src='http://ralphschindler.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Bruce</title>
		<link>http://ralphschindler.com/2010/05/06/phpundamentals-series-a-background-on-statics-part-1-on-statics/comment-page-1#comment-4324</link>
		<dc:creator>Kevin Bruce</dc:creator>
		<pubDate>Thu, 06 May 2010 17:06:52 +0000</pubDate>
		<guid isPermaLink="false">http://ralphschindler.com/?p=86#comment-4324</guid>
		<description>Thanks for this article. Having really only worked in PHP, it&#039;s good to know the differences between the major web languages. It explains allot about how we, as PHP developers&quot; have to &quot;fake&quot; a persistent state with sessions, cookies and database storage in order to have a consistent state on a visitor&#039;s return visit.</description>
		<content:encoded><![CDATA[<p>Thanks for this article. Having really only worked in PHP, it&#8217;s good to know the differences between the major web languages. It explains allot about how we, as PHP developers&#8221; have to &#8220;fake&#8221; a persistent state with sessions, cookies and database storage in order to have a consistent state on a visitor&#8217;s return visit.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: [ this is jerry ]</title>
		<link>http://ralphschindler.com/2010/05/06/phpundamentals-series-a-background-on-statics-part-1-on-statics/comment-page-1#comment-4320</link>
		<dc:creator>[ this is jerry ]</dc:creator>
		<pubDate>Thu, 06 May 2010 16:34:12 +0000</pubDate>
		<guid isPermaLink="false">http://ralphschindler.com/?p=86#comment-4320</guid>
		<description>Great article, Ralph. Thanks for educating us.

What I always find interesting is how individual coders solve issues that arrise because of this.  For example, MaxMind uses shared memory (http://geolite.maxmind.com/download/geoip/api/php/).</description>
		<content:encoded><![CDATA[<p>Great article, Ralph. Thanks for educating us.</p>
<p>What I always find interesting is how individual coders solve issues that arrise because of this.  For example, MaxMind uses shared memory (<a href="http://geolite.maxmind.com/download/geoip/api/php/" rel="nofollow">http://geolite.maxmind.com/download/geoip/api/php/</a>).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

