<?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>Mike Conley&#039;s Blog &#187; mvc</title>
	<atom:link href="http://mikeconley.ca/blog/tag/mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://mikeconley.ca/blog</link>
	<description>The personal blog of a Toronto based software developer, musician, sound designer, and theatre enthusiast.</description>
	<lastBuildDate>Tue, 10 Jan 2012 13:58:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>My Web App in the News</title>
		<link>http://mikeconley.ca/blog/2009/03/28/my-web-app-in-the-news/</link>
		<comments>http://mikeconley.ca/blog/2009/03/28/my-web-app-in-the-news/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 19:25:31 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[auction]]></category>
		<category><![CDATA[dsbn]]></category>
		<category><![CDATA[gsoa]]></category>
		<category><![CDATA[mvc]]></category>

		<guid isPermaLink="false">http://mikeconley.ca/blog/?p=341</guid>
		<description><![CDATA[ANOTHER UPDATE: Whoops.  Fixed the links to the auction and the St. Catharines Standard article. UPDATE: Apparently, the Feds are getting in on the online auction circuit too. Over the past three summers, I&#8217;ve been employed by the District School Board of Niagara as an internal web application developer. One of my first jobs in [...]]]></description>
			<content:encoded><![CDATA[<p><strong>ANOTHER UPDATE:</strong> Whoops.  Fixed the links to the auction and the St. Catharines Standard article.</p>
<p><strong>UPDATE: </strong><a href="http://www.stcatharinesstandard.ca/ArticleDisplay.aspx?e=1490637"> Apparently, the Feds are getting in on the online auction circuit too. </a></p>
<p>Over the past three summers, I&#8217;ve been employed by the District School Board of Niagara as an internal web application developer.</p>
<p>One of my first jobs in the summer of 2006 was to rebuild the online auction application that the DSBN Purchasing department ran.  The original auction let the Board dispose of old equipment quickly and easily, and was quite popular.  Unfortunately, it was also written in (almost) unintelligible/unmaintainable Perl.</p>
<p>So I rewrote it by myself, and learned PHP/MSSQL along the way.  We called this new auction site The Government Surplus Online Auction, and we opened it up so that other government agencies could also post items for auction.</p>
<p>Things went along fine until last summer, when the site got attacked by an SQL Injection bot.  Back in 2006, I had no idea what SQL injection was, or how to guard myself.</p>
<p>So there I am &#8211; I&#8217;ve just come back from a camping trip, my inbox is packed with complaints, and I&#8217;ve got three weeks until school begins.  Crap.</p>
<p>Luckily, I had plenty of tools at my disposal.  My web app development skills and practices had evolved dramatically since 2006, and I had been itching to reimplement the auction anyhow.  The SQL Injection attack was a perfect excuse for me to gut the entire application, and rebuild from scratch.</p>
<p>And I did.  I rebuilt the whole thing from the ground up in three weeks.  It&#8217;s been almost a year since it was deployed, and I&#8217;m still very happy with its performance, and the code that runs it.</p>
<p>I&#8217;m <strong>not </strong>happy with its overall UI design.  I think there are plenty of improvements to be made in that regard.  Luckily, it&#8217;s coded using a light <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">MVC</a> framework that I designed/built myself, so reskinning shouldn&#8217;t be too hard for whoever decides to work on it&#8230;</p>
<p>Apparently, I&#8217;m not the only one happy with the auction site.  <a href="http://www.stcatharinesstandard.ca/ArticleDisplay.aspx?e=1476981">Check out this article (now without annoying print dialog).</a></p>
<p>I just checked the logs today &#8211; we hit a new record: an aerial truck went for $22,000 dollars.  With the Board receiving 5% ($1100) of that simply for hosting, I think everybody is walking away happy.</p>
<p><a href="http://www.dsbn.edu.on.ca/purchasing/gsoa">Here&#8217;s the auction.</a></p>
<p>Proof that I wrote it?  <a href="http://www.dsbn.edu.on.ca/purchasing/gsoa/CREDITS.txt">This&#8217;ll have to do.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mikeconley.ca/blog/2009/03/28/my-web-app-in-the-news/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Model-View-Controller in PHP:  Model</title>
		<link>http://mikeconley.ca/blog/2009/02/13/model-view-controller-in-php-model/</link>
		<comments>http://mikeconley.ca/blog/2009/02/13/model-view-controller-in-php-model/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 16:34:19 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[activerecord]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[late static binding]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[model-view-controller]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[rowdatagateway]]></category>

		<guid isPermaLink="false">http://mikeconley.ca/blog/?p=93</guid>
		<description><![CDATA[(Notes: the code here has been taken directly from the PHP Late Static Binding documentation if you want a more verbose and thorough explanation of this problem, check this out ) I have one thing to say for all of those PHP developers who look at Rails&#8217; ActiveRecord class and get all excited about implementing [...]]]></description>
			<content:encoded><![CDATA[<p>(Notes:</p>
<ul>
<li>the code here has been taken directly from the <a href="http://ca2.php.net/oop5.late-static-bindings" target="_self">PHP Late Static Binding documentation</a></li>
<li>if you want a more verbose and thorough explanation of this problem, <a href="http://www.actsasflinn.com/trackbacks?article_id=php-and-activerecord&amp;day=08&amp;month=08&amp;year=2007 " target="_self">check this out</a></li>
</ul>
<p>)</p>
<p>I have one thing to say for all of those PHP developers who look at Rails&#8217; ActiveRecord class and get all excited about implementing it in PHP:</p>
<p>It can&#8217;t be done.  Yet.</p>
<p>Here&#8217;s why:</p>
<p>Until PHP5.3, PHP does not implement a feature called &#8220;late static binding&#8221;.  What is late static binding?  Well, how about I show you what it&#8217;s like to NOT have late static binding:</p>
<pre>class A {
   public static function who() {
     echo __CLASS__;
   }
   public static function test() {
     self::who();
  }
}
class B extends A {
  public static function who() {
    echo __CLASS__;
  }
}
B::test();  //Outputs:  'A'</pre>
<p>That&#8217;s right:  B::test() outputs &#8216;A&#8217;.  This is a problem, because while it is true that B is a subclass of A, B is still B.  When I call a static method of B, I want it to know that it&#8217;s B.</p>
<p>With late static binding (only available in PHp5.3 and onward), this goes away:</p>
<pre>&lt;?php
class A {
  public static function who() {
    echo __CLASS__;
  }
  public static function test() {
    static::who(); // Here comes Late Static Bindings
  }
}
class B extends A {
  public static function who() {
    echo __CLASS__;
  }
}
B::test();  //Outputs 'B'
?&gt;</pre>
<p>Why is this a problem for ActiveRecord?  Well, say we define a class called ActiveRecord, and create a subclass of ActiveRecord called Person.  When I call Person::find_all(), PHP5.2 is going to run find_all in ActiveRecord &#8211; and ActiveRecord&#8217;s find_all() will not know what kind of subclass I am.  It won&#8217;t know if I&#8217;m a Person, Dog, Pizza, or any of that jazz.  Essentially, ActiveRecord is now dead in the water.</p>
<p>Now, you could just make find_all a standard method instead of a static one, but then for every find operation, you&#8217;d have to do this:</p>
<pre>$p = new Person();
$persons = $p-&gt;find_all();</pre>
<p>Semantically, this doesn&#8217;t make much sense.</p>
<p><em>But, PHP coders, take heart -  there are two silver linings:</em></p>
<ul>
<li>PHP5.3 has late static bindings!  As soon as it&#8217;s released, rejoice, and implement ActiveRecord</li>
<li><a href="http://www.actsasflinn.com/2007/08/08/php-and-activerecord" target="_self">There&#8217;s always RowDataGateway!</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mikeconley.ca/blog/2009/02/13/model-view-controller-in-php-model/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Model-View-Controller in PHP:  View</title>
		<link>http://mikeconley.ca/blog/2009/02/09/model-view-controller-in-php/</link>
		<comments>http://mikeconley.ca/blog/2009/02/09/model-view-controller-in-php/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 02:25:36 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[model-view-controller]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[views]]></category>

		<guid isPermaLink="false">http://mikeconley.ca/blog/?p=37</guid>
		<description><![CDATA[I&#8217;ve been programming in PHP for a few years now, and after being exposed to MVC through Ruby on Rails back in 2007, I came to realize that I liked the idea of keeping the presentation of data separate from the manipulation of data. So I built a View class.  Download View Class Usage: $view [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been programming in PHP for a few years now, and after being exposed to MVC through Ruby on Rails back in 2007, I came to realize that I liked the idea of keeping the presentation of data separate from the manipulation of data.</p>
<p>So I built a View class.  <a href="http://mikeconley.ca/blog/wp-content/uploads/2009/02/viewclass.phps">Download View Class</a></p>
<p>Usage:</p>
<pre>$view = new View('views/main_page.tpl', array(
       'some_var' =&gt; 'This will be assigned to $some_var in the view'));
$view-&gt;render();</pre>
<p>And like that, data presentation is separated from data manipulation.</p>
<p>Piece of cake.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikeconley.ca/blog/2009/02/09/model-view-controller-in-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

