<?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>Jon Lebensold &#187; Commentary</title>
	<atom:link href="http://lebensold.net/category/commentary/feed" rel="self" type="application/rss+xml" />
	<link>http://lebensold.net</link>
	<description>thoughts on web development, technology and media</description>
	<lastBuildDate>Tue, 22 Jun 2010 16:04:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Interview on the Coding Pad</title>
		<link>http://lebensold.net/development/interview-on-the-coding-pad</link>
		<comments>http://lebensold.net/development/interview-on-the-coding-pad#comments</comments>
		<pubDate>Tue, 09 Feb 2010 20:28:04 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Commentary]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[aboutme]]></category>

		<guid isPermaLink="false">http://lebensold.net/?p=386</guid>
		<description><![CDATA[Mary at the Coding Pad contacted me about doing a little interview about myself and my work as a PHP developer. If you're subscribed to my blog or remotely interested in what makes me tick, I invite you to check it out. The Coding Pad is a great blog that's featured other developers as well [...]]]></description>
			<content:encoded><![CDATA[<p>Mary at the Coding Pad contacted me about doing a little interview about myself and my work as a PHP developer. If you're subscribed to my blog or remotely interested in what makes me tick, I invite you to <a href="http://codingpad.maryspad.com/2010/02/09/jon-lebensold-php-zend-framework/">check it out</a>. The Coding Pad is a great blog that's featured other developers as well as provides tutorial content on various PHP frameworks.</p>
]]></content:encoded>
			<wfw:commentRss>http://lebensold.net/development/interview-on-the-coding-pad/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Happy 2010!</title>
		<link>http://lebensold.net/commentary/happy-2010</link>
		<comments>http://lebensold.net/commentary/happy-2010#comments</comments>
		<pubDate>Mon, 11 Jan 2010 18:18:48 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Commentary]]></category>

		<guid isPermaLink="false">http://lebensold.net/?p=383</guid>
		<description><![CDATA[Just a quick note to say I'm still alive. I've moved in to a new place with my lovely wife and we're slowly settling into a routine. I'll be posting photos, videos and more code in the coming weeks. Lots of projects in the works that will be nearing completion soon!
]]></description>
			<content:encoded><![CDATA[<p>Just a quick note to say I'm still alive. I've moved in to a new place with my lovely wife and we're slowly settling into a routine. I'll be posting photos, videos and more code in the coming weeks. Lots of projects in the works that will be nearing completion soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://lebensold.net/commentary/happy-2010/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Speaking at Intuit about Google Wave, QuickBase and Zend</title>
		<link>http://lebensold.net/commentary/speaking-at-intuit-about-google-wave-quickbase-and-zend</link>
		<comments>http://lebensold.net/commentary/speaking-at-intuit-about-google-wave-quickbase-and-zend#comments</comments>
		<pubDate>Mon, 16 Nov 2009 16:25:44 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Commentary]]></category>
		<category><![CDATA[intuit]]></category>
		<category><![CDATA[speaking]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[zendcasts]]></category>

		<guid isPermaLink="false">http://lebensold.net/?p=378</guid>
		<description><![CDATA[Over the last 5 months, I've had the pleasure of working with some of the bright minds at Intuit (the makers of QuickBase and Quicken). Intuit decided to use the Zend Framework for their QuickBase marketing site and approached me to help them with the integration. With their recent acquisition of Mint, I have no [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-380 alignright" title="qb-gwave-promo" src="http://lebensold.net/wp-content/uploads/2009/11/qb-gwave-promo.jpg" alt="qb-gwave-promo" width="300" height="240" />Over the last 5 months, I've had the pleasure of working with some of the bright minds at Intuit (the makers of QuickBase and Quicken). Intuit decided to use the Zend Framework for their <a href="http://quickbase.intuit.com">QuickBase marketing site</a> and approached me to help them with the integration. With their recent acquisition of Mint, I have no doubt that their Web Applications are going to become a significant growth area in their business. I've also been fooling around with Google Wave and thought it might be neat to see if I can put together a simple application that utilizes Intuit's Online Database service, the Zend Framework and the Google Wave Gadgets API.</p>
<p>If you're interested in Google Wave, QuickBase, Zend my webinar on <strong>Wednesday, November 18</strong> might help you with your own development in these areas. I invite you to <a href="http://www.zendcasts.com/googlewave-quickbase-zend/">register to attend this live Zendcast</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://lebensold.net/commentary/speaking-at-intuit-about-google-wave-quickbase-and-zend/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Facebook&#8217;s Encouraging Worst Practices</title>
		<link>http://lebensold.net/commentary/facebooks-encouraging-worst-practices</link>
		<comments>http://lebensold.net/commentary/facebooks-encouraging-worst-practices#comments</comments>
		<pubDate>Sun, 01 Nov 2009 03:17:57 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Commentary]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://lebensold.net/?p=372</guid>
		<description><![CDATA[I'm not a huge fan of Facebook to begin with, however they are an undeniable part of any online marketing strategy and are likely to remain as such for at least another 6-10 months (which is an eternity by web standards). I've recently been working on a Facebook application built on the Zend Framework. Our [...]]]></description>
			<content:encoded><![CDATA[<p>I'm not a huge fan of Facebook to begin with, however they are an undeniable part of any online marketing strategy and are likely to remain as such for at least another 6-10 months (which is an eternity by web standards). I've recently been working on a Facebook application built on the Zend Framework. Our team is sprinkled across the United States and Canada and we're all committing to an SVN repo and running updates from there to Facebook. While dev / test / staging / production is a typical approach to web development, Facebook's FBML and FBJS make local development practically impossible without a really fat development harness.</p>
<p>If you choose to use their iframe approach, you're putting the burden of maintaining the Facebook look &amp; feel entirely on your own shoulders. If Facebook decides to change their design (which they do pretty frequently), your application will be forced to play catch up. All this puts the developers at the mercy of the platform. At least with Microsoft, you could choose when to upgrade when you had the time and money to burn a hole in your wallet. Facebook unfortunately doesn't provide best practices for enterprise development. This is no surprise when one discovers that their testing model involves inflicting new changes to subsets of their user base rather than going through the trouble of creating a testable development environment.</p>
<p>In the longterm, I think this will hinder v2 versions of Facebook applications. If Facebook wants to see more powerful enterprise integration, they'll have to provide more than what's required to create a "grow your own bonzai" application.</p>
]]></content:encoded>
			<wfw:commentRss>http://lebensold.net/commentary/facebooks-encouraging-worst-practices/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interview with the Gang of Four</title>
		<link>http://lebensold.net/development/interview-with-the-gang-of-four</link>
		<comments>http://lebensold.net/development/interview-with-the-gang-of-four#comments</comments>
		<pubDate>Mon, 26 Oct 2009 01:20:40 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Commentary]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[design patterns]]></category>

		<guid isPermaLink="false">http://lebensold.net/?p=366</guid>
		<description><![CDATA[My father sent this wonderful interview to me with the author's of the book "Design Patterns". I still find that it introducing people who aren't software engineers to the concept of web architecture, design patterns and software development workflow that it still takes a bit for someone to see how someone could appreciate the design [...]]]></description>
			<content:encoded><![CDATA[<p>My father sent <a href="http://www.informit.com/articles/article.aspx?p=1404056">this wonderful interview</a> to me with the author's of the book "Design Patterns". I still find that it introducing people who aren't software engineers to the concept of web architecture, design patterns and software development workflow that it still takes a bit for someone to see how someone could appreciate the design and elegance behind a particular architecture.</p>
<p>In the words of Ralph Johnson:</p>
<blockquote><p>Designing software is hard. That is what makes it so fun! People who are good at designing software enjoy solving hard problems, at bringing order to chaos, at overcoming difficulties. Things that used to be hard are now easy, but we have moved on to working on problems that would have been impossible 20 years ago. OO programming helps but does not eliminate the difficulty of design.</p></blockquote>
<p>I always assumed that Christopher Alexander's A Pattern Language was some source of inspiration for these gentlemen and I was surprised to find out that it wasn't in fact the case.</p>
]]></content:encoded>
			<wfw:commentRss>http://lebensold.net/development/interview-with-the-gang-of-four/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Review of Learning Dojo</title>
		<link>http://lebensold.net/development/review-of-learning-dojo</link>
		<comments>http://lebensold.net/development/review-of-learning-dojo#comments</comments>
		<pubDate>Thu, 23 Apr 2009 19:21:43 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Commentary]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[book review]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://lebensold.net/?p=339</guid>
		<description><![CDATA[Recently, Packt contacted me about doing a review of Learning Dojo.
The author, Peter Svennson, is probably one of the most qualified people in the world to be writing a book about Dojo, considering he's a contributor. The book takes plenty of time covering some of the more common Dijits and how best to apply them [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, Packt contacted me about doing a review of <a href="http://www.packtpub.com/tutorial-for-building-interactive-interfaces-with-dojo/book">Learning Dojo</a>.</p>
<p><a href="https://www.amazon.com/dp/1847192688?tag=lebensoldnet-20"><img class="alignright size-medium wp-image-340" title="Learning Dojo by Peter Svennson" src="http://lebensold.net/wp-content/uploads/2009/04/picture-3-231x300.png" alt="Learning Dojo by Peter Svennson" width="231" height="300" /></a>The author, Peter Svennson, is probably one of the most qualified people in the world to be writing a book about Dojo, considering he's a contributor. The book takes plenty of time covering some of the more common Dijits and how best to apply them in an application. Like any framework, knowledge of certain core components helps when extending that knowledge across the rest of the library.</p>
<p>As someone who's worked extensively with JQuery and Prototype, I appreciated the authors recognition of other frameworks, while being able to diplomatically keep the discussion focused on Dojo without diminishing the work done on the other site of the Javascript framework fence.</p>
<p>Before being totally entrenched in the various Dojo libraries, Svennson takes a couple pages to explain closures and Javascript's prototype based object model. I found his explanation enlightening and a good starting point for a conversation on Dojo. Svennson also sold me on Dojo's class building framework.</p>
<p>What kept me flipping through the pages was Svennson's passion for the technology. The writing style is informal and conveys his personal interest in Dojo's architecture. However sometimes I felt this same passionate writing starts to read more like a sales pitch and less like a serious technical reference.</p>
<p>If you're the type of person that likes to work through a practical application of the technology, Learning Dojo is probably not the best book for the job. Instead of figuring out how to build a form with client-side validation that showcases all the Dojo bells and whistles (which I don't think one app could truly do), you're invited to create custom events, learn how to build class structures with pseudo-inheritance, look at localization and ways of theming your application. Since a lot of these features are design-releated, they tend to feel disjoint.</p>
<p>Only in the last chapter are we introduced to "real-world Dojo". While the examples are great, they feel almost tacked on. Regardless, the multi-charting project and the CRUD application cover a lot of components that were already discussed previously. It's also nice to see that Svennson mentions how to unit test using DOH. Learning Dojo is by no means a book for beginners: as the book progresses, there are large chunks of markup that are loosely explained in passing.</p>
<p>If you're already married to Dojo, planning a site in Dojo or inheriting something written in Dojo, this book could be a great reference for getting familiar with the technology quickly. If this sounds like you, grab a copy from Amazon.</p>
<p>UPDATE: enjoy reading <a href="http://www.packtpub.com/files/learning-dojo-sample-chapter-6-layout.pdf">Chapter 6</a> for free online!<br />
<iframe src="http://rcm.amazon.com/e/cm?t=lebensoldnet-20&o=1&p=8&l=as1&asins=1847192688&md=10FE9736YVPPT7A0FBG2&fc1=000000&IS2=1&lt1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://lebensold.net/development/review-of-learning-dojo/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pontus &amp; Mon: a world in seven frames</title>
		<link>http://lebensold.net/creative-stuff/pontus-mon-a-world-in-seven-frames</link>
		<comments>http://lebensold.net/creative-stuff/pontus-mon-a-world-in-seven-frames#comments</comments>
		<pubDate>Wed, 11 Feb 2009 01:07:09 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Commentary]]></category>
		<category><![CDATA[Creative stuff]]></category>
		<category><![CDATA[webcomic]]></category>

		<guid isPermaLink="false">http://lebensold.net/?p=300</guid>
		<description><![CDATA[So I decided to take a stab at a web comic... its a short narrative that takes place in the future. The original idea was described by a friend of mine as being in "bad taste". With that in mind, I decided to stick to the visuals. Enjoy Pontus &#38; Mon: a world in seven [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lebensold.net/pontusandmon/" style="padding:5px;"><img  class="alignnone size-medium wp-image-301 alignleft" title="picture-1" src="http://lebensold.net/wp-content/uploads/2009/02/picture-1-300x164.png" alt="" width="300" height="164" /></a>So I decided to take a stab at a web comic... its a short narrative that takes place in the future. The original idea was described by a friend of mine as being in "bad taste". With that in mind, I decided to stick to the visuals. Enjoy <a href="http://lebensold.net/pontusandmon/">Pontus &amp; Mon: a world in seven frames</a>.</p>
<p><br/><br/><br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://lebensold.net/creative-stuff/pontus-mon-a-world-in-seven-frames/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What does nasty code look like to you?</title>
		<link>http://lebensold.net/development/what-does-nasty-code-look-like-to-you</link>
		<comments>http://lebensold.net/development/what-does-nasty-code-look-like-to-you#comments</comments>
		<pubDate>Mon, 01 Sep 2008 17:12:51 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Commentary]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[code samples]]></category>
		<category><![CDATA[code smell]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[refactoring]]></category>

		<guid isPermaLink="false">http://jon.lebensold.ca/?p=199</guid>
		<description><![CDATA[Ayende, C# guru in his own right and author of Rhino.Mocks (a C# mocking / testing framework) has released some code that he's going to use as "legacy code" for demonstration purposes.
This stuff reeks of code smell. enormous functions, multiple levels of nested conditional logic, mixing of concerns... the whole thing is a case study [...]]]></description>
			<content:encoded><![CDATA[<p>Ayende, C# guru in his own right and author of Rhino.Mocks (a C# mocking / testing framework) has released some code that he's going to use as "legacy code" for demonstration purposes.</p>
<p><a href="http://ayende.com/Blog/archive/2008/08/27/What-I-am-working-on.aspx">This stuff reeks of code smell</a>. enormous functions, multiple levels of nested conditional logic, mixing of concerns... the whole thing is a case study on how NOT to write code. </p>
<p>The comments are also quite interesting.</p>
<p>This got me thinking about what would probably have been the worst PHP code I've written. I went digging through an old shell account I have and found something from the first CMS I wrote (probably around 5+ years ago):</p>
<pre class="php">&nbsp;
 <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$upload</span> == <span style="color: #ff0000;">&quot;photo&quot;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
	<span style="color: #66cc66;">&#123;</span>
&nbsp;
	<span style="color: #0000ff;">$realname</span> = <span style="color: #0000ff;">$HTTP_POST_FILES</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'userfile'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'tmp_name'</span><span style="color: #66cc66;">&#93;</span>;
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/is_uploaded_file"><span style="color: #000066;">is_uploaded_file</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$HTTP_POST_FILES</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'userfile'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'tmp_name'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0000ff;">$filename</span> = <span style="color: #0000ff;">$HTTP_POST_FILES</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'userfile'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'tmp_name'</span><span style="color: #66cc66;">&#93;</span>;
&nbsp;
		<span style="color: #0000ff;">$realname</span> = <span style="color: #0000ff;">$HTTP_POST_FILES</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'userfile'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'name'</span><span style="color: #66cc66;">&#93;</span>;
&nbsp;
		@<a href="http://www.php.net/chmod"><span style="color: #000066;">chmod</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;$userfile&quot;</span>,<span style="color: #cc66cc;">0777</span><span style="color: #66cc66;">&#41;</span>;
		<a href="http://www.php.net/copy"><span style="color: #000066;">copy</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$HTTP_POST_FILES</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'userfile'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'tmp_name'</span><span style="color: #66cc66;">&#93;</span>,ROOT.<span style="color: #ff0000;">&quot;/gallery/$imagefolder/$path/&quot;</span>.<span style="color: #0000ff;">$realname</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #0000ff;">$size</span> = <a href="http://www.php.net/getimagesize"><span style="color: #000066;">getimagesize</span></a><span style="color: #66cc66;">&#40;</span>ROOT.<span style="color: #ff0000;">&quot;/gallery/$imagefolder/$path/$realname&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0000ff;">$size2</span> = <a href="http://www.php.net/filesize"><span style="color: #000066;">filesize</span></a><span style="color: #66cc66;">&#40;</span>ROOT.<span style="color: #ff0000;">&quot;/gallery/$imagefolder/$path/$realname&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	<span style="color: #808080; font-style: italic;">// thumbnail</span>
&nbsp;
	<span style="color: #0000ff;">$name</span> = ROOT.<span style="color: #ff0000;">&quot;/gallery/$imagefolder/$path/$realname&quot;</span>;	
&nbsp;
	<span style="color: #0000ff;">$data</span> = <a href="http://www.php.net/getimagesize"><span style="color: #000066;">GetImageSize</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0000ff;">$im</span> = @imagecreatefromjpeg<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span><span style="color: #66cc66;">&#41;</span>; 
&nbsp;
	<span style="color: #0000ff;">$w</span> = <span style="color: #0000ff;">$data</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>;
	<span style="color: #0000ff;">$h</span>= <span style="color: #0000ff;">$data</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>;
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$w</span> &gt; <span style="color: #0000ff;">$h</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span> 
&nbsp;
			<span style="color: #0000ff;">$nh</span> = <span style="color: #cc66cc;">125</span>; <span style="color: #808080; font-style: italic;">// This is the MAX height of your thumbs</span>
			<span style="color: #0000ff;">$ratio</span> = <span style="color: #0000ff;">$nh</span>/<span style="color: #0000ff;">$h</span>;
			<span style="color: #0000ff;">$nw</span> = <span style="color: #0000ff;">$w</span>*<span style="color: #0000ff;">$ratio</span>;
&nbsp;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #b1b100;">else</span>
			<span style="color: #66cc66;">&#123;</span>
&nbsp;
			<span style="color: #0000ff;">$nh</span> = <span style="color: #cc66cc;">125</span>; <span style="color: #808080; font-style: italic;">// This is the MAX height of your thumbs</span>
			<span style="color: #0000ff;">$ratio</span> = <span style="color: #0000ff;">$nh</span>/<span style="color: #0000ff;">$h</span>;
			<span style="color: #0000ff;">$nw</span> = <span style="color: #0000ff;">$w</span>*<span style="color: #0000ff;">$ratio</span>;
&nbsp;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$truecolour</span> == <span style="color: #ff0000;">&quot;TRUE&quot;</span><span style="color: #66cc66;">&#41;</span>
	   <span style="color: #66cc66;">&#123;</span>
	        <span style="color: #0000ff;">$ni</span>=imagecreatetruecolor<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$nw</span>,<span style="color: #0000ff;">$nh</span><span style="color: #66cc66;">&#41;</span>;
	   <span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">else</span>
	   <span style="color: #66cc66;">&#123;</span>
		<span style="color: #0000ff;">$ni</span>=imagecreate<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$nw</span>,<span style="color: #0000ff;">$nh</span><span style="color: #66cc66;">&#41;</span>;
	   <span style="color: #66cc66;">&#125;</span>
&nbsp;
	ImageCopyResampled<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$ni</span>,<span style="color: #0000ff;">$im</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #0000ff;">$nw</span>,<span style="color: #0000ff;">$nh</span>,<span style="color: #0000ff;">$w</span>,<span style="color: #0000ff;">$h</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	ImageJPEG<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$ni</span>,ROOT.<span style="color: #ff0000;">&quot;/gallery/$imagefolder/$path/$thumbfolder/$realname&quot;</span>,<span style="color: #0000ff;">$thumbqual</span><span style="color: #66cc66;">&#41;</span>; 
&nbsp;
	@<a href="http://www.php.net/chmod"><span style="color: #000066;">chmod</span></a><span style="color: #66cc66;">&#40;</span>ROOT.<span style="color: #ff0000;">&quot;/gallery/$imagefolder/$path/$thumbfolder/$realname&quot;</span>,<span style="color: #cc66cc;">0777</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	 <a href="http://www.php.net/print"><span style="color: #000066;">PRINT</span></a> <span style="color: #ff0000;">&quot;
&lt;p style=<span style="color: #000099; font-weight: bold;">\&quot;</span>text-align:center<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;
&nbsp;
	 New image has been uploaded
	 If you are not redirected to the add image page &lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>$PHP_SELF?path=$path<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;click here&lt;/a&gt;
&nbsp;
&nbsp;
        &lt;META HTTP-EQUIV=<span style="color: #000099; font-weight: bold;">\&quot;</span>Refresh<span style="color: #000099; font-weight: bold;">\&quot;</span> CONTENT=<span style="color: #000099; font-weight: bold;">\&quot;</span>1;URL=$PHP_SELF?path=$path<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span>;
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">else</span>
&nbsp;
	<span style="color: #66cc66;">&#123;</span>
	 <a href="http://www.php.net/print"><span style="color: #000066;">PRINT</span></a> <span style="color: #ff0000;">&quot;
&lt;div style=<span style="color: #000099; font-weight: bold;">\&quot;</span>text-align:center<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;
&lt;h1&gt;An Error Occurred&lt;/h1&gt;
&nbsp;
You must select a JPEG image from your harddrive, and it should be less than
	 your upload limit (normall 2MB)
	 If you are not redirected to the image page &lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>$PHP_SELF<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;click here&lt;/a&gt;
&lt;/div&gt;
&nbsp;
        &lt;META HTTP-EQUIV=<span style="color: #000099; font-weight: bold;">\&quot;</span>Refresh<span style="color: #000099; font-weight: bold;">\&quot;</span> CONTENT=<span style="color: #000099; font-weight: bold;">\&quot;</span>10;URL=$PHP_SELF<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span>;
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>What's the nastiest thing you can remember writing?</p>
]]></content:encoded>
			<wfw:commentRss>http://lebensold.net/development/what-does-nasty-code-look-like-to-you/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dojo and Zend: Where&#8217;s the loose coupling gone?</title>
		<link>http://lebensold.net/zend/dojo-and-zend-wheres-the-loose-coupling-gone</link>
		<comments>http://lebensold.net/zend/dojo-and-zend-wheres-the-loose-coupling-gone#comments</comments>
		<pubDate>Wed, 13 Aug 2008 20:28:50 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Commentary]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[dojo]]></category>

		<guid isPermaLink="false">http://jon.lebensold.ca/?p=151</guid>
		<description><![CDATA[On the eve of the release of the Zend Framework's 1.6RC, found it interesting to read Lukas' comment on Matthew Weier O'Phinney's blog about how there were outstanding issues in existing core components of the Zend Framework that hadn't been resolved, and yet the Zend_* component library was still growing and accepting new proposals. 
The [...]]]></description>
			<content:encoded><![CDATA[<p>On the eve of the release of the Zend Framework's 1.6RC, found it interesting to read <a href='http://pooteeweet.org/'>Lukas</a>' comment on <a href='http://weierophinney.net/matthew/'>Matthew Weier O'Phinney's blog</a> about how there were outstanding issues in existing core components of the Zend Framework that hadn't been resolved, and yet the Zend_* component library was still growing and accepting new proposals. </p>
<p>The last comment by Martin noted that Zend_Db still had some unresolved issues for over a year. </p>
<p>Matthew's response was that this was a community project and that priorities are dictated as such. Personally, this doesn't affect me because I'm hedging my bets on Doctrine as an ORM layer for PHP development. </p>
<p>I like Matthew's response because the Zend Framework's philosophy encourages the development of loosely coupled components wrapped up in a development philosophy that encourages open contributions, financial backing (thanks to Zend, IBM, Sun and others), Unit Testing and project transparency. Here's where things go a little wonky.</p>
<h1>Partnership with the Dojo community</h1>
<p>While I really enjoy the implementation of Zend_Form on the server side. It allows multiple configurations, supports validation and while the decorators are a bit obtuse, on a whole, the Zend_Form libraries thin out controllers and encapsulate the concern of data entry in a clean manner.</p>
<p>In this point release, however it seems like there's been a whole outgrowth of Zend_Dojo_* classes that cater to doing AJAX development with the Dojo stack. I'm not sold on Dojo as a client-side framework. Past experience with it has left me trying to sort out a large, over-specialized collection of patterns that almost do what I want but not quite. I also don't like the coupling that occurs between the data set, the client-side validation and the magic rendering of panels (like Accordian's and content panes). </p>
<h1>An alternative architectural approach</h1>
<p>I would rather write the events, the theme, the data and the validation separately and reduce duplication in each of those patterns rather than in the UI pattern as a whole. In short, I think they've abstracted the wrong part. The same example can be seen in ASP.NET form validators from two years ago.</p>
<p>With Prototype, I can rapidly mock out a site with the functional requirements and use Script.aculo.us to accent the presentation with animation. My functional specification isn't muddied with fancy visuals and it lets me focus on the event handling, validation and end states rather than the fancy effects.</p>
<p>By using Zend_Dojo, you won't be tempted to build a well-exposed Service Layer from Zend_Controller. The advantage here is that you lead development towards service-orientation. If you need to write a Flex front-end, or a whole new business-tier, you at least have the beginnings of a web service, whereas if your working with Zend_Dojo's declarative templating syntax, you're already coupling the events, validation and data into heavily abstracted UI patterns.</p>
<p>This approach doesn't lead development towards the production of a refined Service Layer, but to a specialized Dojo-friendly interface with markup-generation from Zend_Form classes into Dojo markup. I would rather see a Zend_Form Service API where developers can send / receive JSON messages to inherited Zend_Form and then have the Dojo community write an Adapter that would send / receive messages from Dojo widgets.</p>
<p>A year or two from now, I wouldn't be surprised if people will look at the same Zend bug tracker, asking where support for Dojo went after the Zend team jumps to the next cool Javascript framework on the block and we find ourselves with Zend_Form_SproutCore or some other dependency.</p>
]]></content:encoded>
			<wfw:commentRss>http://lebensold.net/zend/dojo-and-zend-wheres-the-loose-coupling-gone/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Domain Patterns. Transaction Script, Table Module, Domain Model</title>
		<link>http://lebensold.net/development/domain-patterns-transaction-script-table-module-domain-model</link>
		<comments>http://lebensold.net/development/domain-patterns-transaction-script-table-module-domain-model#comments</comments>
		<pubDate>Tue, 12 Aug 2008 02:58:23 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Commentary]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[poeaa]]></category>

		<guid isPermaLink="false">http://jon.lebensold.ca/?p=145</guid>
		<description><![CDATA[I've been going back to Patterns of Enterprise Application Architecture lately to brush up on some concepts in order to apply them to PHP with Zend and Doctrine. 
At the beginning of the book, Martin Fowler suggests that there's a fork at the beginning of every development road where each project either ends up attempting [...]]]></description>
			<content:encoded><![CDATA[<p>I've been going back to <a href="http://www.amazon.com/Enterprise-Application-Architecture-Addison-Wesley-Signature/dp/0321127420/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1228246614&amp;sr=8-1&amp;tag=lebensoldnet-20">Patterns of Enterprise Application Architecture</a> lately to brush up on some concepts in order to apply them to PHP with Zend and Doctrine. </p>
<p>At the beginning of the book, Martin Fowler suggests that there's a fork at the beginning of every development road where each project either ends up attempting to use Transaction Scripts, a Table Module, or a Domain Model. He argues that as project complexity increases, the two former design methodologies start to break down, causing code duplication and unmanageable complexity.</p>
<h1>Transaction Scripts</h1>
<p><i>Organizes business logic by procedures where each procedure handles a single request from the presentation.</i> <a href='http://martinfowler.com/eaaCatalog/transactionScript.html' rel='nofollow'>–Martin Fowler</a></p>
<p>In PHP, a transaction script sounds like a simple function call. It could be something as simple as:</p>
<pre class="php">&nbsp;
saveWishlist<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$currentWishlist</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>saveWishlist() could easily grab $currentWishlist, which could be an object containing a wishlist and a user ID and run an INSERT statement against a MySQL database.</p>
<p>This ends up becoming a problem if wishlists start having alternate transactions with similar logic. For example, what if the wishlist belongs to a preferred customer, or someone of a particular region? What if the application grows and now includes wedding lists and birthday lists? Each one of these procedures would perform near identical operations against the database.</p>
<h1>Table Module</h1>
<p><i>A single instance that handles the business logic for all rows in a database table or view.</i><a href='http://martinfowler.com/eaaCatalog/tableModule.html' rel='nofollow'>–Martin Fowler</a></p>
<p>Lists are beginning to become an abstract concept in the application. At this point, a list could actually be an object that represents a table row in the database. A Table Module pattern would have a series of objects that would encapsulate rules for particular tables.</p>
<p>We can have a <i>MarriageList</i> object representing a marriage_list table, and a <i>BirthdayList</i> object representing a birthday_list table. In each of these objects, we would put business rules specific to each class / table.</p>
<h1>A Domain Model</h1>
<p><i>An object model of the domain that incorporates both behavior and data.</i><a href='http://martinfowler.com/eaaCatalog/domainModel.html' rel='nofollow'>–Martin Fowler</a></p>
<p>Now a one-table-per-list approach to an extent... until the marketing director calls up the CIO and says that it would be really cool if you could "share" lists with friends (since he read that O'Reilly article from two years ago about Web 2.0). </p>
<p>All of a sudden, lists become a complex construct in your application. They start looking more like this:<br />
<img src="http://jon.lebensold.ca/wp-content/uploads/2008/08/picture-2.png" alt="domain model example using lists" title="domain model example using lists" width="459" height="227" class="size-full wp-image-147" /><br />
Each List object might have its own business rules based not only on what type of list it is, but also who is asking for it (is it your friend's birthday list that he's sharing with his girlfriend, or is it your own birthday list that you're sharing with your girlfriend?) The object graph above would allow some really neat code like:</p>
<pre class="php">&nbsp;
<span style="color: #0000ff;">$myFriends</span> = <span style="color: #0000ff;">$currentPerson</span>-&gt;<span style="color: #006600;">getFriends</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #0000ff;">$myFriendLists</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$myFriends</span>-&gt;<span style="color: #006600;">getFriends</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$friend</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #0000ff;">$myFriendLists</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #0000ff;">$friend</span>-&gt;<span style="color: #006600;">getAllLists</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>what we would end up with is a collection of all our friend's lists. We could do cross-referencing or reporting to see who likes what and create object graphs with entities or help users visualize common products among friends for each occasion. Note that these objects may or may not (and probably don't) correspond to rows in a database.</p>
<p>This kind of work is nearly impossible with a Table Module approach because modelling the person->friend (one-to-many) and correlating that with the person->lists (one-to-many) doesn't make much sense in the database directly, unless the whole application is based on list sharing. The code above could help form an Entity called FriendLists or we could make an Entity called FriendWeddingLists. Making these distinctions in code is much easier than in a normalized database.</p>
<h1>Is a Domain Model Worth It?</h1>
<p>I would say that in most cases, the answer to that question is no, however a lot of the tools in the Zend Framework and Doctrine facilitate the building of preliminary Domains. We can create simple object graphs and separate our models from the controller layer (anything inherited from Zend_Controller) through Repositories that aren't REAL Repositories by Evans / Fowler's definition. Regardless, they provide a coarse interface for the Controller to interact with the underlying data model.</p>
]]></content:encoded>
			<wfw:commentRss>http://lebensold.net/development/domain-patterns-transaction-script-table-module-domain-model/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
