<?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"
	>

<channel>
	<title>Professional PHP &#187; WACT</title>
	<atom:link href="http://www.procata.com/blog/archives/category/wact/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>
	<pubDate>Tue, 27 May 2008 05:57:30 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Delicious Outage Link Dump</title>
		<link>http://www.procata.com/blog/archives/2005/12/19/delicious-outage-link-dump/</link>
		<comments>http://www.procata.com/blog/archives/2005/12/19/delicious-outage-link-dump/#comments</comments>
		<pubDate>Mon, 19 Dec 2005 18:21:53 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[Agile Methods]]></category>

		<category><![CDATA[Misc]]></category>

		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Software Design]]></category>

		<category><![CDATA[Usability]]></category>

		<category><![CDATA[WACT]]></category>

		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/?p=168</guid>
		<description><![CDATA[Del.icio.us has been down for a while.  I use it for my public bookmarks, which are listed on the side of this blog.  Here is a post with some recent random things that I would bookmark if I could.

The departure of the hyper-enthusiasts - &#8220;The Java hyper-enthusiasts have left the building&#8221;  (along [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.del.icio.us/blog/2005/12/continued_hiccu.html">Del.icio.us has been down</a> for a while.  I use it for my public bookmarks, which are listed on the side of this blog.  Here is a post with some recent random things that I would bookmark if I could.</p>
<ul>
<li><a href="http://www.artima.com/weblogs/viewpost.jsp?thread=141312">The departure of the hyper-enthusiasts</a> - &#8220;The Java hyper-enthusiasts have left the building&#8221;  (along the lines of <a href="http://www.procata.com/blog/archives/2005/09/29/why-isnt-php-the-natural-successor-to-java/">this</a>.)</li>
<li><a href="http://martinfowler.com/articles/newMethodology.html">The New Methodology</a> - Martin Fowler describes Agile methodologies &#8212; recently updated.</li>
<li><a href="http://wiki.caucho.com/PHP_Hello_World">PHP on Caucho</a> - PHP on the JVM.</li>
<li><a href="http://norman.walsh.name/2004/11/10/xml20">XML 2.0</a> - some thoughts on XML 2.0.</li>
<li><a href="http://www.webpatterns.org/">Web Patterns</a> - Under construction &#8212; check back later.</li>
<li><a href="http://www.welie.com/patterns/">Web Design Patterns</a>.</li>
<li><a href="http://www.agilealliance.org/resources/carnivaloftheagilists">Carnival of the Agilists</a>.</li>
</ul>
<p>I&#8217;m currently adding UTF-8 support to and generally improving WACT&#8217;s &#8220;liberal&#8221; xml/html parser.  A few sources of tests cases and information:</p>
<ul>
<li><a href="http://weblog.philringnalda.com/2005/12/18/who-knows-a-title-from-a-hole-in-the-ground">Who knows a title from a hole in the ground?</a></li>
<li><a href="http://decafbad.com/blog/2005/12/19/feedburner-feeds-give-heartburn-to-php-xml-parsers">FeedBurner feeds give heartburn to PHP XML parsers?</a></li>
<li><a href="http://www.is-thought.co.uk/book/home.htm">Web SGML and HTML 4.0 explained</a></li>
<li><a href="http://www.flightlab.com/~joe/sgml/cdata.html">CDATA confusion</a></li>
<li><a href="http://www.flightlab.com/~joe/sgml/comments.html">Comment syntax in SGML and HTML</a></li>
<li><a href="http://www.cs.tut.fi/~jkorpela/html/empty.html">Empty elements in SGML, HTML, XML, and XHTML</a></li>
<li><a href="http://www.w3.org/TR/NOTE-sgml-xml.html">Comparison of SGML and XML</a></li>
<li><a href="http://www.w3.org/XML/Test/">Extensible Markup Language (XML) Conformance Test Suites</a></li>
<li><a href="http://www.hixie.ch/tests/adhoc/html/parsing/">Ian Hixie&#8217;s HTML parsing test cases</a></li>
<li><a href="http://xmlconf.sourceforge.net/">Conformance Testing for XML and Related Technologies</a></li>
<li><a href="http://feedparser.org/">Universal Feed Parser</a> liberal feed parser with many test cases.</li>
<li><a href="http://schneegans.de/sv/test-cases/">XHTML test cases</a></li>
</ul>
<ul>
<li><a href="http://www.cl.cam.ac.uk/~mgk25/unicode.html">UTF-8 and Unicode FAQ for Unix/Linux</a></li>
<li><a href="http://www.w3.org/2001/06/utf-8-wrong/">bad UTF-8 test files</a></li>
<li><a href="http://validator.w3.org/dev/tests/">The W3C Markup Validation Service: Tests</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2005/12/19/delicious-outage-link-dump/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP Framework Consolidation?</title>
		<link>http://www.procata.com/blog/archives/2005/11/27/php-framework-consolidation/</link>
		<comments>http://www.procata.com/blog/archives/2005/11/27/php-framework-consolidation/#comments</comments>
		<pubDate>Mon, 28 Nov 2005 03:55:09 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[WACT]]></category>

		<category><![CDATA[ezcomponents]]></category>

		<category><![CDATA[php-frameworks]]></category>

		<category><![CDATA[zend-framework]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/?p=162</guid>
		<description><![CDATA[There is recent interest in consolidating Java frameworks with similar approaches.  WebWork is joining Struts, which surprised me.  Along the same lines, the Java Web Alignment group brings together many big players in the Java framework space:

The Java web framework landscape has become quite fragmented; the purpose of this group is to explore [...]]]></description>
			<content:encoded><![CDATA[<p>There is recent interest in consolidating Java frameworks with similar approaches.  <a href="http://blogs.opensymphony.com/webwork/2005/11/webwork_joining_struts.html">WebWork is joining Struts</a>, which surprised me.  Along the same lines, the <a href="http://opensource2.atlassian.com/confluence/oss/display/WAG/Home">Java Web Alignment group</a> brings together many big players in the Java framework space:</p>
<blockquote><p>
The Java web framework landscape has become quite fragmented; the purpose of this group is to explore synergies among the existing frameworks that will make life easier for companies, organizations, and developers working using Java to build web applications.
</p></blockquote>
<p>A reaction to Rails?</p>
<p>As I suggested in <a href="http://www.procata.com/blog/archives/2004/11/28/the-value-of-mvc/">The Value of MVC</a>, the science of writing web applications is maturing and we are entering the age of frameworks.</p>
<p>Will there be a similar consolidation of PHP Frameworks?  Or will Zend PHP Framework rule them all? eZ systems for one isn&#8217;t conceding just yet and continues with their <a href="http://ez.no/company/news/ez_publish_enterprise_components">eZ publish Enterprise Components</a>.  I expect other to do the same.  We shall see.</p>
<p>Every once and a while I get an odd email from someone I have never heard of suggesting that <a href="http://www.phpwact.org/">WACT</a> should merge with project X.  The messages are usually poorly thought out and slightly insulting and never from anyone actually involved with either project X or WACT, but I certainly wouldn&#8217;t oppose such a thing if it made sense and there was some interest and synergy from the other party.  Unfortunately, the fact that WACT 1.0 will support currently installed versions of PHP (meaning 4.x) is probably a deal breaker for the kinds of people who are interested in writing frameworks.  After WACT 1.0 is out (Q1 2006) I would like to skip PHP 5 and target PHP 6 for WACT 2.0. (Other WACT stakeholders may have different ideas.)  The framework landscape will probably be different then.  And there is one other framework I&#8217;ve been keeping an eye on &#8230;. <img src='http://www.procata.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2005/11/27/php-framework-consolidation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing PEAR Based Applications</title>
		<link>http://www.procata.com/blog/archives/2005/04/19/installing-pear-based-applications/</link>
		<comments>http://www.procata.com/blog/archives/2005/04/19/installing-pear-based-applications/#comments</comments>
		<pubDate>Wed, 20 Apr 2005 05:05:40 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[WACT]]></category>

		<category><![CDATA[pear-installer]]></category>

		<category><![CDATA[php-deployment]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2005/04/19/installing-pear-based-applications/</guid>
		<description><![CDATA[Ok, Greg Beaver&#8217;s work on channels has resurrected my interest in PEAR.  I am interested in providing WACT on a PEAR channel and I&#8217;d like to better integrate WACT with some PEAR packages.  My primary concern is over the installation implications.
I didn&#8217;t find a &#8220;powered by PEAR&#8221; section on the PEAR website.  [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, Greg Beaver&#8217;s work on <a href="http://greg.chiaraquartet.net/archives/38-doing-the-PEAR-thing.html">channels</a> has resurrected my interest in PEAR.  I am interested in providing WACT on a PEAR channel and I&#8217;d like to better integrate WACT with some PEAR packages.  My primary concern is over the <a href="http://www.procata.com/blog/archives/2004/11/24/installing-web-applications/">installation implications</a>.</p>
<p>I didn&#8217;t find a &#8220;powered by PEAR&#8221; section on the PEAR website.  Can anyone recommend some large, widely deployed end user oriented applications based on PEAR? I want to try going through the installation process in some challenging environments.  I&#8217;m just trying to get a feel for best practices and potential problems with installing PEAR and applications that depend on PEAR.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2005/04/19/installing-pear-based-applications/feed/</wfw:commentRss>
		</item>
		<item>
		<title>php testing and coverage</title>
		<link>http://www.procata.com/blog/archives/2005/04/08/php-testing-and-coverage/</link>
		<comments>http://www.procata.com/blog/archives/2005/04/08/php-testing-and-coverage/#comments</comments>
		<pubDate>Fri, 08 Apr 2005 15:18:30 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[Agile Methods]]></category>

		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[WACT]]></category>

		<category><![CDATA[code-coverage]]></category>

		<category><![CDATA[simple-test]]></category>

		<category><![CDATA[unit-testing]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2005/04/08/php-testing-and-coverage/</guid>
		<description><![CDATA[I ran across this O&#8217;Reily article about SpikeSource today.  Very interesting.
They have released a coverage reporting tool, Spike PHP Coverage, for PHP that works with XDebug coverage data.  It works with Simple Test and it seems to be able aggregate the results of remote test runs, such as for web based tests.  [...]]]></description>
			<content:encoded><![CDATA[<p>I ran across <a href="http://www.oreillynet.com/pub/a/network/2005/04/07/spikesource.html">this O&#8217;Reily article</a> about <a href="http://www.spikesource.com/">SpikeSource</a> today.  Very interesting.</p>
<p>They have released a coverage reporting tool, <a href="http://www.spikesource.com/projects/phpcoverage/">Spike PHP Coverage</a>, for PHP that works with XDebug coverage data.  It works with Simple Test and it seems to be able aggregate the results of remote test runs, such as for web based tests.  I have wanted something exactly like this.  I can&#8217;t wait to get the chance to generate a consolidated coverage report for WACT.</p>
<p>It seems that they have the capability for generating and aggregating code <a href="http://www.spikesource.com/testresults.log/fedora-1-i386/1440/oss/comp/web/php5/test/coverage/coveragereport.txt">coverage reports</a> for <a href="http://www.spikesource.com/testresults/index.jsp?show=component-results&#038;category=all&#038;comp-id=65726#pkgtest">PHP</a> itself.  I haven&#8217;t had a chance to check this out, but its something that I have always wondered about.</p>
<p>Additionally, it looks like they accept <a href="http://www.spikesource.com/testupload/help_upload.php">contributions of Test Suites</a>.  If I understand this correctly, it means that I can upload the WACT test suite and that it can be used to test and generate coverage reports for PHP 4 and for PHP 5 as well as the framework.  If this is true, this is a big deal.  As there are more and more applications with automated test suites, it only makes sense to aggregate them to test PHP itself.</p>
<p>It also seems that they have embraced <a href="http://www.lastcraft.com/simple_test.php">Simple Test</a> for php testing.  Congratulations, <a href="http://www.lastcraft.com/blog/">Marcus</a>.  Simple Test is a fine piece of software.</p>
<p>I think code coverage measurements are important for gauging the quality of a test suite on open source projects, where there can be less formal development practices and a large number of contributers of varying skill levels and motivation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2005/04/08/php-testing-and-coverage/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Status of WACT</title>
		<link>http://www.procata.com/blog/archives/2004/10/25/status-of-wact/</link>
		<comments>http://www.procata.com/blog/archives/2004/10/25/status-of-wact/#comments</comments>
		<pubDate>Mon, 25 Oct 2004 21:33:42 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[WACT]]></category>

		<category><![CDATA[mvc]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2004/10/25/status-of-wact/</guid>
		<description><![CDATA[My last WACT post drew a couple questions from Marcus Baker:

Do you have a release date planned for the next version?

Ah, the release date question.  We are certainly overdue.  Here is where things stand.
The core framework in CVS is in very good shape.  We have 3332 passing tests and 5 failing tests. [...]]]></description>
			<content:encoded><![CDATA[<p>My last <a href="http://www.procata.com/blog/archives/2004/10/18/bad-code-smells-in-wact-a-refactoring-review/">WACT</a> post drew a couple questions from <a href="http://www.lastcraft.com/blog/">Marcus Baker</a>:</p>
<blockquote><p>
Do you have a release date planned for the next version?
</p></blockquote>
<p>Ah, the release date question.  We are certainly overdue.  Here is where things stand.</p>
<p>The core framework in CVS is in very good shape.  We have 3332 passing tests and 5 failing tests.  The failing tests are relatively minor.  I would like to fix them before release, but don&#8217;t see it as absolutely necessary.</p>
<p>I feel the biggest obstacle right now is that many of the example programs that we have in WACT are either obsolete, broken or unfinished.  They are mostly broken due to the incompatibility of changes within the controller layer from the last version.  I would like to see working (and hopefully unit tested) examples for the release.  I don&#8217;t want to make a release with code that errors out.</p>
<p>The current controller architecture in the CVS version of WACT is very different from what is in the previously released version.  After writing what is there now, i have modified my thinking on what a controller framework should look like.  I&#8217;ve written up some of the theory of this on this <a href="http://wact.sourceforge.net/index.php/ModelViewController">Model View Controller</a> page.  I&#8217;ve been working on a proof of concept of this, which I think will become the final WACT controller layer.</p>
<p>As such, I am reluctant to go through the examples now and update them to the current controller when I know that I will have update them again.  I am also reluctant to expose a brand new API in the release which I already know will go away.</p>
<p>I&#8217;ve decided I want to work on the controllers and not the examples right now.  That of course doesn&#8217;t preclude anyone else who wants to work on the examples from doing so and getting us into releasable condition.  Thats just how I want to spend my time right now.  If we are going to release with what we have now, which i am not opposed to, someone else will have to step up and push that.</p>
<p>Its possible that my controller ideas won&#8217;t work out.  I&#8217;ve just reviewed the 3.0.0dev version of <a href="http://www.mojavi.org/">Mojavi</a>.  I have to say I am impressed.  I have looked at most of the controller frameworks on <a href="http://wact.sourceforge.net/index.php/MvcFrameworksWrittenInPhp">this page</a> and i have to say that Mojavi is the only one that i would seriously consider using myself.  It has the right combination of support, maturity, and good design.  If my experiments with MVC don&#8217;t pan out, i would seriously consider ditching the current WACT controller layer in favor of Mojavi integration.</p>
<p>So thats where I am at.  I would personally like to see more of the controller issues resolved before the release goes out the door.  I would like to feel as good about the controller layer of WACT as I do about the rest of it. </p>
<p>I should finish up with a project soon and have more time to devote to WACT.</p>
<p>When will the next WACT release be?  I refer you <a href="http://www.jadetower.org/muses/archives/000163.html">here</a>.</p>
<p>Marcus also asks:</p>
<blockquote><p>
The bit that I&#8217;ve never understood is, what is a DataSpace?
</p></blockquote>
<p>The DataSpace concept has evolved over time.  in WACT, DataSource is an interface that allows an object to expose properties though a generic protocol.  The DataSpace class is a convenience base class that helps implement this interface.  The DataSource interface could be considered equivalent to the properties portion of the Java Beans specification.  You could think of any object inheriting from DataSpace or implementing DataSource as a bean in java terms.  However, I would probably compare it to the more dynamic <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/">Key Value Coding</a> from Objective-C.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2004/10/25/status-of-wact/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bad Code Smells in WACT, a refactoring review</title>
		<link>http://www.procata.com/blog/archives/2004/10/18/bad-code-smells-in-wact-a-refactoring-review/</link>
		<comments>http://www.procata.com/blog/archives/2004/10/18/bad-code-smells-in-wact-a-refactoring-review/#comments</comments>
		<pubDate>Mon, 18 Oct 2004 21:32:04 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[WACT]]></category>

		<category><![CDATA[refactoring]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2004/10/18/bad-code-smells-in-wact-a-refactoring-review/</guid>
		<description><![CDATA[This post shows some bad design elements in WACT and discusses how to improve them.  It lists some related bad code smells in the WACT template compiler.  It is a non-trivial example of refactoring in an established application and an illustration of OO design issues.
related files:
treebuilder.inc.php
parserstate.inc.php
tagjudge.inc.php
tagdictionary.inc.php
input.tag.php
The TreeBuilder and ComponentParsingState classes may need to [...]]]></description>
			<content:encoded><![CDATA[<p>This post shows some bad design elements in <a href="http://sourceforge.net/projects/wact/">WACT</a> and discusses how to improve them.  It lists some related bad code smells in the WACT template compiler.  It is a non-trivial example of refactoring in an established application and an illustration of OO design issues.</p>
<p>related files:<br />
<a href="http://cvs.sourceforge.net/viewcvs.py/wact/wact/framework/template/compiler/treebuilder.inc.php?rev=1.45&#038;view=auto">treebuilder.inc.php</a><br />
<a href="http://cvs.sourceforge.net/viewcvs.py/wact/wact/framework/template/compiler/parserstate.inc.php?rev=1.35&#038;view=auto">parserstate.inc.php</a><br />
<a href="http://cvs.sourceforge.net/viewcvs.py/wact/wact/framework/template/compiler/tagjudge.inc.php?rev=1.8&#038;view=auto">tagjudge.inc.php</a><br />
<a href="http://cvs.sourceforge.net/viewcvs.py/wact/wact/framework/template/compiler/tagdictionary.inc.php?rev=1.9&#038;view=auto">tagdictionary.inc.php</a><br />
<a href="http://cvs.sourceforge.net/viewcvs.py/wact/wact/framework/template/tags/form/input.tag.php?rev=1.18&#038;view=auto">input.tag.php</a></p>
<p>The TreeBuilder and ComponentParsingState classes may need to have code re-distributed between the two. </p>
<p>The TreeBuilder class performs two distinct tasks: building the tree (Managing the Component and ParentComponent fields) and constructing the component.  This may be an example of a <strong>Large Class</strong> code smell.  It is certainly an example of poor class <a href="http://c2.com/cgi/wiki?CouplingAndCohesion">cohesion</a>.</p>
<p>The openBranch method of TreeBuilder has the job of both constructing the component and adding it to the tree.  Breaking this method into two distinct functions would clarify the code and remove a <strong>Long Parameter List</strong> smell from openBranch.</p>
<p>The openBranch and closeBranch methods of TreeBuilder have boolean parameters.  This makes these calls to TreeBuilder from the ComponentParsingState more confusing.  (more on <a href="http://www.sitepoint.com/forums/showpost.php?p=913525&#038;postcount=10">refactoring parameters</a> and boolean parameters).</p>
<p>The closeBranch method performs two tasks. setting the hasClosingTag field is in this method for convenience.  It is really a part of the construction of the component and probably belongs closer to openBranch.  (conveniently eliminating the need for having a boolean parameter in closeBranch).</p>
<p>The Component construction methods on TreeBuilder pass along a Locator object through a deep calling tree.  The Locator object is a field on the ComponentParsingState class.    The many methods on TreeBuilder for constructing a component that are called from ComponentParsingState may be an example of the <strong>Feature Envy</strong> code smell.   There seems to be some excessive  <a href="http://c2.com/cgi/wiki?CouplingAndCohesion">coupling</a> between ComponentParsingState and TreeBuilder.  Perhaps the construction methods really belong to ComponentParsingState, not TreeBuilder?</p>
<p>The startElement, endElement, and emptyElement methods of ComponentParsingState show an example of the <strong>Innappropriate Intimacy</strong> smell by manipulating the component field of the TreeBuilder class ($this->TreeBuilder->Component->).  They do this as part of constructing the component.  This is probably further evidence that the component should be constructed inside the ComponentParsingState class and passed as a whole unit into the openBranch method of the TreeBuilder class for addition into the tree.  Another example of excessive coupling.</p>
<p>The isServerTagComponentTag method of the TagJudge class instantiates a dummy component to examine a local variable containing information about the component and then throws the component away.  The TagInfo records in the TagDictionary are supposed contain metadata about each component.  The information returned by isServerTagComponentTag on the Component class should be moved into the TagInfo meta-data.  Everytime isServerTagComponentTag is called, a TagInfo object should instead be available to call, thus elminating the isServerTagComponentTag method from the TagJudge Class.  Eliminating the unnecessary object instantiation will probably result in  a tiny performance improvement.</p>
<p>The calling of the isComponent method on TagJudge from ComponentParsingState is always a two stage process.  First isComponent is called on TagJudge, then getTagInfo is called on TagDictionary.  That combined with the call to getTagInfo inside the implementation of isComponent and the TagDictionary field of TagJudge, used only in isComponent, suggests that perhaps the isComponent method is really a sophisticated find method for tag information and should be a combined findComponent method on the TagDictionary class that returns NULL if no appropriate TagInfo class can be found.</p>
<p>Right now, the two stage component finding process in ComponentParsingState means that there is a one to one relationship between HTML tags and compile time component tags.  However, the <strong>Switch Statement</strong> code smell in the InputTag suggests that a one to one relationship is not correct, and that we really need a one to many relationship.  The code cannot support a one to many relationship as long as the finding of a TagInfo object is broken up into two stages and not encapsulated into the same place.</p>
<p>The fact that both methods on TagJudge can be moved to other classes, suggests that TagJudge is an example of the <strong>Lazy Class</strong> code smell.  The TagJudge class can probably be eliminated.</p>
<p>The InputTagInfo class shows the <strong>Data Class</strong> code smell.  instead of defining a unique class for each tag to be registered, a common TagInfo class should be available.  An instance of this class could then be initialized and registered.  Then the common TagInfo class would be available to move behavior to in further refactoring efforts.  Additionally, this would allow the information in the TagDictionary to be loaded from configuration files, instead of requiring tag files to be included, a slow and unncessary process.</p>
<p>These refactoring issues are related to three WACT feature requests.  Each of these three requests should largely be a change to the TagDictionary class and the (nonexistent) TagInfo class.  The fact that theses features require broad changes across the template compiler is an example of the <strong>Shotgun Surgery</strong> code smell and an example of poor <a href="http://c2.com/cgi/wiki?EncapsulationDefinition">encapsulation</a> around the TagInfo and TagDictionary classes.</p>
<p><a href="http://sourceforge.net/tracker/index.php?func=detail&#038;aid=911634&#038;group_id=85372&#038;atid=575987">Allow multiple components per tag</a><br />
<a href="http://sourceforge.net/tracker/index.php?func=detail&#038;aid=910997&#038;group_id=85372&#038;atid=575987">Convert TagInfo to XML based format</a><br />
<a href="http://sourceforge.net/tracker/index.php?func=detail&#038;aid=910988&#038;group_id=85372&#038;atid=575987">Lazy loading for Compiler Components</a></p>
<p>Note that implementing the lazy loading will have a significant impact on compilation times, illustrating that fully refactored normalized code is easier to performance tune.</p>
<p>Anyone else see any additional code smells here?  Anyone up for a non-trivial refactoring learning exercise?  I hope to be able to eventually post the refactored versions of these files.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2004/10/18/bad-code-smells-in-wact-a-refactoring-review/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rephlux and PHP memory usage with a PEAR surpise</title>
		<link>http://www.procata.com/blog/archives/2004/05/27/rephlux-and-php-memory-usage/</link>
		<comments>http://www.procata.com/blog/archives/2004/05/27/rephlux-and-php-memory-usage/#comments</comments>
		<pubDate>Fri, 28 May 2004 02:37:56 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[WACT]]></category>

		<category><![CDATA[memory-usage]]></category>

		<category><![CDATA[pear]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2004/05/27/rephlux-and-php-memory-usage/</guid>
		<description><![CDATA[Jon Ramsey came up with a continuous integration tool called Rephlux.  Rephlux periodically checks out your code from CVS and runs your unit tests on it.  It produces a RSS feed of test failures and a RSS feed of CVS revisions.  How cool is that?
In the future it should be possible to [...]]]></description>
			<content:encoded><![CDATA[<p>Jon Ramsey came up with a continuous integration tool called <a href="http://rephlux.sourceforge.net/">Rephlux</a>.  Rephlux periodically checks out your code from CVS and runs your unit tests on it.  It produces a <a href="http://wact.sourceforge.net/rephlux/wact.fails.xml">RSS feed of test failures</a> and a <a href="http://wact.sourceforge.net/rephlux/wact.revisions.xml">RSS feed of CVS revisions</a>.  How cool is that?</p>
<p>In the future it should be possible to automatically build releases and documentation when all the tests pass.  Hopefully, this will help improve our record of releasing on the <a href="http://wact.sourceforge.net/">WACT</a> project.  With one formal release in nearly a year of active development, our record is dismal as <a href="http://www.phppatterns.com/index.php/article/articleview/104/1/2/">Harry diplomatically points out</a>.</p>
<p>Jon is running Rephlux remotely for WACT right now because we are having a problem getting our full test suite to run in the 8M limit that sourceforge imposes on PHP.  We have 97 test cases, 541 test functions, and 1927 assertions in our test suite. This will only grow.  The full test suite includes over 350 PHP files when it runs.  </p>
<p>Since there isn&#8217;t much we can do about unincluding files to free up memory, I decided to take a look at the data that gets stored to see if there was any low hanging fruit there.  I wanted to look and see if any of the code we are using keeps any data in global variables that it might be able to release when done to allow the space to be garbage collected.</p>
<p>So, I added a quick and dirty little hack to get an idea of the size of the various global variables that were left over after a test run.<br />
<pre class="php">&nbsp;
    <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/array_keys"><span style="color: #000066;">array_keys</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$GLOBALS</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$key</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;$key=&quot;</span> . <a href="http://www.php.net/strlen"><span style="color: #000066;">strlen</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/serialize"><span style="color: #000066;">serialize</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$GLOBALS</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$key</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;</pre><br />
Most of the globals that were left over were tiny, but there was one that stood out.  That was something from PEAR:<br />
<pre class="php">&nbsp;
_PEAR_destructor_object_list=<span style="color: #cc66cc;">146270</span>
&nbsp;</pre><br />
Looking in to this further I found that the PEAR base class registers a rather dubious destructor for every object that inherits from it:<br />
<pre class="php">&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> _PEAR<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;_debug<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            <a href="http://www.php.net/printf"><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;PEAR destructor called, class=%sn&quot;</span>, <a href="http://www.php.net/get_class"><span style="color: #000066;">get_class</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;</pre><br />
To support this gem, PEAR puts a reference to every object instance ever instantiated that inherits from <code>PEAR</code> into the global variable <code>_PEAR_destructor_object_list</code>.   There the object stays until the deconstruction shutdown function is called.  This reference prevents garbage collection of any of objects inheriting from <code>PEAR</code> or the memory they reference during the lifetime of the script.  And it does this for no good reason at all.</p>
<p>I&#8217;ve <a href="http://forums.devnetwork.net/viewtopic.php?p=90455#90455">expressed my opinion of <code>pear.php</code></a> before and this only reinforces it.  </p>
<p>The only PEAR module that WACT requires is <a href="http://pear.php.net/package/XML_HTMLSax"><code>XML_HTMLSax</code></a>, a handy parser for HTML with an XML parsing interface.  I&#8217;ve always been a little bit uncomfortable with its dependency on <code>pear.php</code> and the deployment issues that this introduces into WACT.  WACT also has optional components that reference other PEAR packages, such as PEAR::DB, PEAR::MDB and PEAR::MDB2.  Fortunately a more typical WACT use case only instantiates a handful of PEAR objects.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2004/05/27/rephlux-and-php-memory-usage/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
