<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.1" -->
<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/"
	>

<channel>
	<title>The Magic Position</title>
	<link>http://www.magicposition.com</link>
	<description>Widget development for beginners, web development for pros.</description>
	<pubDate>Mon, 04 Jun 2007 17:41:06 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1</generator>
	<language>en</language>
			<item>
		<title>Search Accessibility: a how-to</title>
		<link>http://www.magicposition.com/2007/06/04/search-accessibility-a-how-to/</link>
		<comments>http://www.magicposition.com/2007/06/04/search-accessibility-a-how-to/#comments</comments>
		<pubDate>Mon, 04 Jun 2007 16:23:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[webdev]]></category>

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

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

		<category><![CDATA[search accessibility]]></category>

		<guid isPermaLink="false">http://www.magicposition.com/2007/06/04/search-accessibility-a-how-to/</guid>
		<description><![CDATA[In my last post, I covered the politics of search accessibility, and why making your site available to all users is above all the profitable thing to do, without considering whether it&#8217;s the right thing. So now I&#8217;m going to cover how to make your site search accessible.
Please Feed the Spider
The program that runs around [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://www.magicposition.com/2007/05/31/accessiblity-and-seo-or-why-accessible-websites-are-not-for-the-disabled/">last post</a>, I covered the politics of search accessibility, and why making your site available to all users is above all the profitable thing to do, without considering whether it&#8217;s the right thing. So now I&#8217;m going to cover how to make your site search accessible.</p>
<h2>Please Feed the Spider</h2>
<p>The program that runs around the Internet reading every single page and throwing it into Google&#8217;s<a href="#thegoog">*</a> giant database is GoogleBot (Yahoo!&#8217;s is called Slurp). GoogleBot is your best friend, your worst enemy, your teddy bear and your mommy all rolled into one. GoogleBot is a very, very clever piece of software, but it&#8217;s not magical. Here is what GoogleBot does:</p>
<ol>
<li>It reads the text on your page and looks for &#8220;important&#8221; words and phrases</li>
<li>It reads the links on your page and sees what pages you&#8217;re linking to</li>
<li>It reads the links on the rest of the Internet and looks for pages that link to you</li>
<li>It then calculates how relevant your page is to the words in it, based on the words on the pages that link to it, and how relevant they are based on other sites, and so on</li>
</ol>
<p>Key take-home: <b>it&#8217;s all about keywords and links</b>. It is all about <b>text</b>. Attractive design and a witty site slogan and pictures of bikini models holding your product count for naught. As I mentioned in my last post, Google is in effect a disabled user using only the most basic of assistive technologies:</p>
<ol>
<li>It cannot see your images</li>
<li>It will not execute JavaScript. Not <b>any</b>. (Real disabled users can often do JavaScript using better software these days)</li>
<li>It&#8217;s not reading every bit of text on your page. It&#8217;s looking for the <b>important words</b>. And it&#8217;s in an almighty hurry.</li>
<li>It does not follow links that do not look like web pages.</li>
<li>It does not magically work out what your site is about. You need to make it obvious.</li>
</ol>
<p>Already, some of the key things you need to do for SEO are obvious, in order of importance:</p>
<ul>
<li><b>Link text is important</b>. Every time I see a link saying &#8220;click here&#8221; in 2007 it makes me want to weep. Link text is, above anything else, how Google decides what the page you&#8217;re linking to is about, and by working out what you&#8217;re linking <i>to</i> is how it works out what your page is <i>about</i>. Outgoing links aren&#8217;t silly, they&#8217;re essential.
<li>All your information must be accessible <b>with JavaScript disabled</b>, because that&#8217;s how Google sees the page.
<li>All your links must go to <b>real information</b>. &#8220;#&#8221; links are ignored, as are &#8220;javascript:..&#8221;. And the information on those pages must be relevant to the link text, obviously: don&#8217;t just link back to your home page.
<li>Any images must be described as text somewhere on the page, either within the ALT attribute, or some other technique<a href="#headlines">**</a>. Google ignores images (even image search is based on the text nearby).
</ul>
<h2>What&#8217;s an Important Word?</h2>
<p>It&#8217;s important to know what Google considers an &#8220;important&#8221; word. Google is more than a little secretive about this, but <a href="http://www.google.com/support/webmasters/bin/answer.py?answer=35769">Google has its own guidelines for site design</a> and professional, non-evil SEO people have their own <a href="http://www.organicseo.org/Optimizing_Your_Web_Page.html">search accessibility guidelines</a>. My own, very subjective impression from several years of experience, is that the most important words on your page are:</p>
<ol>
<li>The <b>link text going to your page</b>. Nothing you can do about this but be a very good website, and hope people link to you. You can do your bit by linking to other people with sensible keywords, of course, and hoping they link back &#8212; but trading links explicitly is something GoogleBot is designed to detect. And it&#8217;s been spotting fakers a lot longer than you&#8217;ve been faking, so I don&#8217;t recommend trying to fake it.</li>
<li>The <b>page title</b>. Don&#8217;t repeat your site name and slogan endlessly: say what this page in particular is about. Put keywords in there! It&#8217;s also what users see on the search results page, too, so make sure it makes sense to human beings.</li>
<li>The <b>meta description tag</b>. This is an odd one: Google doesn&#8217;t pay too much attention to it in calculating relevance, but at a certain level of relevance, this is what it puts as the text under your page title in the search results, where it suddenly becomes very important to users who are about to click your link. So it&#8217;s important that this text is descriptive, useful, and <i>short</i> &#8212; something under 100 words. And again, load up on keywords. Repeat yourself, phrasing the same thing several different ways.</li>
<li><b>H1 and H2 tags</b>. H3 is dicey and everything beyond that is meaningless, but H1s in particular are super important, but only because they are rare. If everything on your page is a goddamn H1 obviously Google is going to ignore you. Use 1 or 2 H1s, and less than 10 H2s.</li>
<li><b>ALT attributes on images</b>. This is way down the list, so if you have really important text in your images, it&#8217;s best to use the technique I outlined in the third footnote so that it turns up in an H1 or H2.</li>
</ol>
<h2>Order is important, or, Don&#8217;t use Tables</h2>
<p>Another aspect of your page that is extremely important to Google is <b>source code order</b>: literally, the order things appear in your source. Things that appear early on are likely to be more important than things that appear later. That seems obvious, right? But now look at your code: you&#8217;ve got the head, full of juicy meta data, and then you&#8217;ve got 5k of navigational elements, sidebar text, various other cruft, just placed first because you were using a left-floated column and so it was easier to put it there. This is killing you.</p>
<p>What&#8217;s much worse is when your source code order physically separates content that is semantically related: for instance, your headline is at the top of your page, <i>then</i> you have 5k of navigational cruft, <i>then</i> you have your content. Google will either fail to realise that your headline is describing your content, and thus not link the words, or worse, it will decide that your page doesn&#8217;t actually have any content on it relating to your headline, and you&#8217;re trying to spam it. Danger, Will Robinson!</p>
<p>And of course the number one offender from this perspective is using tables for layouts. If you care about web development, you&#8217;re probably aware that tables have serious issues with flexible, attractive layouts. However, that&#8217;s usually not a good enough reason to take to your boss: after all, it doesn&#8217;t bother her that your job is hard. However, tell her that <b>using tables is causing an 80% drop in traffic to your site</b> (as I explained in the last post) and suddenly you have an easy, obvious business case for reworking the layout of your code.</p>
<p>Tables put data into grid layout. If your data is in columns &#8212; and it frequently is, this means you often end up with a site code layout that looks like this:</p>
<blockquote>
<table border="2" cellpadding="3" cellspacing="0">
<tr>
<td>Site logo</td>
<td>Article headline</td>
</tr>
<tr>
<td>
<ul>
<li>List</li>
<li>of</li>
<li>nav</li>
<li>links</li>
</ul>
</td>
<td>Article body</td>
</tr>
</table>
</blockquote>
<p>To Google this reads like:</p>
<ul>
<li>Site logo
<li>Article headline
<li>List
<li>Of
<li>Nav
<li>Links
<li>Article body
</ul>
<p>So you can see why Google might get confused. So examine your code, and put things in the order of importance: you can use CSS to move stuff around on the page later. Coincidentally, source code order is also the order in which screen readers will read out your page to a blind user. So once again there&#8217;s a useful coincidence of making your site accessibile when you make it search accessible.</p>
<p>Of course &#8212; and I would have thought this was obvious, but I get questions about it that indicate to the contrary &#8212; you can use tables <b>when the data is tabular</b>. Don&#8217;t try to mark up your spreadsheet data using a series of stacked lists. Tables have real semantic meaning, but it has been diluted almost beyond help by their consistent misuse.</p>
<p>There is more I could tell you about SEO &#8212; the various hazily-defined statistical rules about how many links on a page is too many, optimal keyword density, and more, but these advanced techniques are icing on the cake, and the cake is made of search accessibility. It doesn&#8217;t matter what your keyword density is if Google can&#8217;t even get to your pages. So get out there and make the case for accessibility. And when the traffic is rolling in and your boss is giving you your huge bonus, you can get a tiny little extra bit of joy from knowing your site is also accessible to disabled users. </p>
<p class="footnote"><a name="thegoog">* When I say Google</a>, obviously I mean Yahoo!, Ask and all the other major search engines as well. They all work the same way. If Google didn&#8217;t want me to use their name to mean all search engines, they shouldn&#8217;t have made it a verb.</p>
<p class="footnote"><a name="headlines">** For important text</a> like headlines, it&#8217;s often better to put the text into the page directly in a semantically-meaningful element (like H1, H2, etc), make the text transparent, and then put the nicely-styled image in as a background image. This makes no difference to what your users see but it makes the words look a lot more &#8220;important&#8221; to Google.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.magicposition.com/2007/06/04/search-accessibility-a-how-to/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Accessiblity and SEO: or, why accessible websites are not for the disabled</title>
		<link>http://www.magicposition.com/2007/05/31/accessiblity-and-seo-or-why-accessible-websites-are-not-for-the-disabled/</link>
		<comments>http://www.magicposition.com/2007/05/31/accessiblity-and-seo-or-why-accessible-websites-are-not-for-the-disabled/#comments</comments>
		<pubDate>Thu, 31 May 2007 06:57:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[webdev]]></category>

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

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

		<category><![CDATA[search accessibility]]></category>

		<guid isPermaLink="false">http://www.magicposition.com/?p=5</guid>
		<description><![CDATA[Developers who care about accessibility are right, but they make their case for it entirely the wrong way. Accessibility is not primarily about helping disabled people: it's about money, and you making more of it. Helping the disabled is a bonus.]]></description>
			<content:encoded><![CDATA[<p>So I was at the <a href="http://www.vivabit.com/atmedia2007/">@media America</a> conference last week. There was much talk of accessibility and how to do it properly, when to do it, and even <a href="http://www.vivabit.com/atmedia2007/america/sessions/#when">when not to do it</a>. There was also talk about <i>why</i> to do it, but that&#8217;s where I think the speakers dropped the ball. <b>Accessibility is not about helping disabled people: it&#8217;s about money, and you making more of it</b>. (I&#8217;m going to use a lot of bold text in this post to emphasize stuff. That&#8217;s because it&#8217;s long, and you&#8217;re skim-reading. See, I know you.)</p>
<h2>Accessibility: because it&#8217;s the Right Thing&trade;?</h2>
<p>The dirty secret of accessibility, swept under the rug by many an evangelist, is that <b>the cost of making your site accessible is relatively high</b>: in my experience, something like 20% additional dev time on a new project, although experienced developers can bring this down, and the cost decreases dramatically for incremental updates once the project is up and running. But a 20% margin is definitely non-trivial. And if you&#8217;ve not been thinking in terms of accessibility from the start, this pricetag rises sharply: retrofitting accessibility often involves fundamentally reworking the architecture of a web page<a href="#rearchitect">*</a>. You&#8217;ll be looking at spending something like 50% of the time you spent originally developing the site on the retrofit. Ouch.</p>
<p>The other dirty secret of accessibility is that <b>the number of disabled users is relatively low</b>. Not <i>tiny</i>, but I often hear figures like &#8220;60% of Americans are disabled&#8221;, and while this is true, it&#8217;s disingenuous because that figure can include people like amputees or paraplegics who can use the web with no problems whatsoever. The truth is that somewhere <a href="http://www.usability.com.au/resources/statistics.cfm">between 10% and a maximum of 20% of your users will have trouble using your site without assistive technologies</a>. This makes it a very close call, when starting a new project &#8212; serving 80% of your possible users doesn&#8217;t seem ideal, but is an acceptable loss to get it out of the door 20% faster, right? You can build the accessibility in later!</p>
<p>Except you can&#8217;t. After launch, you&#8217;ve got an inaccessible site and you&#8217;re facing a 50% dev time bill to retrofit that acessibility in: another 3 weeks on what was a 6-week project, just to get 20% more users? That makes no business sense: much better to build another project, and get another 80% of users in the door quickly.<br />
This is the kind of unavoidable math that has made the web inaccessible today. And that&#8217;s the harsh truth: <b>building in accessibility for disabled users does not make business sense</b>. It&#8217;s still a good idea, a noble idea, but it&#8217;s not a financially sound one. This is <b>true in the real world, too</b>, which is why legislation was necessary to force everybody to put accessible toilets and wheelchairs in everywhere.</p>
<h2>Accessibility: because you could get sued?</h2>
<p>Of course, legislators have (eventually) worked out this problem, and as such there is already <a href="http://www.w3.org/WAI/Policy/">web accessibility legislation in place in many countries</a> that makes it illegal to produce an inaccessible website. Problem solved! It&#8217;s the law! We have to do it! Right?</p>
<p>In an ideal world, yes. In the real world, the law is only patchily enforced. Only a few <a href="http://www.suggestusability.com/2006/02/target-sued-over-inaccessible-website.html">very large, very high-profile sites have been sued</a> so far (plus some government sites). You can always fly under the radar, hope nobody notices, and not build in accessibility until they sue you. It&#8217;s a good gamble to make to avoid increasing the cost of your site by 50%, right? Again, the math defeats us.</p>
<p>But this is all very unsatisfying. You, the clever, compassionate, standards-compliant modern web developer, feel that this cold logic is intrinsically, morally wrong. So you make the case for accessibility: you try to inflate disabled user numbers (counterproductive; it will make your manager trust you less) and deflate the amount of time it will take to make it accessible (an even worse idea; now you&#8217;re missing deadlines because of &#8220;that damn accessibility stuff&#8221;, making your manager hate the whole idea).</p>
<p>So here&#8217;s how you, as a developer, can stay true to your noble impulses to build an elegant, accessible website: <b>stop calling it accessibility</b>.</p>
<h2>SEO: Open up, Google is coming!</h2>
<p>Search Engine Optimization, or SEO, is the hot shit right now. Google <i>is</i> the Internet for a lot of people, and if Google can&#8217;t find it, then it doesn&#8217;t exist. Nobody goes deep-diving on a site to try and dig up information anymore. Either they type in their search terms and your site comes up <i>with exactly what they need on that page</i>, or they will never click your link. Sites these days get 50-90% of their traffic from search engines<a href="#sitetraffic">**</a>, and the overwhelming majority of that is deep links to pages within the site.</p>
<p>So it&#8217;s absolutely imperative that search engines be able to access your site, and this isn&#8217;t just keywords on your home page: Google must be able to get at every single page of the site, every nook and cranny, and see every little bit of information. <b>A site that can&#8217;t be indexed is throwing away up to 90% of its audience</b>. In other words, this traffic is lost by sites that are not <b>search-accessible</b>. And there&#8217;s an interesting word in that phrase.</p>
<h2>Search Accessibility: because you&#8217;d be an idiot not to</h2>
<p>Here&#8217;s the final dirty little secret of this situation: <b>Google is a disabled user</b>. Or more accurately, Google has all the same limitations of somebody using assistive technologies:</p>
<ul>
<li>It doesn&#8217;t look at pictures</li>
<li>It does not execute any Javascript</li>
<li>It isn&#8217;t reading every bit of text on your page; it is looking for the important bits</li>
</ul>
<p>Suddenly, the equation changes: <b>at least 55% of your users need your site to be accessible</b>, and <b>possibly over 90% do</b>. Only 10-20% of them need it to be accessible <i>all the time</i>, but that doesn&#8217;t matter, because <b>up to 90% of your users will never even visit your site if it isn&#8217;t search accessible</b>. This isn&#8217;t out of solidarity, or legislation. They simply won&#8217;t find it. Search accessibility is not an optional component, to be bolted on after the main launch. Chances are, if you haven&#8217;t got your search accessibility right, there will never be a second launch, because your site will fail.</p>
<p>How can I further underline the importance of search accessibility to a web-based business? Let&#8217;s turn the numbers around: <b>you can more than double traffic to your website by making it search accessible</b>. Does that sound like something you could take to your manager as a business case? Keep in mind, 50% traffic from search engines is an absolute <b>minimum</b>. If you&#8217;re getting 90% of your traffic from Google, then making yourself search accessible will result in a <b>tenfold increase in traffic</b>. Those sorts of numbers are why SEO is now big business, with a whole industry built around paying consultants to tell you how to get it right. That industry wouldn&#8217;t exist if they weren&#8217;t getting results.</p>
<p>But you don&#8217;t need to pay somebody. Once you&#8217;ve got the big, obvious business case out of the way, and swallowed the bitter pill that doing things <b>properly</b> will take 20% longer, search accessibility is super-easy. For my own personal <a href="http://www.magicposition.com/2007/06/04/search-accessibility-a-how-to/">how-to for search accessibility</a>, see my next post.</p>
<p class="footnote"><a name="rearchitect">* For example</a>, if you&#8217;ve put a lot of business logic into JavaScript to enable Ajax goodness, making it accessible often means moving this logic to the server-side, which means reimplementing in a different language entirely, which is terribly expensive. You can write Ajax accessibly, so that business logic is always on the server and Ajax is merely a bridge, but you have to be thinking about it from the start. And as we&#8217;ve already established, you didn&#8217;t do that.</p>
<p class="footnote"><a name="sitetraffic">** This figure</a> is affected by the type of site, and the levels of traffic to that site. So your blog might get half its traffic from regular readers, but on an e-commerce site the figure is going to be 90%.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.magicposition.com/2007/05/31/accessiblity-and-seo-or-why-accessible-websites-are-not-for-the-disabled/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Why build a Widget?</title>
		<link>http://www.magicposition.com/2007/03/22/why-build-a-widget/</link>
		<comments>http://www.magicposition.com/2007/03/22/why-build-a-widget/#comments</comments>
		<pubDate>Thu, 22 Mar 2007 07:35:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[widgets]]></category>

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

		<guid isPermaLink="false">http://www.magicposition.com/?p=4</guid>
		<description><![CDATA[So you've heard about Konfabulator, that fabulous little engine running at the heart of Yahoo! Widgets. The Widgets are cute, and it all looks pretty simple to do. But why build one? Lots of reasons.]]></description>
			<content:encoded><![CDATA[<p>So you&#8217;ve heard about Konfabulator, that fabulous little engine running at the heart of Yahoo! Widgets. The Widgets are cute, and it all looks pretty simple to do. But why build one? Well, the honest answer is that quite often, you don&#8217;t. There are lots of times when making a web site instead would be quicker, easier and simpler. Widgets are not a web replacement. But there are lots of things that Widgets provide that a web page doesn&#8217;t:</p>
<ol>
<li>Persistence, persistence, persistence.
<ol>
<li>Persistent presence: nobody keeps a web page open all day. No, really. Obviously, one use-case Widgets already have heavily covered is information that changes a lot: stock prices, the weather. And with the advent of the Dock in 4, you don&#8217;t even have to worry that your widget is going to take up too much space: your users can hide it and bring it back up whenever they feel like it, and you can build a mini-display for the dock to alert them when something interesting might be happening.
<li>Persistent use: are you building a messaging application, and you&#8217;ve considered building a little popup window that users keep open all the time to keep track of their messages? Then you were already considering building a Widget, just on the wrong platform.
<li>Persistent data: does your application play with a lot of data that it&#8217;s tedious to pull in from a network? Is it possible your users would want to use their data offline? Would a client-side cache improve the performance of your app? Widgets have access to the filesystem and their own, local SQL database. If that doesn&#8217;t make you giddy with possibilities, you&#8217;re not the developer I thought you were.
	</ol>
</li>
<li>Desktop interaction<br />
	Upload a file&#8230; click browse&#8230; blah. If you want to interact with your user&#8217;s files, web pages suck. Widgets can accept drag-and-dropped information, send data to and from the clipboard, and any number of capabilities that the browser won&#8217;t give you without significant effort and a couple of security dialogs. JavaScript freed from the chains of the browser is fun.</li>
<li>Performance<br />
	Web applications are an amazing, wonderful hack: a medium that was designed to display static pages of information has been twisted into an application development platform. But despite all the joy that brings, it remains fundamentally a hack. Some applications are just too rich and too complicated to be made in a web context, or worse, when made in a web context their performance makes them unusable. Konfabulator on the other hand was built to make applications from the start, and it shows.</li>
</ol>
<h2>Desktop 2.0</h1>
<p>Note what I said just now: <i>applications</i>, not toys or gimmicks. Widgets are not a web replacement. They&#8217;re not web 3.0. They are a completely new breed of desktop application: a term we somebody threw out in the office as a joke was Desktop 2.0, but that&#8217;s really what we&#8217;re talking about. Persistent, performant, web-connected, and a damn sight easier to build than Java or C++ or any other desktop-application development language you care to name.</p>
<p>Widgets are the natural result of the explosion in the number of developers with web-centric skills since the late 90s. Any development environment that attracts large numbers of developers produces a push to increase the capabilities of that environment into other areas: this is why there is command-line PHP, GUIs written in Python and web apps written in VBScript. So it was inevitable that JavaScript would migrate to the desktop, and taking a bunch of other web-like technologies like XmlHttpRequest and the DOM with it is good and important too, because Widgets aren&#8217;t just a different language for writing applications, they&#8217;re a new <i>way</i> of writing applications.</p>
<p>The thing about Widgets that endears them to me as a development platform is that they get software development the right way around: build the interface <b>first</b>, and hook the functionality into that. This is such a simple idea, and yet there&#8217;s no desktop development language that works this way: yes, there are visual ediitors for C++ and Java, but they are just working with a set toolkit: the code is actually central, and if you want to do something out of the ordinary with the interface, you have to go back to the code. Because the truth is that for the vast majority of applications, the processing that&#8217;s going on is minor, and all the value is in the interface: presenting the right information at the right time, in the right way. Widgets let you concentrate on that.</p>
<h2>Not all roses</h2>
<p>Of course the problems. JavaScript is a lot faster in Konfabulator than it is in any browser, but JavaScript is still an interpreted language, and that has performance implications. There are other problems, too: the documentation (a personal bugbear and current project of mine) still has some way to go before it&#8217;s up to the standards of developer.mozilla and PHP.net. You are still insulated from the operating system to a certain extent. And despite our best efforts, there will inevitably be some bugs.</p>
<p>Widgets are not the be all and end all. They do not replace desktop applications, nor do they replace web applications. Instead they complement both, and produce a useful middle ground, where a web dev like you can create something that looks and works like a desktop application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.magicposition.com/2007/03/22/why-build-a-widget/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Why use PHP frameworks?</title>
		<link>http://www.magicposition.com/2007/02/26/why-use-php-frameworks/</link>
		<comments>http://www.magicposition.com/2007/02/26/why-use-php-frameworks/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 17:06:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[php]]></category>

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

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

		<guid isPermaLink="false">http://www.magicposition.com/?p=3</guid>
		<description><![CDATA[Frameworks are the long-overdue next generation of web development: a leap forward in debugging, portability, scalability and maintainability.]]></description>
			<content:encoded><![CDATA[<p>Once upon a time, <a href="http://www.perl.com/">Perl</a> was (and in fact remains) a perfectly capable language for writing web applications. But capable is not the same as suitable: it just wasn&#8217;t as good a choice for web applications as <a href="http://www.php.net/">PHP</a>, because even in version 2.0 of PHP you could do all the same things by using built-in functions, and people recognized that these things were faster and more reliable than building them themselves. The savings produced by not reinventing the wheel outweighed even the problems of switching languages.</p>
<p>Frameworks &#8212; like <a href="http://www.rubyonrails.org">Ruby on Rails</a>, and a raft of emerging <a href="http://www.phpwact.org/php/mvc_frameworks">PHP on Rails</a> MVC frameworks, of which my favourite is <a href="http://www.codeigniter.com/">CodeIgniter</a> &#8212; are just the next generation of this principle. Where once we marvelled at how easy PHP makes it to query a database (only 5 lines of code!), now we can marvel at how easy a framework makes it (after you&#8217;ve set up your framework, only one line of code!).</p>
<h3>The &#8220;I don&#8217;t need all that&#8221; trap</h3>
<p>A common issue experienced coders run into when they look at frameworks is that they will say &#8220;this framework is too heavy, I don&#8217;t need any of that stuff&#8221;. This is particularly likely if what they&#8217;re building is supposed to be an experiment or a &#8220;prototype&#8221;. Being too heavy is of course a perfectly valid criticism of some frameworks, depending on the nature of your web application. But to use the same excuse to brush off frameworks in general is dangerous, and the &#8220;prototype&#8221; excuse even more so.</p>
<p>You don&#8217;t need the overhead of a framework to build your single-page blog software: often, doing it from scratch would be shorter and possibly even faster. This is, in fact, a problem with the overly simple demos the frameworks often promote via screencasts to demonstrate their capabilities. What you need a framework for is when your application becomes more than a single page, and when there&#8217;s more than one developer working on it.</p>
<p>This is why the &#8220;prototype&#8221; argument is also a false one: when&#8217;s the last time you actually threw away a prototype? You build the base, it works, so you tell everyone in the office about it. So you add a few extra features, tidy things up, eventually things snowball and the whole thing goes into production. And by the time you do that, you have to start maintaining it, and you should have used a framework.</p>
<p>The reason you need frameworks is because <b>there&#8217;s no such thing as a small application</b>. There&#8217;s just baby applications, which like all babies are small, simple and cute, and old applications, which are bigger, uglier, and frequently stink.</p>
<h3>The real benefit of a framework is not in the screencast</h3>
<p>There are two main branches of benefits of using frameworks:</p>
<ol>
<li>First-write functionality: by not reinventing the wheel, you develop faster</li>
<li>Re-write functionality: having code that fits a standard pattern eases debugging, maintainability, and portability of code from one developer&#8217;s brain to the next.</li>
</ol>
<p>The first benefit is the one the frameworks advertise in their screencasts, and often the area where they concentrate their further development efforts, building up complex AJAX and other functionality*. But it&#8217;s my strongly-held conviction that the second benefit is by far the greater: however, it&#8217;s achieved pretty much as soon as the framework is created, so it&#8217;s difficult for the developers working on the framework to remained excited about it. Fundamentally, significantly reduced maintenance cycles aren&#8217;t sexy, but they are useful as all hell.</p>
<p>Maintainability remains an enormous stumbling block in web development. It&#8217;s easy to write a monolothic, procedural script that handles all your data capture, validation, processing and output. Once you keep your internal model of that script in your head, it&#8217;s even relatively easy to maintain. The problem turns up six months later: you&#8217;ve forgotten how you wrote the script, or worse, you&#8217;ve had to pass the code on to another developer, and they can&#8217;t make head or tail of it.</p>
<p>A framework gives you built-in breakpoints for effective debugging: if the return statement in your model code is returning accurate data, you know for sure the problem is presentational, and vice versa. The nature of framework URLs makes tracing execution whole orders easier: you know automatically which function is being called in which controller, just from the URL. As your project begins to grow past the capabilities of a single developer, these features become essential, since your team members will be working with code they didn&#8217;t write. Frameworks by their nature provide your team-mates with a lot more information about function X than your average function name.</p>
<p>Speaking of which, some will say: what about naming conventions? Surely a framework is just a really elaborate naming convention, involving whole directories and files rather than just function names?</p>
<p>Not really. It&#8217;s a naming convention, but more importantly a <i>coding</i> convention: we don&#8217;t just specify what the function does, we specify where whole classes of related functions go, and the nature in which they interact. This provides those debugging benefits I mentioned earlier, and MVC also provides a structure that scales easily to applications with dozens of models and hundreds of views: modern web applications.</p>
<h3>Maturity, at last</h3>
<p>Frameworks provide something that has never before existed in the web development field: a convention that exists in more than one company. The more we as an industry use frameworks, the great the network effect: it means code and debugging can work effectively across companies, that new hires will be able to quickly understand the operation of your software and get productive faster.</p>
<p>Frameworks are a sign of a new maturity in the field of web development, a side-effect of the shift from writing &#8220;pages&#8221; to &#8220;sites&#8221; to &#8220;applications&#8221;. And it&#8217;s about time.</p>
<p>* I have yet to see a framework build AJAX that meets a high standard of web development. It doesn&#8217;t count as separating behaviour from content if your view has to make a bunch of ajax-specific calls and you end up with a bunch of inline onclick handlers.<br />
** Unless you write consistent, comprehensive and up-to-the-minute documentation, of course. But nobody ever has. No, not even that guy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.magicposition.com/2007/02/26/why-use-php-frameworks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Let me put you in the magic position</title>
		<link>http://www.magicposition.com/2007/02/18/hello-world/</link>
		<comments>http://www.magicposition.com/2007/02/18/hello-world/#comments</comments>
		<pubDate>Sun, 18 Feb 2007 18:21:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[meta]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[So it may strike some as odd to start a blog about web dev and Widget dev by naming it after a Patrick Wolf song, but that&#8217;s what I&#8217;ve done, so you&#8217;re all going to have to learn to live with it. I chose the name partially because web dev is all about position, but [...]]]></description>
			<content:encoded><![CDATA[<p>So it may strike some as odd to start a blog about <a href="http://alistapart.com/">web dev</a> and <a href="http://widgets.yahoo.com/workshop/">Widget dev</a> by naming it after <a href="http://en.wikipedia.org/wiki/The_Magic_Position">a Patrick Wolf song</a>, but that&#8217;s what I&#8217;ve done, so you&#8217;re all going to have to learn to live with it. I chose the name partially because web dev is all about <code>position</code>, but mainly because I really like the song. I could make up some bullshit about how Widgets are also related to <code>position</code> in some way, but I really think that would be reaching.</p>
<p>I&#8217;m writing the web dev stuff because that&#8217;s what I was and what I still do sometimes, and I&#8217;m writing the Widget dev stuff because that&#8217;s what I am now. So the web stuff will likely be relatively advanced, and the Widget stuff relatively simple. In particular I&#8217;m hoping to write a lot of the Widget stuff from the perspective of a complete beginner, before that feeling wears off for me.</p>
<p>I&#8217;m aiming for one post a week. Let&#8217;s see how we go, shall we?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.magicposition.com/2007/02/18/hello-world/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
