<?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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>Pádraic Brady &#187; Astrum Futura</title>
	<atom:link href="http://blog.astrumfutura.com/category/Astrum-Futura/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.astrumfutura.com</link>
	<description>PHP, Zend Framework and Other Crazy Stuff</description>
	<lastBuildDate>Thu, 12 Apr 2012 17:33:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license>		<item>
		<title>Astrum Futura Redux</title>
		<link>http://blog.astrumfutura.com/2007/12/astrum-futura-redux/</link>
		<comments>http://blog.astrumfutura.com/2007/12/astrum-futura-redux/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 16:01:10 +0000</pubDate>
		<dc:creator>Pádraic Brady</dc:creator>
				<category><![CDATA[Astrum Futura]]></category>
		<category><![CDATA[PHP Game Development]]></category>
		<category><![CDATA[PHP General]]></category>
		<category><![CDATA[PHP Security]]></category>
		<category><![CDATA[astrum futura]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php game development]]></category>
		<category><![CDATA[php general]]></category>
		<category><![CDATA[php security]]></category>
		<category><![CDATA[quantum star se]]></category>
		<category><![CDATA[solar empire]]></category>

		<guid isPermaLink="false">http://blog.astrumfutura.com/?p=324</guid>
		<description><![CDATA[For the cool folk who have followed the Solar Empire legacy through thick and thin since 1999, those cute .php3 file suffixes, Moriarty&#8217;s continuing denegration of all other developers, the revolution that open source brought, the sudden push towards OOP, and the&#8230;err&#8230;security and bug population&#8230; Working on anything hitting it&#8217;s 9th anniversary in PHP is]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.astrumfutura.com%2F2007%2F12%2Fastrum-futura-redux%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.astrumfutura.com%2F2007%2F12%2Fastrum-futura-redux%2F&amp;source=padraicb&amp;style=normal&amp;service=bit.ly&amp;service_api=padraic%3AR_94101570b7e190f3de921bc15bb9438d&amp;hashtags=astrum+futura,php,php+game+development,php+general,php+security,quantum+star+se,solar+empire&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>For the cool folk who have followed the Solar Empire legacy through thick and thin since 1999, those cute .php3 file suffixes, Moriarty&#8217;s continuing denegration of all other developers, the revolution that open source brought, the sudden push towards OOP, and the&#8230;err&#8230;security and bug population&#8230; Working on anything hitting it&#8217;s 9th anniversary in PHP is really interesting &#8211; 9 times the fun and games <img src='http://blog.astrumfutura.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>Astrum Futura was envisaged as a desperately needed update to the long running open source Solar Empire franchise, where players engage each other across a galaxy of 500+ star systems mining resources, building colonies, and generally screaming bloody murder at each other. It&#8217;s not the most impressive or ambitious of online games, but it&#8217;s always been tenacious and attracted roaming users who like a quick dash of destruction in their daily diet.</p>
<p>In January 2008, the oft delayed development process will once again creak into action. The current tracer code was built originally using the Zend Framework 0.2-0.6 and famously led that Spring to my long running &#8220;Complex Views With The Zend Framework&#8221; blog series that gave birth to the Zend_View Enhanced proposal, and maybe gave Ralph Schindler a few headaches <img src='http://blog.astrumfutura.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Building anything more complex than a login page was pure heart ache previously.</p>
<p>Now that time is available, the Zend Framework significantly more mature, and we have a lot of legwork carried over from 2006 in the Quantum Game Library (thanks to Jacob Santos), it&#8217;s about time we got something concrete done. The usual suspects, if interest levels are high enough, can report to the shiny updated phpBB3 forums at <a href="http://forums.astrumfutura.com" >http://forums.astrumfutura.com</a> &#8211; same domain as this blog you&#8217;re reading.</p>
<p>And we will be applying XP this time &#8211; the random running process that usually prevails just doesn&#8217;t work out well. So get your Selenium gear in place.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.astrumfutura.com/2007/12/astrum-futura-redux/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Quantum_Db: The QGL Data Access Object Implementation</title>
		<link>http://blog.astrumfutura.com/2007/02/quantum_db-the-qgl-data-access-object-implementation/</link>
		<comments>http://blog.astrumfutura.com/2007/02/quantum_db-the-qgl-data-access-object-implementation/#comments</comments>
		<pubDate>Tue, 13 Feb 2007 14:25:02 +0000</pubDate>
		<dc:creator>Pádraic Brady</dc:creator>
				<category><![CDATA[Astrum Futura]]></category>
		<category><![CDATA[PHP Game Development]]></category>
		<category><![CDATA[PHP General]]></category>
		<category><![CDATA[astrum futura]]></category>
		<category><![CDATA[dao]]></category>
		<category><![CDATA[data access object]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php game development]]></category>
		<category><![CDATA[php general]]></category>
		<category><![CDATA[qgl]]></category>
		<category><![CDATA[quantum game library]]></category>

		<guid isPermaLink="false">http://blog.astrumfutura.com/?p=267</guid>
		<description><![CDATA[Back in 2005, the Quantum Star SE project caught the Object Relational Mapping (ORM) bug and I took a first stab at implementing something that was simple, fast and easy to use. Until this stage I was a regular user of the Data Mapper pattern (among others) but since switching to PHP and developing open]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.astrumfutura.com%2F2007%2F02%2Fquantum_db-the-qgl-data-access-object-implementation%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.astrumfutura.com%2F2007%2F02%2Fquantum_db-the-qgl-data-access-object-implementation%2F&amp;source=padraicb&amp;style=normal&amp;service=bit.ly&amp;service_api=padraic%3AR_94101570b7e190f3de921bc15bb9438d&amp;hashtags=astrum+futura,dao,data+access+object,design+patterns,php,php+game+development,php+general,qgl,quantum+game+library&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Back in 2005, the Quantum Star SE project caught the Object Relational Mapping (ORM) bug and I took a first stab at implementing something that was simple, fast and easy to use. Until this stage I was a regular user of the Data Mapper pattern (among others) but since switching to PHP and developing open source projects found it to be largely unnecessary. The root problem is akin to hammering nails with a sledgehammer &#8211; too much complexity being implemented for a simple underwhelming task.</p>
<p>Here in 2007, with the QGL in development I found myself re-assessing my previous experiences and finding it attractive to develop something less complex and hopefully faster than a full scale ORM solution. Taking some previous work I did, I opened a branch in the QGL subversion repository and set to work. The results are slowly coming to fruition &#8211; the DAO, Row and part of the Driver families are shaping up going by the unit tests.</p>
<p>So what is Quantum_Db (in practice)? It will be a family of classes which form a Data Access Object (DAO) Framework when complete. This post is largely a ramble about current progress and intentions &#8211; so if looking for a complete solution you&#8217;re in the wrong place as the current code is strictly in-progress. For reference though, the source code is under the New BSD License. It&#8217;s incomplete, but available from its subversion branch at: <a href="http://quantumstar.svn.sourceforge.net/viewvc/quantumstar/branches/Quantum_Db/">http://quantumstar.svn.sourceforge.net/viewvc/quantumstar/branches/Quantum_Db/</a> and the forums can be found for the QGL in general at <a href="http://forums.astrumfutura.com/viewforum.php?f=25">http://forums.astrumfutura.com/viewforum.php?f=25</a>.</p>
<p>In this specific implementation of Quantum_Db, the DAO class (Quantum_Db_Access) is a Singleton which attempts to offer relatively basic CRUD methods capable of use on any valid database table record. A large part of its responsibility is generating CRUD type SQL. So you could have a User record, which could be saved by passing it to a DAO save() method. It&#8217;s not quite as clear cut, since to reduce the mass of code a DAO implementation often needs the &#8220;record&#8221; is encapsulated in a container called Quantum_Db_Row. This Row class can represent a single table record, but also doubles as a data container for setting up SQL conditions (think of WHERE, IN and INSERT clauses).</p>
<p>One of the goals intentionally targets simplicity, so there is no Propel-style Criteria object to mess about with. There will be in the future, but for simple needs, a simple DAO framework is sufficient as an initial start. A simplistic use case is adding a new User record. Some code showing this task:</p>
<p>[geshi lang=php]require_once &#8216;Models/User.php&#8217;;</p>
<p>// Fields are public properties handled by __get/__set in the<br />
// Quantum_Db_Row class. The User class is actually a simple<br />
// subclass defining valid fields and primary key(s).<br />
//<br />
// We do not specify an Id value for new Users. The DAO class will<br />
// assign this assuming Id is an auto-incrementing value for MySQL<br />
// or a Sequence for PostgreSQL.</p>
<p>$user = new User;<br />
$user->name = &#8216;Pádraic&#8217;;<br />
$user->email = &#8216;padraic.brady@example.com&#8217;;<br />
$user->password = sha1(&#8216;password&#8217;);<br />
$user->country = &#8216;ie&#8217;;</p>
<p>// Call on DAO to save this record to the database. Obviously any<br />
// database errors will result in Exceptions thrown by the DAO so<br />
// the database table rules (primary key, unique key, etc.) all apply.</p>
<p>$user->save();[/geshi]</p>
<p>The first thing you can note is that the DAO class (called Quantum_Db_Access is not directly called. Instead all Row objects carry a reference to the Quantum_Db_Access singleton so Quantum_Db_Row::save() proxies to Quantum_Db_Access::save() &#8211; we only need one generic DAO object. If one desperately needed the DAO they could just place a call to Quantum_Db_Access::getInstance().</p>
<p>[geshi lang=php]$dao = Quantum_Db_Access::getInstance();<br />
$dao->save($user);[/geshi]</p>
<p>In fact, you can equally access the underlying database extension driver to run queries directly using the following. Of course Singletons have their own evil uses, so ideally you&#8217;d pass around the object reference instead of litering source code with static getInstance() calls which explicitly refer to the class name.</p>
<p>[geshi lang=php]// Example of accessing the driver to drop the User table</p>
<p>$driver = Quantum_Db_Access::getInstance->getDriver()->exec(&#8220;DROP TABLE user&#8221;);[/geshi]</p>
<p>Retrieving records is more interesting. It&#8217;s relatively simple to extract a record based on a primary key:</p>
<p>[geshi lang=php]$user = new User;<br />
$user->getByPk(1);</p>
<p>var_dump($user->asArray()); // echo array of User (Id=1) data[/geshi]</p>
<p>It&#8217;s much more complex to fetch rows of a very specific nature. Even worse, without a Criteria object using the MySQL IN clause is a challenge. However for those where the SQL values depend solely on simple field values a neat solution is &#8220;named queries&#8221;. A Named Query (check the excellent introduction at: <a href="http://www.tonybibbs.com/article.php/PropelDAO">http://www.tonybibbs.com/article.php/PropelDAO</a> regarding something similar for Propel) is an SQL string containing value placeholders (e.g. for use in a PDO::prepare()) stored in some central file. This has a few benefits and disadvantages.</p>
<p>The main benefit is the centralisaton &#8211; like OOP, centralising logic (in this case non-generated SQL strings) reduces duplication and encourages reuse. Allowing the named queries to be indexed (for example, within an XML hierarchy) by a name and model allows them to be easily located and prepared by the Data Access Object. The disadvantages are of course that it&#8217;s still limited. For example, use of a MySQL &#8220;SELECT id, name, email FROM user_table WHERE id IN(1,2,3,4)&#8221; isn&#8217;t likely a storeable named query since the IN() range of id values is too variable. But for many queries it&#8217;s a good fit in the absence of some form of Criteria class.</p>
<p>Enough of the DAO class however. After beating it to death, there are still pieces to be completed when it comes to allowing complex SQL clauses. The main point is that for simple use cases it is a good match &#8211; and simple use cases are extremely common in many of my open source endeavors.</p>
<p>To backup the Data Access Class Quantum_Db also implements a Driver and Results class family. Again simplicity is key, so it&#8217;s being written under the presumption that PHP5&#8242;s PDO extension is available. The Quantum_Db_Driver_Interface file actually mirrors the PDO interface for this reason. Of course we can&#8217;t forget mysqli (the most popular PHP5 database extension) or pgsql and the rest. Quantum_Db_Driver defines an interface to enable additional extension type support. Personally I only intend adding a light abstraction over ADOdb-Lite &#8211; it&#8217;s not worth duplicating Mark&#8217;s already existing library.</p>
<p>The Results class, the one part no code exists for yet &#8211; don&#8217;t be worried I develop using TDD and unit testing so it&#8217;s perfectly normal <img src='http://blog.astrumfutura.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Quantum_Db_Results will aggregate the results of queries into a class implementing PHP5&#8242;s SPL Iterator. To be specific, the Iterator methods will be tied to each underlying Driver&#8217;s fetch* methods. This should allow continued use of Lazy Loading during iterations, and allow continued use of foreach() etc.</p>
<p>Here ends my ramble for now. For those working on the QGL or similar code maybe it will provide a few of my thoughts on the topic &#8211; assuming you can summarise the rambling of course <img src='http://blog.astrumfutura.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.astrumfutura.com/2007/02/quantum_db-the-qgl-data-access-object-implementation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>QGL under the New BSD License</title>
		<link>http://blog.astrumfutura.com/2007/02/qgl-under-the-new-bsd-license/</link>
		<comments>http://blog.astrumfutura.com/2007/02/qgl-under-the-new-bsd-license/#comments</comments>
		<pubDate>Fri, 02 Feb 2007 10:47:57 +0000</pubDate>
		<dc:creator>Pádraic Brady</dc:creator>
				<category><![CDATA[Astrum Futura]]></category>
		<category><![CDATA[PHP Game Development]]></category>
		<category><![CDATA[astrum futura]]></category>
		<category><![CDATA[php game development]]></category>
		<category><![CDATA[qgl]]></category>
		<category><![CDATA[quantum game library]]></category>

		<guid isPermaLink="false">http://blog.astrumfutura.com/?p=264</guid>
		<description><![CDATA[The Quantum Game Library (&#8220;QGL&#8221;) is a PHP5 library aimed at creating a bunch of reuseable classes for use in PHP games. We&#8217;re still in early days but with two dedicated developers, lots of feedback and suggestions we&#8217;ve already put together a few starting solid components and have others in progress. Over the last few]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.astrumfutura.com%2F2007%2F02%2Fqgl-under-the-new-bsd-license%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.astrumfutura.com%2F2007%2F02%2Fqgl-under-the-new-bsd-license%2F&amp;source=padraicb&amp;style=normal&amp;service=bit.ly&amp;service_api=padraic%3AR_94101570b7e190f3de921bc15bb9438d&amp;hashtags=astrum+futura,php+game+development,qgl,quantum+game+library&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>The Quantum Game Library (&#8220;QGL&#8221;) is a PHP5 library aimed at creating a bunch of reuseable classes for use in PHP games. We&#8217;re still in early days but with two dedicated developers, lots of feedback and suggestions we&#8217;ve already put together a few starting solid components and have others in progress.</p>
<p>Over the last few months the QGL has evolved from a minor offshoot of the Astrum Futura project into a fully independent library. I guess everyone on the team saw a generic game library as something really useful; we&#8217;re all game developers on varying projects.</p>
<p>To reflect the library status, as well as to widen the net for potential users and developers we have decided to move from the GNU General Public License (which rules Astrum Futura) to the far more liberal <a href="http://doc.astrumfutura.com/license.html">New BSD License</a>. We&#8217;ve also provisionally determined that copyrights should be centralised to a degree, this currently is not in operation since the number of contributors remains manageable but may be (pending contributor feedback obviously) in the future.</p>
<p>Given licensing is now decided, file header updates in progress (if gradual), and some useful components are hitting stable, it&#8217;s likely we&#8217;ll make a public preview release in the near future. Given out focus on doing things right, this will only occur once documentation is completed and our unit tests verified for good measure.</p>
<p>As a summary (feel free to request details on the <a href="http://forums.astrumfutura.com/index.php?c=7">QGL Forum Section</a>) the current near-stable component list includes:<br />
    &#8211; Quantum_Db<br />
    &#8211; Quantum_Coordinate<br />
    &#8211; Ai_Pathfinding<br />
    &#8211; Quantum_Map_Measure<br />
    &#8211; Quantum_Map_Grid<br />
    &#8211; Quantum_Turing</p>
<p>This is far from complete, and there are literally dozens of possible additions. Those in planning are already shaping up to offer some cool second iteration functionality. That&#8217;s not even including the planned ext/qgl PHP extension&#8230;;).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.astrumfutura.com/2007/02/qgl-under-the-new-bsd-license/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Factions: Social Control on Newbie Bashing</title>
		<link>http://blog.astrumfutura.com/2007/01/factions-social-control-on-newbie-bashing/</link>
		<comments>http://blog.astrumfutura.com/2007/01/factions-social-control-on-newbie-bashing/#comments</comments>
		<pubDate>Tue, 30 Jan 2007 16:37:04 +0000</pubDate>
		<dc:creator>Pádraic Brady</dc:creator>
				<category><![CDATA[Astrum Futura]]></category>
		<category><![CDATA[PHP Game Development]]></category>
		<category><![CDATA[Quantum Star SE]]></category>
		<category><![CDATA[astrum futura]]></category>
		<category><![CDATA[factions]]></category>
		<category><![CDATA[newbie bashing]]></category>
		<category><![CDATA[php game development]]></category>
		<category><![CDATA[qgl]]></category>
		<category><![CDATA[quantum star se]]></category>

		<guid isPermaLink="false">http://blog.astrumfutura.com/?p=263</guid>
		<description><![CDATA[A recent discussion was sparked on the Astrum Futura forums regarding player retention and new player protection. It was one of those times when the discussion branched to a higher view &#8211; a wider look at how players interact on a large scale. The current suggestions called for players to be penalised for undesireable actions,]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.astrumfutura.com%2F2007%2F01%2Ffactions-social-control-on-newbie-bashing%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.astrumfutura.com%2F2007%2F01%2Ffactions-social-control-on-newbie-bashing%2F&amp;source=padraicb&amp;style=normal&amp;service=bit.ly&amp;service_api=padraic%3AR_94101570b7e190f3de921bc15bb9438d&amp;hashtags=astrum+futura,factions,newbie+bashing,php+game+development,qgl,quantum+star+se&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>A recent discussion was sparked on the <a href="http://forums.astrumfutura.com">Astrum Futura forums</a> regarding player retention and new player protection. It was one of those times when the discussion branched to a higher view &#8211; a wider look at how players interact on a large scale.</p>
<p>The current suggestions called for players to be penalised for undesireable actions, e.g. attacking a new player who is incapable of defending him/her self. This remains a long standing issue in many online games. AF could resort to enforced levelling &#8211; limited who a player can attack, and be attacked by. But this is all artificial &#8211; in the real world it&#8217;s open season on anyone.</p>
<p>Cyberlot (Richard) raised the question of penalising through a Karma rating. As a player attacked newcomers they would attract negative Karma marking them out to other players. I can see the rank of &#8220;Newbie Basher&#8221; emerging as an undesireable outcome for many players. But Karma while adding some measure, does not address enforcement. Exactly who enforces what and when? Who set&#8217;s the standard for interacting with other players?</p>
<p>From there we hit the subject of Factions. A Faction would be a specific group of players sharing a common interest. This obviously includes Races, but is also extendable to a Merchant Guild or a Pirate Clan. The point is to give players an instant group they are a member of. Now where it gets interesting in how the player and game logic would respond in the presence of Factions.</p>
<p>Say you have a Faction, Earth Humans United (go Terrans!). What happens if a member of this Faction attacks a new player who is joining the Earth Humans United Faction? Can&#8217;t have allies killing each other off (even if it might reflect reality <img src='http://blog.astrumfutura.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> ). The answer is in the Karma. Killing a new member of your own faction is stupid, damaged the Faction, and makes other players less likely to join it. That member should sur be paying tax to the Faction, which is needed. Such a player would immediately get negative Karma.</p>
<p>So we have Karma, and we have Factions &#8211; how do they relate?</p>
<p>Karma is a measure of one&#8217;s standing within a Faction. If your Karma falls below a minimal level you&#8217;ll be declared an enemy of the Faction, and then its time to start running before you&#8217;re hunted down by your peers. Where do you flee? If you&#8217;re lucky, some other Faction still has you as Neutral. </p>
<p>But this is where Newbie Protection get&#8217;s interesting. It&#8217;s not Faction specific &#8211; your bad Karma is classified when killing a new player as a &#8220;Stigma&#8221;. It decreases Karma for *ALL* Factions. It&#8217;s the ultimate punishment &#8211; imagine playing when nearly all the Factions refuse to grant you trade access, when your planets are penalised with &#8220;special tax charges&#8221;, when other players are unable to maintain an Alliance with you once you become Factionless (Outcast). In short, if you gain a reputation for killing new players, you&#8217;ll be kicked, booted and sent to Hell with a one way express ticket. No Admin interference or funny AI fleets required. Society will put you straight or else&#8230;</p>
<p>More on this later as details are worked out, but it looks like it&#8217;s a feasible and supported suggestion.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.astrumfutura.com/2007/01/factions-social-control-on-newbie-bashing/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Thoughts on a Unit Testing and Test-Driven Design Experience</title>
		<link>http://blog.astrumfutura.com/2007/01/thoughts-on-a-unit-testing-and-test-driven-design-experience/</link>
		<comments>http://blog.astrumfutura.com/2007/01/thoughts-on-a-unit-testing-and-test-driven-design-experience/#comments</comments>
		<pubDate>Mon, 29 Jan 2007 16:58:53 +0000</pubDate>
		<dc:creator>Pádraic Brady</dc:creator>
				<category><![CDATA[Astrum Futura]]></category>
		<category><![CDATA[PHP Game Development]]></category>
		<category><![CDATA[PHP General]]></category>
		<category><![CDATA[astrum futura]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php game development]]></category>
		<category><![CDATA[php general]]></category>
		<category><![CDATA[qgl]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://blog.astrumfutura.com/?p=262</guid>
		<description><![CDATA[Creeping closer to Spring; it&#8217;s 1 February if you follow my calendar. One of the things which stand out in my online activities as it touches on PHP is the 3 month period spent working on the QGL (Quantum Game Library). The library is just reaching its 200th commit, and should pass that barrier later]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.astrumfutura.com%2F2007%2F01%2Fthoughts-on-a-unit-testing-and-test-driven-design-experience%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.astrumfutura.com%2F2007%2F01%2Fthoughts-on-a-unit-testing-and-test-driven-design-experience%2F&amp;source=padraicb&amp;style=normal&amp;service=bit.ly&amp;service_api=padraic%3AR_94101570b7e190f3de921bc15bb9438d&amp;hashtags=astrum+futura,php,php+game+development,php+general,qgl,tdd,unit+testing&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Creeping closer to Spring; it&#8217;s 1 February if you follow my calendar. One of the things which stand out in my online activities as it touches on PHP is the 3 month period spent working on the QGL (Quantum Game Library). The library is just reaching its 200th commit, and should pass that barrier later this evening when I get around to a small class naming change.</p>
<p>Sticking with the QGL, it&#8217;s a small side project which sprung up from a vague idea. Those of us working on the related Astrum Futura game project, knew a standard game library of some description would pay dividends for future projects by centralising a general set of useful classes. It was shortly after this concept was solidifying when Jacob Santos joined the team with his imaginative vision of implementing AI algorithms.</p>
<p>The one thing that really stands out from the usual project hustle and flow, was our shared wish to use Test Driven Design and Unit Testing. It&#8217;s very difficult to use it on anything more than personal projects at work where developer resistance (though falling) is still an obstacle. So the QGL was an all too rare opportunity to cooperate in a team led effort focused around the test-first approach.</p>
<p>So how did we fare?</p>
<p>Personally, I think a lot of what we accomplished to date (bearing in mind the time limitations) was a result of TDD, and of course Unit Testing&#8217;s benefits in general. There were times where we were working on complementary components such as Jacob on Ai_Pathfinding, and myself on Quantum_Map_Measure where TDD led to simpler more maneageable classes. Of course the unit tests supported our efforts with style. Throughout the process we were both refactoring code, and tweaking interfaces. Without the unit tests we would have reached deep treacherous waters as our respective efforts slowly drifted apart.</p>
<p>I also think poor Jacob may have become test infected. He seems to be recovering, so I&#8217;ll have to wind him up later over the current two failing tests he introduced! I haven&#8217;t heard any rumours of a bald Jacob Santos so presumably that odd side symptom has yet to rear its ugly head.</p>
<p>Back on track&#8230; The most visible benefits of the TDD + UT approach during the last three months can be summarised as:</p>
<p>- Easier Refactoring (perform a refactor, check tests still pass, rinse and repeat)<br />
- Immediate Feedback when code goes wrong (big fat red bars in the testing results. Hard to ignore!)<br />
- Enforcement of Standards (tests discourage questionable hacks/shortcuts)<br />
- Regression Testing (if something goes wrong, we add test(s) to prevent repeats)<br />
- Force Feedback (not just a console controller type, failed unit tests spark attention from other developers)<br />
- Code To An Interface (TDD and unit testing teach you why if you&#8217;re a quick study)<br />
- Testable Code is Better Code (adherence to practices which generate clean, focused, flexible classes)</p>
<p>I&#8217;m sure there are others, but these were the most obvious over three months of development across 200 commits to subversion from two developers. If the immediate benefits are not a motivation to become test-infected the future benefits might. The one thing I know from past experience is that unit tested code tends to be easier to maintain and generates fewer bug reports.</p>
<p>Now of only someone miraculously removed the initial pain a developer experiences when starting to learn TDD and Unit Testing (the pain that explains why many quit before the summit of the learning curve is reached) we could get more folk on the TDD bandwagon. One unfortunate fallout from following a test-first approach is that it necessitates any new developers becoming educated. No easy task when dealing with a vast population of wannabe programmers taking their first few running jumps with PHP by showing interest in open source projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.astrumfutura.com/2007/01/thoughts-on-a-unit-testing-and-test-driven-design-experience/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Astrum Futura: Performance and Optimisation</title>
		<link>http://blog.astrumfutura.com/2006/11/astrum-futura-performance-and-optimisation/</link>
		<comments>http://blog.astrumfutura.com/2006/11/astrum-futura-performance-and-optimisation/#comments</comments>
		<pubDate>Mon, 27 Nov 2006 23:47:41 +0000</pubDate>
		<dc:creator>Pádraic Brady</dc:creator>
				<category><![CDATA[Astrum Futura]]></category>

		<guid isPermaLink="false">http://blog.astrumfutura.com/?p=251</guid>
		<description><![CDATA[I thought, as reference, I&#8217;d do up a post concerning performance and optimisation in Astrum Futura. Mainly to get my thought processes in text, and take a look at where performance is lacking. The main driver of performance at the moment, in the absence of reems of game specific code is the Zend Framework. The]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.astrumfutura.com%2F2006%2F11%2Fastrum-futura-performance-and-optimisation%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.astrumfutura.com%2F2006%2F11%2Fastrum-futura-performance-and-optimisation%2F&amp;source=padraicb&amp;style=normal&amp;service=bit.ly&amp;service_api=padraic%3AR_94101570b7e190f3de921bc15bb9438d&amp;hashtags=php&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>    I thought, as reference, I&#8217;d do up a post concerning performance and optimisation in Astrum Futura. Mainly to get my thought processes in text, and take a look at where performance is lacking.</p>
<p>The main driver of performance at the moment, in the absence of reems of game specific code is the Zend Framework. The ZF is currently reaching a v0.60 preview release in subversion (should be release next month) and an interesting discussion took place last week on the ZF mailing lists concerning <a href="http://www.quantum-star.com/serendipity/exit.php?url=aHR0cDovL3BhdWwtbS1qb25lcy5jb20vYmxvZy8/cD0yMzY=&amp;entry_id=254" title="http://paul-m-jones.com/blog/?p=236"  onmouseover="window.status='http://paul-m-jones.com/blog/?p=236';return true;" onmouseout="window.status='';return true;">this blog post</a> by Paul M. Jones comparing four framework. In a simple minimalistic &quot;Hello World!&quot; application using each framework&#8217;s most minimum setup possible, and measuring requests per second (on a local PC), the ZF came last.</p>
<p>The main causes of this was the pure OOP approach. Each component has a few Exception classes, each in a separate files, which were loaded (as all ZF files are) using require_once(). Add to that the possible use of a static loading method which did weird and wonderful I/O filesystem checks and all that work created a major drag. That may be addressed properly in the future &#8211; until a 1.0 release the idea of optimisation is still largely considered premature optimisation. At least one small improvement was made &#8211; the use of Reflection has been largely removed from the many Controller classes. Reflection in PHP5 is nice, neat, and very expensive.</p>
<p>The Astrum Futura approach is to wait and see. Until then we&#8217;ve added an __autoload function, and are prepared to strip all instances of require_once() calls from files we distribute in a release. That in combination with autoloading would ease the burden a fair bit. A release is months away of course, so wait and see is the only reasonable stance right now.</p>
<p>Another future performance driver is the database. This gets interesting however, in that we can&#8217;t consider the database purely in isolation. By itself we can rely on a mix of query caching (on the few shared hosts who actually bother to check their MySQL configuration), the use of InnoDB and MEMORY (HEAP) storage solutions for tables (again MySQL), and the usual pretension that 4th level normalisation doesn&#8217;t exist <img src="http://www.quantum-star.com/serendipity/templates/default/img/emoticons/wink.png" alt=";-)" style="display: inline; vertical-align: bottom;" class="emoticon" />.</p>
<p>In AF, we also have to deal with how database results are handled. In general terms, an AJAX frontend does not typically rely on HTML input. Rather we receive responses in a strict data-only format such as XML or JSON. JSON in particular is the most useful since it&#8217;s Javascript&#8217;s native object notation. XML is more complex since it requires using Javascript&#8217;s DOM to manipulate. One of the focuses for near static data will be utilising caching extensively &#8211; not just server side, but also in the client. One of our main concerns, and one of the reasons we&#8217;re coding to PHP5.2, using MySQL more productively (no MyISAM crap here), and actively seeking ways of caching data, is the fact that the interface is AJAX enabled.</p>
<p>AJAX gives a nice warm fuzzy feeling when you see it in action. But if used extensively in the wrong way it can create a ton of problems. The simplest explanation is that AJAX should nearly always increase a user&#8217;s productivity &#8211; it&#8217;s not just eye candy <img src="http://www.quantum-star.com/serendipity/templates/default/img/emoticons/wink.png" alt=";-)" style="display: inline; vertical-align: bottom;" class="emoticon" />. The more productive they are, the fewer server requests they should need for a given task. The disadvantage is that you can easily wind up with a task which rather than taking one or two big page reloads to complete, takes a dozen or more small AJAX updates. If those small updates are slow, and add up to a larger request time and larger bandwidth takeup than the single big request you started with &#8211; then something went a bit wrong. Caching both on the server side, and especially on the client side reduces the number of small requests for static data. The fewer the better&#8230;</p>
<p>Now, if only these good intentions converted into reality in the near future&#8230;<img src="http://www.quantum-star.com/serendipity/templates/default/img/emoticons/wink.png" alt=";-)" style="display: inline; vertical-align: bottom;" class="emoticon" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.astrumfutura.com/2006/11/astrum-futura-performance-and-optimisation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

