<?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>Particletree</title>
	<atom:link href="http://particletree.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://particletree.com</link>
	<description>Everyone needs a hug.</description>
	<lastBuildDate>Fri, 25 Feb 2011 01:21:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>PHP Quick&#160;Profiler</title>
		<link>http://particletree.com/features/php-quick-profiler/</link>
		<comments>http://particletree.com/features/php-quick-profiler/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 16:50:11 +0000</pubDate>
		<dc:creator>Ryan Campbell</dc:creator>
				<category><![CDATA[Features]]></category>

		<guid isPermaLink="false">http://particletree.com/?p=642</guid>
		<description><![CDATA[Introduction In our company, code reviews play an integral part in the development process for making quality software. We opt for a mentor style approach with Wufoo, where a developer works on a segment for a period of time and then passes it up to a more experienced developer for review. We really like this [...]<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></description>
			<content:encoded><![CDATA[<h3>Introduction</h3>

<p>In our company, <a href="http://en.wikipedia.org/wiki/Code_review" title="Code Review">code reviews</a> play an integral part in the development process for making quality software. We opt for a <a href="http://www.codinghorror.com/blog/archives/001229.html">mentor style approach</a> with Wufoo, where a developer works on a segment for a period of time and then passes it up to a more experienced developer for review. We really like this approach because it means more developers become familiar with the foundation of different code level services. More importantly, they act as an additional safeguard against security holes, memory leaks, poor queries and heavy file structures. Unfortunately, these reviews are also very time consuming and in a small team can sometimes be an inconvenience to the reviewer &#8212; another developer with their own todo list to accomplish.</p>

<p><a class="ptad" href="http://wufoo.com?t=g2j6o2" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>

<p>Given that all reviews check against the same list of requirements, we&#8217;ve found ourselves repeating the same tasks over and over again. We spend a lot of time echoing queries, memory stats and objects to the browser just to see how they are being used in the code. To reduce this repetition, we invested some time creating something we&#8217;ve called the <strong>PHP Quick Profiler</strong>&#8212;we call it <code>PQP</code> for short. It&#8217;s a small tool (think Firebug for PHP) to provide profiling and debugging related information to developers without needing them to add a lot of programmatic overhead to their code. Now, we only need to toggle one config setting to true and our reviewers have access to an automated tool to help create a faster and more consistent review experience. Since anyone can use it, <code>PQP</code> also gives the initial developer an idea of where their code stands before the review.</p>

<p>We&#8217;ve been using <code>PQP</code> for a while now with Wufoo. It&#8217;s been so useful that we decided to take some time to package everything, write out some documentation and offer it up for anyone to use.</p>

<h3>See it in Action</h3>

<p>We&#8217;ve created an <a href="http://particletree.com/examples/pqp/" title="PQP In Action">online example</a> showing a landing page with <code>PQP</code> turned on. The profiler contains a 5 tabbed interface that presents pages for logging messages, measuring execution time, analyzing queries, revealing memory used and showing the files included.</p>

<p><a href="http://particletree.com/examples/pqp/" title="PHP Quick Profiler"><img src="http://farm4.static.flickr.com/3625/3463457814_0a558911e9_o.png" width="606" alt="PHP Quick Profiler" /></a></p>

<p>Thanks to Kevin&#8217;s help, who did a great job of designing and encapsulating the interface, there&#8217;s no need here to add links to external CSS files or Scripts to make it show up right. When included on a page in PHP, <code>PQP</code> automatically inserts the markup, CSS and JavaScript needed to make the interface show up and just work. <code>PQP</code> should work with Internet Explorer 6 and up, Firefox and Safari.</p>

<h3>Getting Started</h3>

<p>We&#8217;ve provided a zip file which contains the entire setup for <code>PQP</code> and some basic instructions for installation.</p>

<p><strong>Download: <a href="http://particletree.com/files/pqp/pqp.zip" title="PHP Quick Profiler">pqp.zip</a></strong></p>

<p>Once you&#8217;ve downloaded the zip, upload the contents to a PHP enabled web server. Navigating to the root directory in your browser will show the same online example we linked to above. At this point, each tab should work <em>except</em> for the database tab, which requires some additional configuration.</p>

<p>Once you get the example working, the next step would be integration with your own project. It&#8217;s important to note that <strong>dropping the folder into your own project directory will not work</strong>. This is because 5 different aspects of the code are being looked at, and you may handle those situations differently than we do. That said, integration is pretty straightforward, and by following the guidelines for each section below, you should be up and running in no time.</p>

<h3>Using It In Your Code</h3>

<p>The easiest way to make <code>PQP</code> work in your own code is to include <code>PhpQuickProfiler.php</code> into the page you want to see it on. That alone will enable the <strong>console</strong>, <strong>memory</strong> and <strong>file</strong> logging. Speed and database logging take a bit more work, which we&#8217;ll cover later. Now, enabling the default logging is great, but nothing will display to the screen by just including the file. To display to the screen, a bit more knowledge on what&#8217;s happening is required.</p>

<p>As code is being executed, details are being logged and analyzed in <code>PQP</code>. Once the code is finished, <code>PQP</code> finishes up also, and displays the output to the screen. The tricky part is knowing when the code is finished, since in an ideal world this tool would work with as little developer input as possible. In this example, we determine that the code has finished by looking at when the parent object runs its destructor. So a timeline would be:</p>

<ul>
<li>Landing Page constructor declares an instance of <code>PhpQuickProfiler</code>.</li>
<li>Landing Page executes all needed code.</li>
<li>Landing Page destructor tells the <code>PhpQuickProfiler</code> to cleanup and display output.</li>
</ul>

<p>Of course, this setup would cause <code>PQP</code> to always display, which isn&#8217;t ideal for production. To make it more useful, we created a Config flag in our code (<code>debugMode = true</code>) that checks to make sure it is set to true before displaying. Below is a sample class that can perform the steps we just covered:</p>

<pre><code>class ExampleLandingPage {

    private $profiler;
    private $db;

    public function __construct() {
        $this-&gt;profiler = new PhpQuickProfiler(PhpQuickProfiler::getMicroTime());
    }

    public function __destruct() {
        if($debugMode == true) $this-&gt;profiler-&gt;display($this-&gt;db);
    }

}
</code></pre>

<h3>Logging to the Console</h3>

<p>Given the code shell above, <code>PQP</code> is configured and ready to be used. We can start referencing the helper functions, starting with logging. The console log is just a step above an <code>echo</code> statement in that it condenses and formats the output using <code>print_r</code>. This is useful for reviewers because it provides a way to view debugging information without blowing up the layout of the page. To output data to the console, just statically call the function:</p>

<pre><code>Console::log($data);
</code></pre>

<p>The static function call accepts any data type and is available as long as the <code>PhpQuickProfiler.php</code> class is included. We chose to implement this with a static call so that the class does not have to be instantiated before use. The downside to a static call is that we store the log history in a global php variable. Should you wish to avoid globals, the <code>Console.php</code> class could always hold the log as a member variable given that it is instantiated. But as is, the class just acts as a read and write wrapper around a global PHP variable.</p>

<p>On top of logging variables, the console also has four additional functions.</p>

<pre><code>Console::logError($exception);
Console::logMemory();
Console::logMemory($variable, $name);
Console::logSpeed();
</code></pre>

<p>Let&#8217;s start with <code>logError()</code>. Logging an error is useful for displaying information related to a PHP exception. In our code, we&#8217;ll use a <code>catch</code> block for handling errors so we can silence an exception. We do this because we want that error to be ignored and not affect what the user is doing. An example of this would be logging data that isn&#8217;t crucial. If that log fails, the users shouldn&#8217;t have to stop what they&#8217;re doing. Now, in development, it&#8217;s still nice to know those exceptions were thrown, so in the <code>catch</code> block a call to <code>logError()</code> can be made to display the information to the console like so:</p>

<pre><code>try {
    // Execute non critical code
}
catch(Exception $e) {
    Console::logError($e, 'Unable to execute non critical code');
}
</code></pre>

<p>Additionally, the console can provide even more value by using some of the helper functions that PHP natively provides. For example, logging <code>debug_backtrace()</code> will print related information about the script at a given point in time. PHP also provides us with magic constants like <code>__LINE__</code>, <code>__FILE__</code>, <code>__FUNCTION__</code>, <code>__METHOD__</code> and  <code>__CLASS__</code>, which allows for printing of script data. Take a look at the screenshot below to see some example usage of this:</p>

<p><a href="http://www.flickr.com/photos/wufoo/3465935161/" title="PQP Height Expanded by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3557/3465935161_9cac2d37f6_o.png" width="606" alt="PQP Height Expanded" /></a></p>

<h3>Watching Memory Usage</h3>

<p>Object oriented PHP is a beautiful thing to behold, but there are definitely a <a href="http://particletree.com/notebook/object-oriented-php-memory-concerns/" title="OO Memory Usage">few concerns</a> to keep in mind when it comes to memory usage. These concerns tend to rear their heads when dealing with recursive output (i.e.: exporting to Excel), if there&#8217;s a leak in the creation of the objects or if objects aren&#8217;t being destroyed properly. All of this can lead to unexpected resource usage and fatal errors that serve to aggravate the end user.</p>

<p>The debugger aids with memory management by displaying the maximum amount of memory used by the script. A simple call to the built in <code>memory_get_peak_usage()</code> is where the data originates. The system setting for memory allowed (through <code>ini_get()</code>) is also shown to see how much wiggle room there is. If an overview isn&#8217;t enough, you can drill down into your resource usage with a point in time memory call.</p>

<pre><code>Console::logMemory();
Console::logMemory($variable, $name);
</code></pre>

<p>Calling <code>logMemory()</code> in your code without any parameters will output the current amount of memory that PHP is using when the function is called. This is perfect for watching a loop in your script to see if memory is building up during each iteration. Likewise, a variable and a name can be passed in to the function. Doing so will output the memory used by the variable to the console. Knowing that a script is hogging memory is wonderful, and knowing which variable is doing the hogging allows the problem to be fixed. Take a look at the screenshot below to see an example of string concatenation that is slowly eating up memory.</p>

<p><a href="http://www.flickr.com/photos/wufoo/3463780326/" title="PQP Memory Usage by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3615/3463780326_bfffe5cb13_o.png" width="606"  alt="PQP Memory Usage" /></a></p>

<h3>Runaway Includes</h3>

<p>Similar to memory getting out of control, included files (especially on large complex projects) can multiply and take over your app before very quickly. Even worse, too many includes don&#8217;t throw the hard errors that memory usage does. Instead, the page just slows down and resources get eaten up on every request served. Avoiding this pitfall is pretty easy&#8212;just make sure the same file isn&#8217;t included multiple times, and catch any excessive includes of unnecessary files.</p>

<p><a href="http://www.flickr.com/photos/wufoo/3466762904/" title="PQP File Includes by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3555/3466762904_45da31d7d1_o.png" width="606" alt="PQP File Includes" /></a></p>

<p>The <code>PQP</code> files tab shows the total files included with a count call on <code>get_included_files</code> and their total sizes are summed up. The names and sizes of the individual files are output to the console for easy scanning as well. The largest file included is noted on the left, which clearly points out if a large library is being used when it shouldn&#8217;t be. For example, on Wufoo we found out that we had a script always including <a href="http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/index.php" title="XSS parser">htmLawed</a>, a fairly decent sized file, when it wasn&#8217;t needed.</p>

<p>Also, keep in mind, autoloading classes or using <code>require_once</code> will usually alleviate any problems with file includes. That said, it never hurts to be aware of the situation, especially when using plugins, old code, or borrowed code.</p>

<h3>Page Execution Time</h3>

<p>Emphasis is always placed on database optimization when it comes to performance considerations (rightfully so), but that doesn&#8217;t mean PHP execution time should be ignored completely. The standard method for calculating load time is to find the difference between the time when the script starts and then again when the script finishes. This is where the integration of the debugger into your own project becomes tricky. Since the debugger is called on the destruction of the parent page, we know when the script is ending. But since every project is different, the start time can vary. The example code that you can download sets the start time in the construction of the parent object with a call to <code>PQP</code>&#8217;s <code>getMicroTime()</code>. This will work in most cases, but if you have a lot of code going on before the parent is constructed, be sure to specifically set the start time when needed.</p>

<pre><code>$this-&gt;profiler = new PhpQuickProfiler(PhpQuickProfiler::getMicroTime());
</code></pre>

<p>Given the page execution time, the next step would be to find meaning in the information. A quick glance will show if the time falls into an acceptable range. Assuming it doesn&#8217;t, how would we go about debugging the problem? Using the query section of the debugger, we can rule out query execution time (explained more in the next section). If queries aren&#8217;t the problem, then some portion of the script is. We can find this with the console.</p>

<pre><code>Console::logSpeed();
</code></pre>

<p>A call to <code>logSpeed()</code> will tell us how long the script has taken up until that point in time. For example, imagine we have an <a href="http://en.wikipedia.org/wiki/Factory_object">object factory</a> that constructs complex objects from a database. We also have an <a href="http://en.wikipedia.org/wiki/Data_Access_Object">object engine</a> that returns the object names from a database. When displaying 100 objects names to the screen, we would use either the factory or the engine. But using the engine would be much faster because we only need the names, and do not need the logic processing of object creation. If the developer did use the factory, <code>logSpeed()</code> would reveal the slowdown in the display loop, which ultimately identifies the problem.</p>

<p><a href="http://www.flickr.com/photos/wufoo/3463039665/" title="PQP Execution Time by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3489/3463039665_7c65f67535_o.png" width="606" alt="PQP Execution Time" /></a></p>

<p>On a similar note, we recently discovered that <a href="http://xcache.lighttpd.net/" title="xCache">xCache</a> improves our page execution time by over 60%. This was compared against other benchmarks by having all of our developers run quick tests against the code they were responsible for using <code>PQP</code>.</p>

<h3>A Glance at Database Activity</h3>

<p>Getting the debugger to report database information is the hardest part of integration with your own project. This step will only work if your database interaction is abstracted in some way. We talked about a <a href="http://particletree.com/features/database-simplicity-with-class/" title="Database Class">simple database class</a> awhile back, and have also released an example with the zip download (<strong>MySqlDatabase.php</strong> &#8212; you can follow the code in there to see a full implementation). The reason a class is so important is because information about each query must be stored as it happens, and a class allows the queries to each go through the same analysis without additional work by the programmer.</p>

<p>As a query is called, the database wrapper class stores the query and logs the time. The simplified code looks like this:</p>

<pre><code>function query($sql) {
    $start = $this-&gt;getTime();
    $rs = mysql_query($sql, $this-&gt;conn);
    $this-&gt;logQuery($sql, $start);
    return $rs;
}

function logQuery($sql, $start) {
    $query = array(
        'sql' =&gt; $sql,
        'time' =&gt; ($this-&gt;getTime() - $start)*1000
    );
    array_push($this-&gt;queries, $query);
}
</code></pre>

<p>Using that concept, the class will have an array of all query information available to it. Then, the debugger can take that array and print out the information. The information that is currently stored is the query itself, and the time to execute. The time to execute is not exact &#8212; it is the microtime until PHP has a handle on the recordset, which will be slower than the query time if there is network latency with the database server. Viewing the queries at a glance is an easy and helpful way to look for queries that would affect more records than intended, that are being duplicated or those that open themselves up to SQL injection.</p>

<p>One of the most useful database features added to the debugger is the ability to <code>EXPLAIN</code> each query run. Each query is run again using the <a href="http://dev.mysql.com/doc/refman/5.0/en/explain.html" title="EXPLAIN">explain</a> statement, and the results are presented below the query. This makes it easy to identify which queries are using their indexes properly.</p>

<p><a href="http://www.flickr.com/photos/wufoo/3463902088/" title="PQP Database Queries by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3633/3463902088_5d9738164c_o.png" width="606" alt="PQP Database Queries" /></a></p>

<h3>Wrapping Up</h3>

<p>The end goal of this debugging tool is to present a summary of useful information in an automated format. Usually, finding out about certain aspects of the code would require manual work and thought. And then if a problem is encountered, the debugger will hopefully make narrowing down the problem easier through the use of the extended Console functions. With that in mind, this tool is just an aid and is in no way meant to replace the standard, thorough procedures available to developers. The <a href="http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html" title="Slow Query Log">slow query log</a>, <a href="http://www.addedbytes.com/php/php-ini-guide-error-handling-and-logging/" title="PHP Error Log">PHP error log</a> and full fledged <a href="http://particletree.com/notebook/silence-the-echo-with-macgdbp/" title="Silence the Echo">debuggers and profilers</a> are encouraged on top of this high level view to supplement the tools available to developers.</p>
<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://particletree.com/features/php-quick-profiler/feed/</wfw:commentRss>
		<slash:comments>134</slash:comments>
		</item>
		<item>
		<title>How Not to Pitch to a&#160;Startup</title>
		<link>http://particletree.com/features/how-not-to-pitch-to-a-startup/</link>
		<comments>http://particletree.com/features/how-not-to-pitch-to-a-startup/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 15:00:04 +0000</pubDate>
		<dc:creator>Kevin Hale</dc:creator>
				<category><![CDATA[Features]]></category>

		<guid isPermaLink="false">http://particletree.com/?p=605</guid>
		<description><![CDATA[Several months ago, Infinity Box, our company, and thus Wufoo were listed in a publication targeted at investors, angels and venture capital firms as a promising young startup. We have, unfortunately, not been able to track down the source of this recommendation (investors seem odd about keeping their sources mysterious), but what followed for us [...]<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></description>
			<content:encoded><![CDATA[<p>Several months ago, Infinity Box, our company, and thus <a href="http://wufoo.com">Wufoo</a> were listed in a publication targeted at investors, angels and venture capital firms as a promising young startup. We have, unfortunately, not been able to track down the source of this recommendation (investors seem odd about keeping their sources mysterious), but what followed for us has been a series of emails and phone calls over the last few months that have come from associates of various VC firms.</p>

<p><a class="ptad" href="http://wufoo.com?t=g2j6o2"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>

<p>Now, our funding situation is that we took some initial seed money ($18,000) from <a href="http://ycombinator.com">Y Combinator</a> and then followed that up with a small angel round ($100,000) to get us to launch. That&#8217;s all the money we&#8217;ve taken and that was all done within the first 4 months of 2006. Since then, we&#8217;ve been blessed to have Wufoo do very well out there and we&#8217;ve been able to grow our team, product, user base and profits solely off of the service&#8217;s revenues. We did not take VC money because <strong>1)</strong> we like control and shares and <strong>2)</strong> we just weren&#8217;t interested in getting big fast, which meant VC money seemed like overkill to us in regards to our plans for growth. So when these calls started coming in, our stance was (and still is) that we&#8217;re not interested in seeking additional funding, but we&#8217;d be happy to talk because, well, you never know.</p>

<p>Of course, before every one of these phone calls, we would look up the firm&#8217;s web site, we would read their history, we would look at their portfolio, we would look up the associate that we&#8217;re going to talk to (there&#8217;s always a photo and there&#8217;s always a bio) and we would even look up some of the companies their firm had invested in. If the associate we&#8217;re going to talk to had a Facebook, Twitter or Linkedin page, we would look at that too. We think of it as basic research and it&#8217;s just how we do things. It&#8217;s how we write the articles on this blog and it&#8217;s how we make all of the decisions in our company. We&#8217;re like boy scouts. We like being prepared.</p>

<p>Additionally, we think it&#8217;s a basic form of courtesy to show someone else a level of concerted interest, if they&#8217;re showing interest in us. This way, hopefully, time would not be wasted on posturing and excessive introductions. Unfortunately, it&#8217;s become very clear to us after every one of these exchanges (there are no exceptions I&#8217;m afraid) that these investors and associates do not do the same. All of the associates we talk to seem to have three goals in mind when they contact us:</p>

<ol>
<li><p><strong>To put us into a database of companies their firm is aggregating.</strong> From what we understand, most VC firms send out an army of these associates to just gather basic research on companies, but for some reason, their flavor of choice for data collection is via a phone call rather than actually using the Internet to scrape most of the mundane stuff that they&#8217;re asking us. We&#8217;ve actually had conversations where we can hear them typing into a spreadsheet in the background as we talked to them.</p></li>
<li><p><strong>To regurgitate the firm&#8217;s history and mission statement from their web site.</strong> We noticed this early on and that&#8217;s why we started going over them ahead of time so we could skip it, but apparently this information must always be passed on orally to a potential company regardless of whether the company is able to finish their sentences.</p></li>
<li><p><strong>To let us know that they were different, that they give more than just money and that we should keep them in mind when we do decide to take on more funding.</strong> Needless to say, we find it very odd (if not funny) to hear every firm state how different they were in exactly the same way as everyone else.</p></li>
</ol>

<p>Obviously, we are not against gathering research. We are not against unsolicited introductions. And we actually think the intention of the act&#8212;to start an earnest conversation or relationship with a company that appears promising is a great idea. We&#8217;d love that. But the execution of these exchanges completely baffle us. Every associate asks us the same surface questions that can easily be answered by reading a few short pages on our web site (specifically our <a href="http://wufoo.com/faq/">FAQ</a> and our <a href="http://wufoo.com/about/">About</a> pages&#8212;they are definitely not hard to find). In fact, we&#8217;ve actually had people call us with promises of expertise and advice that&#8217;s never even created an account with Wufoo or know how we made money (that we have a freemium software-as-a-service subscription model).</p>

<p>Now, we understand that the typical relationship regarding a startup and a VC firm is to have the startup pitch to the VC. It is the startup&#8217;s job <strong>if they want money</strong> to convince the VC that they are worthy of investment. We also understand that the associate that&#8217;s calling us is making like a million of these calls a day. It&#8217;s probably just a job to them. We get that. We do.</p>

<p>However, if it&#8217;s the VC firm that initiated an unsolicited conversation and the company indicated ahead of time that it wasn&#8217;t interested in more money, and the VC firm insisted on talking anyway&#8230;well, then it&#8217;s sort of not cool to not do your homework and effectively make the company do the pitch anyway. Then we&#8217;re doing your job. Then, when you show the company how not different you are from everyone else following what is apparently the same lead, you&#8217;ve accomplished the exact opposite of what you intended: We do not think you&#8217;re different. We are not confident in your ability to establish strong relationships with companies. And we will probably not think of you when we need funding later on.</p>

<p>I know. That&#8217;s really harsh stuff. In fact, I&#8217;m unfortunately notorious for being rough on venture capitalists during meetings when we were based in Silicon Valley. Which is why <strong>1)</strong> I&#8217;m not allowed to sit across from potential investors during lunch/dinner meetings so they can&#8217;t see the reactions on my face and <strong>2)</strong> Chris, Ryan and I rotate returning these calls to VC inquiries. And so, thankfully, it&#8217;s not just me. We all feel surprised, which means these firms are probably giving the same impression to countless other companies.</p>

<p>What we find surprising is how every single one of these associates miss the opportunity to be a hero&#8212;to truly make an impression. Because, honestly, it&#8217;s so bad out there, that it would probably take very little to actually impress us even a little bit. All you would have to do is indicate to us that you&#8217;ve at least read the marketing materials on our web site (<strong>the thing that you want to pump money into</strong>) and tried out our service (<strong>the thing that&#8217;s potentially going to make you more money</strong>).</p>

<p>At least then, you&#8217;d be in a decent position to have a conversation that has give and take&#8212;maybe even provide criticism that we might find valuable. And <strong>that</strong> would be the event that would have me write down your name. The moment someone tells me, a person that&#8217;s been thinking obsessively about how to improve my company 24/7 for the last 3 years, something insightful about my business, product or future that I haven&#8217;t thought of before would be awesome. Also, bonus points would probably be given to the investor that calls us with knowledge of any of the number of articles we&#8217;ve labored over for this blog.</p>

<p>Anyway, the take away from all this for venture capital firms is that we&#8217;re not <strong>really</strong> complaining. I mean, technically that&#8217;s all I&#8217;ve been doing, but I also want you to know that we are definitely honored to be in a position to have VCs that want our attention. We know that&#8217;s a rare position to be in and we don&#8217;t take it lightly. Which is why we&#8217;re actually rooting for you. For that hero associate out there to get a hold of us and maybe knock our socks off with a little insight or even just some good ol&#8217; fashioned genuine enthusiasm. For good reasons, we don&#8217;t want our time wasted. And we really do want you to accomplish your goals, which is to be remembered. You don&#8217;t have to be our biggest fan. We don&#8217;t expect that at this point, but we do think that if you&#8217;re asking us to consider handing over a percentage of our soul (a soul that we&#8217;ve cultivated with our own blood, sweat and tears) in the hopes of capitalizing on our now apparent successful trajectory, then we&#8217;d hope that you&#8217;ll at least do us the honor of reading our words and learning our craft.</p>
<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://particletree.com/features/how-not-to-pitch-to-a-startup/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>The Importance of Writing&#160;Well</title>
		<link>http://particletree.com/notebook/writing-resources/</link>
		<comments>http://particletree.com/notebook/writing-resources/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 14:59:35 +0000</pubDate>
		<dc:creator>Chris Campbell</dc:creator>
				<category><![CDATA[Notebooks]]></category>

		<guid isPermaLink="false">http://particletree.com/?p=597</guid>
		<description><![CDATA[Three years ago, when we were just starting Wufoo, if you had asked me what skill I would&#8217;ve liked to have had instantly downloaded into my brain Matrix-style to help us succeed, I probably would have chosen something industry specific like advanced PHP, CSS, or database knowledge. Most of our early challenges were, for the [...]<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></description>
			<content:encoded><![CDATA[<p>Three years ago, when we were just starting <a href="http://wufoo.com">Wufoo</a>, if you had asked me what skill I would&#8217;ve liked to have had instantly downloaded into my brain Matrix-style to help us succeed, I probably would have chosen something industry specific like advanced PHP, CSS, or database knowledge. Most of our early challenges were, for the most part, technical and since there was only three of us for those first few years, it would have been nice to have had some god-mode programming skills to help us avoid some of the more time consuming re-writes and workarounds we&#8217;ve had to endure.</p>

<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/Qaw5fsrqOXo&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Qaw5fsrqOXo&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>

<p>Now, if you were to give me the same choice today, I probably wouldn&#8217;t choose anything specific to technology. I would ask to have inserted into my brain the oft neglected and under appreciated art of <del>Kung-Fu</del> writing well. This isn&#8217;t because technology is any less important to our company&#8212;we are a software company after all. It&#8217;s because I&#8217;ve noticed that when a company reaches a certain level of maturity, the business seems to always require just as much communication, both written and verbally, as it does technical innovation.</p>

<p>We&#8217;ve been fortunate to have Kevin on hand, who has a literary and editorial background, to help us craft our blog posts, support emails, newsletters, documentation, and presentations over the last few years. And while it&#8217;s nice to have that safety net, I believe that when your long term success depends on communication with employees, audiences, partners, and customers, everybody, especially those in leadership positions, need to be able to communicate with people as well as they do with computers. Roy Jacobsen <a href="http://rmjacobsen.squarespace.com/notebook/2007/12/12/programming-readers.html">said it best</a> recently on his blog, <a href="http://rmjacobsen.squarespace.com/about/">Writing, Clear and Simple</a>:</p>

<blockquote>
  <p>&#8220;The words you use, either written or spoken, can have powerful effects on your audience‚<i>—if you use them carefully and skillfully</i>. Whether your goal is to inform, to persuade, to call for action, or to entertain, your words and your stories can be powerful. They can be powerful, because <i>language is software for the mind</i>.&#8221;</p>
</blockquote>

<p>Since most of my adulthood has been spent coding and communicating with computers, my writing, or software for the mind skills, have unfortunately taken a bit of a backseat.  Only so much progress can really be made when you don&#8217;t take a dedicated approach to learning a new skill, and the default level of writing that goes into a normal day&#8217;s work just doesn&#8217;t cut it. So in an effort to beef up my writing skills and grow alongside the business, I&#8217;ve decided to give my writing the love and attention it desperately needs. There are a number of resources I&#8217;ve found useful over the last couple of months, and if you also are looking to improve your writing and, like me, don&#8217;t have access to the Matrix, they might be worth a glance.</p>

<ul>
<li><p><a href="http://www.amazon.com/Elements-Style-Fourth-William-Strunk/dp/020530902X">Elements of Style</a> - As the introduction states, writing is about saying something concisely, clearly, and worthwhile. This 90 year-old book is still one of the most highly recommended resources by writers, and its tips on the fundamentals of writing are always worth having close by.</p></li>
<li><p><a href="http://www.poynter.org/">Poynter.org</a> - Poynter focuses primarily on the art of journalism, which is extremely valuable if you want to understand how the media wants to craft a story. Their web site contains a boatload of best practices and tips for journalists, including bloggers, of all areas and on all topics.</p></li>
<li><p><a href="http://topics.nytimes.com/topics/reference/timestopics/subjects/e/english_language/grammar/index.html">The New York Times - Grammar and Usage</a> - There are a bunch of articles and resources available here, but I always like to keep an eye on the <a href="http://topics.blogs.nytimes.com/tag/after-deadline/">After Deadline</a> section where you can see the mistakes that some of the pros made and how they were corrected.</p></li>
<li><p><a href="http://www.economist.com/research/styleguide/">The Economist Style Guide</a> - The style guide given to the journalists at one of my favorite reading spots, The Economist.</p></li>
<li><p><a href="http://andromeda.rutgers.edu/~jlynch/Writing/a.html">Guide to Grammar and Style</a> - From A to Z, this site goes through a listing of words and phrases that are commonly used, but oftentimes misunderstood.</p></li>
<li><p><a href="http://grammar.ccc.commnet.edu/grammar/">Guide to Grammar &amp; Writing</a> - Yes, the site looks a little childish, but if you&#8217;ve forgotten what a parenthetical element or predeterminer actually are, this basic grammar guide can help refresh your aging memory.</p></li>
</ul>
<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://particletree.com/notebook/writing-resources/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>How We Prepare a&#160;Demo</title>
		<link>http://particletree.com/features/how-we-prepare-a-demo/</link>
		<comments>http://particletree.com/features/how-we-prepare-a-demo/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 05:15:23 +0000</pubDate>
		<dc:creator>Kevin Hale</dc:creator>
				<category><![CDATA[Features]]></category>

		<guid isPermaLink="false">http://particletree.com/?p=568</guid>
		<description><![CDATA[Introduction While I&#8217;ve highlighted best practices and resources on how to pitch your ideas in the past, I thought I&#8217;d take some time to share exactly how we prepare for our demos when we&#8217;ve been invited to showcase Wufoo at conferences, events and VC boardrooms. We&#8217;ve spent a lot of time refining and practicing our [...]<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></description>
			<content:encoded><![CDATA[<h3>Introduction</h3>

<p>While I&#8217;ve highlighted best practices and resources on <a href="http://particletree.com/notebook/pitching-ideas-roundup/">how to pitch your ideas</a> in the past, I thought I&#8217;d take some time to share exactly how we prepare for our demos when we&#8217;ve been invited to showcase Wufoo at conferences, events and VC boardrooms. We&#8217;ve spent a lot of time refining and practicing our workflow for presentations and after doing this a number of times now, I think we have a method that seems to <a href="http://wufoo.com/2007/03/28/wufoo-at-under-the-radar/">produce results</a> that we&#8217;ve been pretty proud of. While the amount of prep work we do probably isn&#8217;t for everyone and might be overkill to some of you, hopefully there will be some tips in here that will help you in your own presentations and demos.</p>

<p><a class="ptad" href="http://wufoo.com/?gad=CO_3o6UDEghyApM_y2FKeRjZ8LH7AyDP_uch&#038;gkw=submit+button" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>

<p>For all the examples in this article, I&#8217;ll be referring to the prep materials I generated for a 7 minute demo we were asked to do this past summer at the <a href="http://convention.nscs.org/">National Society of Collegiate Scholars</a> Convention in Orlando, FL. Because we (the founders) have demoed Wufoo countless times, we had one of our new hires, Tim Sabat, do the presentation to get some experience under his belt. Because this would be his first time with the material and because we&#8217;re obsessed about polish, you&#8217;ll notice that we leave very little to chance and improvisation.</p>

<h3>Getting Started</h3>

<p>If we&#8217;re presenting something completely new, we&#8217;ll start about a week before the presentation. If it&#8217;s something I&#8217;ve presented before and I have the slides and prep work already done, then I can probably get away with looking at stuff a day or two before. Either way, I&#8217;m probably going to be working and tweaking the slides all the way up until the moment before it&#8217;s time to go on stage. Because I wanted to try a new script (Wufoo had a lot of upgrades since the last time we demoed it) and Tim was new to this, I treated this presentation as if I were creating it from scratch.</p>

<p>We like to start every presentation with a rough outline. In fact, I pretty much start every thing I ever write with an outline and it&#8217;s one of the most common recommendations I have for people that have trouble with rambling and organization. It seems obvious, but you&#8217;d be surprised at the number of people that try to wing these things. Outlines keep us focused and help us make sure we hit the points that we need to cover like who we are, what we do, who uses us and the major features we want to highlight in the app. Here&#8217;s the <a href="http://s3.amazonaws.com/particletree-keynotes/NSCS/WufooDemoOutline.txt">outline I developed for our NSCS demo</a>.</p>

<pre><code>Introduction

- Particletree
- Treehouse
- Wufoo

What is Wufoo?
- online form builder
- help people collect information over web
- Infopath but friendlier

etc.
</code></pre>

<h3>The Transcript</h3>

<p>If the time allotted for the demo is under 15 minutes, which this was, then I basically take that outline and write out a full transcript&#8212;a word for word articulation of what would be said during the presentation. Not going to lie, it&#8217;s a lot of work to do this, but it&#8217;s definitely worth it. During a 6-8 minute demo, there isn&#8217;t any time to waste on finding your words. We believe a good short demo is like a  good short story&#8212;it&#8217;s carefully crafted. Even with material that feels like I should be very familiar and intimate with it (like talking about a startup and application I created from the ground up), I feel much more comfortable knowing that if I have a brain fart on stage, there&#8217;s a safety net for me to read from. Here&#8217;s a copy of the <a href="http://s3.amazonaws.com/particletree-keynotes/NSCS/WufooDemoTranscript.txt">final transcript I made for Tim for our NSCS demo</a>.</p>

<p><a href="http://www.flickr.com/photos/wufoo/2780683763/" title="Wufoo Demo Transcript by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3015/2780683763_28c38f4676_o.png" width="606" height="346" alt="Wufoo Demo Transcript" /></a></p>

<p>The first version of this transcript is written as fast as possible since I know that it&#8217;ll go through lots of revisions when we start timing it and whittling it down. After the first draft is done, I&#8217;ll do a time check. Basically, I time how long it takes to read the introduction, how long it takes to read the demo and how long it takes to read the closing. I&#8217;m careful to make sure I&#8217;m reading slowly but clearly (I actually have a problem with speaking too fast when I&#8217;m confident), which is probably the most important part of this process. For me, I know I&#8217;m reading at the right pace when it starts to feel a little uncomfortable. Timing and reading out loud will let you know where there&#8217;s flow problems and also what needs to be cut or made more succinct.</p>

<p>For this presentation we aimed for about 2:45 in the introduction, 2 minutes for the demo and then about 2 minutes for the closing. Now, when we first launched Wufoo, we didn&#8217;t have any of the information on traction and usage and so during those presentations, our intro was obviously shorter and our demo time was then extended to show more features. One thing we&#8217;ve learned about demoing features is that it&#8217;s impossible to show everything. Even if I took the entire 7 minutes, I couldn&#8217;t show all the things possible with Wufoo and so it was important for us to hit the highlights and then compromise by just showing screenshots of other major features to wet an audience&#8217;s appetite and imagination for more.</p>

<p>After I was happy with what I came up with, I sent a copy off to Tim so he can look over it and let me know what phrasings didn&#8217;t sound like him or felt uncomfortable rolling off his tongue. I&#8217;ll also have him do a time check since he&#8217;ll actually be presenting. When that&#8217;s done, I&#8217;ll leave him to practice while I work on the slides.</p>

<h3>The Slides</h3>

<p>I do all of our presentation work in <a href="http://www.apple.com/iwork/keynote/">Keynote</a>. We&#8217;re all on Macs and so it&#8217;s very convenient. And while I do love the way everything looks on it, I&#8217;m pretty sure I could be just as effective with the latest version of <a href="http://office.microsoft.com/en-us/powerpoint/FX100487761033.aspx">Powerpoint</a>. Here&#8217;s a copy of the <a href="http://s3.amazonaws.com/particletree-keynotes/NSCS/WufooDemo.pdf">slides from the NSCS Demo</a>.</p>

<p><a href="http://www.flickr.com/photos/wufoo/2985775820/" title="Untitled by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3197/2985775820_4ea58e61ae.jpg" width="500" height="381" alt="" /></a></p>

<p>The nice thing about making slides from a transcript is that it&#8217;s much more efficient. When I&#8217;ve made presentations based on just an outline in the past, I would usually waste a lot of time making a bunch of pretty slides that ended up being cut out of the final presentation after going through a few rehearsals and timings. In regards to actually designing it, there are so many ways to effectively illustrate a presentation. Since we&#8217;ve covered this <a href="http://particletree.com/notebook/powerpoint-and-presentation-tips/">in</a> <a href="http://particletree.com/notebook/great-speakers/">past</a> <a href="http://particletree.com/notebook/pitching-ideas-roundup/">articles</a>, I&#8217;ll just share some of the things I like to do when I design one:</p>

<ul>
<li><p>As you can see from the slide overview above, I like to use a lot of bright colors, images and screenshots. I prefer to illustrate rather than explain.</p></li>
<li><p>When showing a web site, I&#8217;ll cover a screenshot of the site with the <a href="http://www.flickr.com/photos/wufoo/2984919931/">url in large text</a> so it&#8217;s easy to read even in the back of the room.</p></li>
<li><p>When I purposely want the audience to feel overwhelmed, I&#8217;ll show lots of <a href="http://www.flickr.com/photos/wufoo/2984919961/">text</a> or <a href="http://www.flickr.com/photos/wufoo/2985775628/">images</a> on a single slide. Otherwise, it&#8217;s never more than a short sentence, if that.</p></li>
<li><p><a href="http://www.flickr.com/photos/wufoo/2780683733/">Duplicate the first slide</a>. A tip I got from Tim. This way you can leave it up on a screen without my notes showing or the timer starting.</p></li>
<li><p>Try to use <a href="http://www.flickr.com/photos/wufoo/2984920057/">humor</a> when possible. Sparingly and tastefully, of course.</p></li>
<li><p>Add any slides at the end that will easily answer some of the most commonly asked questions (this is why pricing page is added after the Thanks! slide).</p></li>
</ul>

<p>Additionally, I try to avoid using any transitions or animations in my presentation. I know some of them can be really slick, but in a demo with strict time limits, not only do I fee like I don&#8217;t have any time to waste, but I also don&#8217;t want the audience distracted by eye candy that makes them wonder about the software powering the presentation over what&#8217;s actually being said.</p>

<h3>Using Notes</h3>

<p>In Keynote (and I&#8217;m pretty sure in Powerpoint as well), you can add notes to each slide that will only display on your laptop when showing slides through a secondary display. Honestly, I think this notes feature is one of the most under-appreciated features in presentation applications. Ever since I&#8217;ve started using them, I&#8217;ve never gotten lost again or wondered why a certain slide was showing in the middle of a presentation. And so after the slides are done, I&#8217;ll start to copy and paste the appropriate sections in the transcript into the notes for each slide. Here&#8217;s a copy of the <a href="http://s3.amazonaws.com/particletree-keynotes/NSCS/WufooDemoWithNotes.pdf">slides with the transcript inserted as notes</a>.</p>

<p><a href="http://www.flickr.com/photos/wufoo/2780683489/" title="slidetextformat2 by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3109/2780683489_6754ba3983.jpg" width="500" height="365" alt="slidetextformat2" /></a></p>

<p>One thing that you&#8217;ll notice in the slides with notes is that <a href="http://www.flickr.com/photos/wufoo/2780683267/">certain sentences or phrases</a> are copied across multiple slides and formatted with odd line breaks. The duplication is done so that if a sentence is illustrated by multiple slides, the rhythm of a sentence won&#8217;t be disturbed during the slide changes. Each new paragraph represents when the presenter should proceed to the next slide.</p>

<p>In Keynote, I&#8217;m not a fan of the default layout for showing notes. Thankfully, you can change these settings under <strong>Preferences -> Presenter Display -> Edit Presenter Layout&#8230;</strong></p>

<p><a href="http://www.flickr.com/photos/wufoo/2780683117/" title="keynotepreferences2 by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3238/2780683117_9854f8a02e.jpg" width="500" height="374" alt="keynotepreferences2" /></a></p>

<p>Obviously, you should experiment and find the layout that works best for you, but I like to maximize the amount of notes I can see and so the presenter layouts for my keynotes are set up like this:</p>

<p><a href="http://www.flickr.com/photos/wufoo/2780683023/" title="keynoteslidesetup by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3102/2780683023_b1efa393f4.jpg" width="500" height="348" alt="keynoteslidesetup" /></a></p>

<h3>Pre-Recorded Screencast</h3>

<p>There are a number of studies out there that show that <a href="http://www.codinghorror.com/blog/archives/000691.html">mult-tasking is a myth</a>. Our brains aren&#8217;t meant to do it. It should therefore be no surprise that driving your application and talking about it articulately at the same time is a really hard thing to do well&#8212;especially, when you&#8217;re under pressure to do so in a narrow range of time. During practices, we&#8217;d notice that when we tried this, it was never smooth. There would be awkward gaps of silence whenever any thought processing needed to be done to show off a feature and, for some reason, the ability to type always seemed to escape the person when they were talking at the same time. That&#8217;s when we made our demos a two man operation.</p>

<p><a href="http://flickr.com/photos/briansolis/432639397/"><img src="http://farm1.static.flickr.com/145/432639397_f0297cf3da.jpg" alt="Kevin and Chris at Under the Radar by Brian Solis" /></a></p>

<p>One person would drive the application and the other person would do a running commentary of what was happening on the screen. This worked out alright, but it also had its issues. For example, there would be this awkward transition where you have to wait to pull out of the program and then open a browser to start the demo part. Because of this, you couldn&#8217;t fall back on your notes inside the presentation software, which means you have to effectively completely memorize this part of the sequence along with your driver.</p>

<p>You could bring two laptops, but most displays at conferences aren&#8217;t prepared for this setup and you end up with an even more awkward transition that has the potential for a dreaded AV malfunction. Additionally, this also added two additional variables to your presentation: another person and another piece of software. In addition to having to pay for two people to do every demo, you and your driver both have to be in sync and your application just has to work. Even though we would run everything off a development localhost on our laptop so we wouldn&#8217;t have to rely on an Internet connection, it always made us nervous. And so after a few presentations run like this, we decided that it would be better to just pre-record the demo as a screencast. Here&#8217;s a copy of the <a href="http://s3.amazonaws.com/particletree-keynotes/NSCS/WufooNSCS.mov">movie used in the NSCS demo</a>.</p>

<p><object width="500" height="373"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=2091884&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=ffffff&amp;fullscreen=1" />  <embed src="http://vimeo.com/moogaloop.swf?clip_id=2091884&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=ffffff&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="373"></embed></object></p>

<p>Using a screencast solved the awkward transition problem, allowed us to still utilize notes, eliminate the variables of another person and software and made sure that we would not go over on time for that part of the demo. Keynote makes it very easy to insert movies into presentations. Just drag the movie into a blank slide and it&#8217;ll work pretty much like you expect. The only problem I have with it in Keynote is that the movie only plays on the secondary display and not in the presenter layout view and so you have to make sure you&#8217;re looking on the screen behind you so that you start speaking at the same time. But when it&#8217;s done right, it&#8217;s a pretty smooth experience.</p>

<p>The down side, of course, is that you have to do a lot more work ahead of time in prep. For the NSCS demo, I had Tim read off the demo portion of the script while I recorded myself doing the screencast with <a href="http://www.ambrosiasw.com/utilities/snapzprox/">Snapz Pro X</a> without the sound. It took us about 10 takes to get it just right and in the time span that we wanted.</p>

<h3>Keynote Display Preferences</h3>

<p>And that&#8217;s pretty much how we do it. After all the prep work is done, it&#8217;s pretty much up to the presenter to practice it enough for a smooth delivery and to memorize enough of the material so that they don&#8217;t have to rely on the script. Before I leave you to make and modify your own demos, I&#8217;d like to quickly share with you one last tip. Make sure you set up your presentation display settings ahead of time if you&#8217;re using Keynote. Here&#8217;s our settings:</p>

<p><a href="http://www.flickr.com/photos/wufoo/2780683077/" title="keynotepreferences by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3287/2780683077_c6f8673618.jpg" width="500" height="374" alt="keynotepreferences" /></a></p>

<p>Basically, have it set up to <strong>Present on secondary display</strong> and then definitely check your Display Preferences to make sure <strong>Show displays in menu bar</strong> is checked off so you can easily make adjustments on the spot. When you&#8217;re plugged into the secondary display, then you&#8217;ll want to make sure your Mac is <strong>not mirroring the primary display</strong> (done in display preferences). If that&#8217;s done right, your presenter notes will show properly on your laptop and keep you from looking like a spaz when the projector isn&#8217;t doing what you expected. Alright, good luck and happy demoing!</p>
<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://particletree.com/features/how-we-prepare-a-demo/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
<enclosure url="http://s3.amazonaws.com/particletree-keynotes/NSCS/WufooNSCS.mov" length="6124990" type="video/quicktime" />
		</item>
		<item>
		<title>Beautiful Code&#160;Roundup</title>
		<link>http://particletree.com/notebook/beautiful-code-roundup/</link>
		<comments>http://particletree.com/notebook/beautiful-code-roundup/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 17:52:25 +0000</pubDate>
		<dc:creator>Alex Vazquez</dc:creator>
				<category><![CDATA[Notebooks]]></category>

		<guid isPermaLink="false">http://particletree.com/?p=554</guid>
		<description><![CDATA[Over the last few months, the Wufoo Team has been steadily refactoring their code base to work with a new more flexible and more powerful API we&#8217;ve developed on the backend. In that process, I&#8217;ve had the opportunity to rewrite some of Wufoo&#8217;s oldest code from the founder&#8217;s earlier, more hectic days. One thing that&#8217;s [...]<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></description>
			<content:encoded><![CDATA[<p>Over the last few months, the Wufoo Team has been steadily <a href="http://en.wikipedia.org/wiki/Refactoring">refactoring</a> their code base to work with a new more flexible and more powerful API we&#8217;ve developed on the backend. In that process, I&#8217;ve had the opportunity to rewrite some of Wufoo&#8217;s oldest code from the founder&#8217;s earlier, more hectic days.</p>

<p>One thing that&#8217;s really nice about working with Wufoo is that the attention to detail doesn&#8217;t stop at just our UI. Whether it&#8217;s the efficiency of a query or the tools we&#8217;ve developed for backend development and benchmarking, the team is equally fanatical about making the code on the inside as beautiful as the design on the outside. In fact, whenever one of us is creating a brand new feature or interacting with an old, inflexible piece of code, we&#8217;ll take the additional time to ensure that it&#8217;s clean and readable for any future programmers working on that code.</p>

<p>The thing I like about our rewrites is that the focus isn&#8217;t solely on making it work. We also always strive to make it easy to work with&#8212;basically, creating maintainable code. Now, making sure our new code is clear and easy-to-read can be a tedious process that slows down the initial pace of development. But, we&#8217;re all firm believers that while the last programmer to write a piece of code might not have known any better, it pays off when Alex, the Programmer of the Present, is nice to Future Alex, the guy that&#8217;s going to have to fix the bugs left behind.</p>

<p>While reading through lots of code can give you an appreciation of what well-written code looks and feels like, the ability to create it is a skill that is developed from experience and frustration. Luckily, there are a number of excellent articles and books out there to help the aspiring code perfectionist. The following resources are ones that have helped me personally strive to write code worth looking at&#160;:</p>

<h3>Articles</h3>

<ul>
<li><p><a href="http://www.perforce.com/perforce/papers/prettycode.html">Seven Pillars of Pretty Code</a> - Sage advice from the developers at Perforce. A great article and example giving credibility to the fact that maintainable code is essential to a software development companies bottom line.</p></li>
<li><p><a href="http://www.wilshipley.com/blog/2007/05/pimp-my-code-part-14-be-inflexible.html">Code Brevity</a> - Advice on the benefits of being succinct. Learn about the dangers of over thinking your solution and overestimating your problem.</p></li>
<li><p><a href="http://www.artima.com/weblogs/viewpost.jsp?thread=74230">Style is Substance</a> - &#8220;What benefits do we get from freedom of style that outweighs the cost we pay for it?&#8221;</p></li>
</ul>

<h3>Books</h3>

<ul>
<li><p><a href="http://www.amazon.com/Beautiful-Code-Leading-Programmers-Practice/dp/0596510047/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1222203012&amp;sr=1-1">&#8220;Creating Code as an Essay&#8221;, Beautiful Code</a> - A description of the principles that guided Yukihiro Matsumoto&#8217;s goal of making Ruby a language that creates happy productive programmers.</p></li>
<li><p><a href="http://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1222202796&amp;sr=1-1">Domain Driven Design</a> - Stresses the importance and benefits of clear communication in a development team&#8217;s code, design, and even speech. Describes a ubiquitous language and design as the base of a products distilled knowledge.</p></li>
<li><p><a href="http://www.amazon.com/Refactoring-Improving-Existing-Addison-Wesley-Technology/dp/0201485672/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1222201952&amp;sr=8-1">Refactoring: Improving the Design of Existing  Code</a> - A guide to improving program internals from with the wisdom of lifelong programmers&#8217; experiences. &#8220;Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure.&#8221;</p></li>
<li><p><a href="http://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1222202511&amp;sr=1-1">Code Complete 2, Themes in Software Craftmanship, Chapter 34&#160;</a> - &#8220;Communication with other people is the motivation behind the quest for the Holy Grail of self-documenting code.&#8221;</p></li>
</ul>
<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://particletree.com/notebook/beautiful-code-roundup/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Be Kind to the Color&#160;Blind</title>
		<link>http://particletree.com/features/interfaces-and-color-blindness/</link>
		<comments>http://particletree.com/features/interfaces-and-color-blindness/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 16:57:08 +0000</pubDate>
		<dc:creator>Chris Campbell</dc:creator>
				<category><![CDATA[Features]]></category>

		<guid isPermaLink="false">http://particletree.com/?p=516</guid>
		<description><![CDATA[Introduction Hi, my name is Chris Campbell and I have a color vision deficiency. Like roughly 7-10% of all males, my deuteranomaly makes it difficult to differentiate between some colors, like red and green. Color deficiency, or color blindness as it&#8217;s commonly referred to, doesn&#8217;t mean that I or people with similar conditions cannot see [...]<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></description>
			<content:encoded><![CDATA[<h3>Introduction</h3>

<p>Hi, my name is Chris Campbell and I have a color vision deficiency. Like roughly <a href="http://en.wikipedia.org/wiki/Color_blindness#Prevalence">7-10% of all males</a>, my deuteranomaly makes it difficult to differentiate between some colors, like red and green. Color deficiency, or color blindness as it&#8217;s commonly referred to, doesn&#8217;t mean that I or people with similar conditions cannot see certain colors. They&#8217;re not invisible and I don&#8217;t see in black and white (a condition that is actually very, very rare). I can still use crayons effectively, find meaning in beautiful sunsets and even enjoy clear blue skies. What it does mean is that certain colors in the visual spectrum look a lot like one another and so I have a hard time sometimes telling the difference between certain colors and even shades.</p>

<p><a class="ptad" href="http://wufoo.com/?gad=CO_3o6UDEghyApM_y2FKeRjZ8LH7AyDP_uch&#038;gkw=submit+button" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>

<p>Because of this, designing software and interfaces that will also work effectively for people like me takes a bit of concerted effort. Of all the <a href="http://www.johnlovett.com/test.htm">elements of design</a> (line, shape, size, texture, etc.), color is probably one of the most used elements to pass on informational states. This is probably because it allows a designer to say many things without having to change the form or layout of the design. While there are a number of <a href="http://www.456bereastreet.com/archive/200709/10_colour_contrast_checking_tools_to_improve_the_accessibility_of_your_design/">simulators and plugins</a> that can help you &#8220;visualize&#8221; what a color deficient person might be seeing, I honestly don&#8217;t recommend spending a lot of time with them. Instead, I&#8217;d like to propose just a few simple guidelines along with plenty of examples to help you effectively ensure that a good percentage of your audience won&#8217;t misinterpret your message.</p>

<h3>Avoid Using Colors Alone as Visual Cues</h3>

<p>Using color and color alone as a visual cue is appealing because it&#8217;s usually an aesthetically pleasing and a minimalist design technique. Calls to action and visual cues are critical to interface designers because users, especially on the web, have <a href="http://eyetrack.poynter.org/keys_01.html">limited patience</a> and are looking to process information and make decisions quickly. Since the brain recognizes and <a href="http://findarticles.com/p/articles/mi_m0FCR/is_3_38/ai_n6249223">forms an emotional bond</a> with colors almost immediately, colors are a natural choice for visual cues. Unfortunately, it&#8217;s easy to alienate or confuse some of your users when some of those aesthetically pleasing colors look very similar. To point out a few interfaces that use hard to differentiate colors as visual cues, here are a few examples that have given me some trouble.</p>

<p><strong>Bad Cues</strong></p>

<div class="inlineImages">
<a href="http://www.flickr.com/photos/wufoo/2919012489/" title="Apple iPhone Availability by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3177/2919012489_ec4e236bf9.jpg" height="155" alt="Apple iPhone Availability" /></a>

<a href="http://www.flickr.com/photos/wufoo/2919012537/" title="MAMP Server Status by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3143/2919012537_d79da84cab.jpg" height="155" alt="MAMP Server Status" /></a>

<a href="http://www.flickr.com/photos/wufoo/2919857588/" title="Warhammer Online Server Status by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3289/2919857588_ccabc63c0a.jpg" height="155" alt="Warhammer Online Server Status" /></a>
</div>

<p>As you can see, all three of these interfaces use only red and green (two of the most misinterpreted colors) to convey states or provide information to the user.</p>

<ul>
<li><a href="http://apple.com">Apple&#8217;s</a> iPhone availability indicator uses color alone as a visual indicator. Interestingly enough, they <a href="http://developer.apple.com/documentation/Accessibility/Conceptual/AccessibilityMacOSX/AccessibilityMacOSX.pdf">state in their usability guidelines</a>:</li>
</ul>

<blockquote>
  <p>&#8220;Although color can greatly enhance a user interface, <strong>make sure it is not the only source of information</strong>. A color blind user may not be able to distinguish between two objects that differ only in color.&#8221;</p>
</blockquote>

<p>Now, what they do provide is a legend of what red and green are supposed to look like for each state. But for me, it&#8217;s still barely possible to match their indicators to the live data, and so the example remains pretty frustrating. It is, however, slightly better than the other two examples.</p>

<ul>
<li><a href="http://www.warhammeronline.com/">Warhammer Online</a>, a video game, and <a href="http://www.mamp.info/en/index.php">MAMP</a>, a development server application, exemplify the worst culprits because not only do they use similarly contrasting red and green colors as cues, but they don&#8217;t give you a reference or legend to help distinguish or label what &#8220;red&#8221; and &#8220;green&#8221; are even supposed to look like. </li>
</ul>

<p>In order to avoid an <a href="http://digg.com/gaming_news/Color_blind_gamers_common_Developer_awareness_Minimal">angry mob of color deficient users</a>, or to just ensure that you and your users are on the same page, here are some aesthetically pleasing interface examples that use text and icons, in addition colors, to communicate what&#8217;s going on.</p>

<p><strong>Good Cues</strong></p>

<div class="inlineImages">
<a href="http://www.flickr.com/photos/wufoo/2919859200/" title="Dropbox File Status"><img src="http://farm4.static.flickr.com/3242/2919859200_c7bf516f07.jpg" height="135" alt="Dropbox File Status" /></a>

<a href="http://www.flickr.com/photos/wufoo/1468761989/" title="Entry Manager"><img src="http://farm2.static.flickr.com/1310/1468761989_2de41db5bc.jpg" height="135" alt="Entry Manager - Viewing an Entry" /></a>

<a href="http://www.flickr.com/photos/wufoo/2919861782/" title="Versions"><img src="http://farm4.static.flickr.com/3115/2919861782_40eeb74ea6.jpg" height="135" alt="Versions" /></a>
</div>

<ul>
<li><p><a href="http://getdropbox.com">Dropbox</a> users know the status of their files because of the colored circles and icons attached to each file. The colored circles can be confusing to a small percentage of viewers, but it&#8217;s pretty hard to misunderstand what&#8217;s going on unless you&#8217;re both colorblind and not familiar with their commonly used icons.</p></li>
<li><p>The <a href="http://wufoo.com">Wufoo</a> and <a href="http://www.versionsapp.com/">Versions</a> screenshots pretty much leave no room for misinterpretation because they, like a stop sign, use combinations of shape, color, and a word / icon to give their visual cues meaning and context. You&#8217;re sure to leave very little to interpretation when you use three visual cues to convey a single message.</p></li>
</ul>

<p><strong>More Good Cues</strong></p>

<div class="inlineImages">
<a href="http://www.flickr.com/photos/wufoo/2958461684/" title="Apple Window Buttons by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3168/2958461684_06bda3145b.jpg" height="200" alt="Apple Window Buttons" /></a>
    
<a href="http://www.flickr.com/photos/wufoo/2919014483/" title="Tivo Menu by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3195/2919014483_772e72cff3.jpg" height="200" alt="Tivo Menu" /></a>
</div>

<ul>
<li><p>Again, Apple uses the hard to distinguish red, yellow, and green orbs as visual cues throughout their OSX windows, but this time they help those with color deficiencies by providing icons whenever you hover over the colored orbs. Since a user is only going to be interacting with those orbs when their mouse is hovering over them, it doesn&#8217;t hurt to hide the icons and keep the interface aesthetically pleasing until the user is clearly interacting with them.</p></li>
<li><p>The <a href="http://www.tivo.com/">TiVo</a> interface is strapped for space, and in order to give multiple visual cues using color by itself, a recorded show is represented with a full, green orb, and a show that is currently being recorded is represented with a smaller, red orb. Even if somebody cannot differentiate the colors that Tivo is using in this situation, they can tell the difference between a small and large circle.</p></li>
</ul>

<h3>Use Contrasting Colors</h3>

<p>Of course, as an interface designer, there are going to be times when you do not want to use icons or text as a cue due to space or aesthetic constraints. While I recommend using icons or text when you can, sometimes color and color alone is the most logical way or only choice to convey different information. Maps, for example, often use colors to display separate areas of information about a location. Also, sometimes designers want to indicate state by coloring just the text itself.</p>

<p>If you are going to use color alone, the best way to accommodate for the color deficient viewers out there is to get familiar with <strong>contrast</strong>. Kevin wrote an excellent article recently on <a href="http://particletree.com/notebook/calculating-color-contrast-for-legible-text/">programmatically finding good contrasting colors</a>. Additionally, a couple of great resources about how to choose proper contrasting colors can be found over at <a href="http://www.lighthouse.org/accessibility/effective-color-contrast/">lighthouse.org</a> and <a href="http://www.456bereastreet.com/archive/200709/10_colour_contrast_checking_tools_to_improve_the_accessibility_of_your_design/">456bereastreet</a>, but to give you a quick overview of what works and doesn&#8217;t work in my world, here are a couple examples.</p>

<p><strong>Bad Contrast</strong></p>

<div class="inlineImages">
<a href="http://www.flickr.com/photos/wufoo/2919857926/" title="NYTimes Map 2 by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3228/2919857926_60dc34a8c9.jpg" height="120" alt="NYTimes Map 2" /></a>
    
<a href="http://www.flickr.com/photos/wufoo/2919858618/" title="Trulia Map 1 by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3050/2919858618_4f1bf21f9c.jpg" height="120" alt="Trulia Map 1" /></a>

<a href="http://www.flickr.com/photos/wufoo/2957966777/" title="Bad Contrast Text by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3287/2957966777_71ab25cf7b_o.gif" height="120" alt="Bad Contrast Text" /></a>
</div>

<ul>
<li><p>This <a href="http://nytimes.com">New York Times</a> map is frustrating because the &#8220;Yes&#8221; and &#8220;Did Not Vote&#8221; colors are extremely close in contrast, and they basically look like the same thing to me. I wouldn&#8217;t even recognize there are four colors being used on that map. And actually, the classic example for bad contrast for the color blind in Wikipedia is <a href="http://flickr.com/photos/wufoo/2919123545/">this NY Times Map</a>.</p></li>
<li><p><a href="http://trulia.com">Trulia&#8217;s</a> maps are sometimes extremely tough to interpret for me because they not only use red, yellow and green, but they use multiple shades of those colors. I see this a lot of times in graphs and pie charts, and it&#8217;s probably the most frustrating example of all the screenshots I&#8217;ve documented in this article.</p></li>
<li><p>The red/black and red/green text are sometimes used as hyperlink colors on web sites. They can be problematic because certain combinations are colors that those with a deficiency often have trouble seeing.</p></li>
</ul>

<p><strong>Good Contrast</strong></p>

<div class="inlineImages">
<a href="http://www.flickr.com/photos/wufoo/2919016713/" title="NYTimes Map 1 by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3233/2919016713_95dd05e80f.jpg" height="135" alt="NYTimes Map 1" /></a>

<a href="http://www.flickr.com/photos/wufoo/2859942789/" title="Public Report Upgrades by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3216/2859942789_03f7952a97.jpg" height="135" alt="Public Report Upgrades" /></a>

<a href="http://www.flickr.com/photos/wufoo/2957966809/" title="Good Contrast Text by wufoo, on Flickr"><img src="http://farm4.static.flickr.com/3060/2957966809_fddae01baf_o.gif" height="135" alt="Good Contrast Text" /></a>
</div>

<ul>
<li><p>In this map, the New York Times does a better job because red and blue are easy to differentiate, and while light yellow and light blue can be confused by an extremely small percentage of people, the stripes they use clearly separate the states.</p></li>
<li><p>While this pie chart in Wufoo does use red and green, the colors in this example are contrasting enough to tell apart, especially when viewed directly next to another.</p></li>
<li><p>Here&#8217;s another set of text examples that are again a red/black and red/green combo, but they&#8217;re more distinguishable due to their higher contrast differences.</p></li>
</ul>

<h3>Conclusion</h3>

<p>For the most part, this isn&#8217;t a call to arms. I&#8217;m not on a quest to change the world, fight discrimination or demand visual equal rights. As you can see, if you want to avoid making color blunders, all you really need to do is to take a minute to make sure you provide a legend, use icons or words when possible and make sure your visual cues are high contrasting. You probably do not need to run your designs through a color checker and stress over whether or not your interface is going to offend your viewers. In fact, there&#8217;s a pretty good chance you&#8217;re working near or know somebody with a color deficiency, so having them give your design a once over is a great way to ensure your message is seen properly.</p>

<h3>Additional Reading</h3>

<ul>
<li><p><a href="http://critiquewall.com/2007/12/10/blindness">Blindness</a> - A series of images that are shown in both normal vision and how they appear to someone with a red/green colorblindness.</p></li>
<li><p><a href="http://www.colblindor.com/2007/02/06/colorblind-at-the-traffic-light/">What about Traffic Lights?</a> - Daniel Flück writes about why traffic lights do not confuse him. <a href="http://en.wikipedia.org/wiki/Traffic_light">Wikipedia also notes</a>, &#8220;Usually, the red light contains some orange in its hue, and the green light contains some blue, to provide some support for people with red-green color blindness.&#8221; This explains why color blind people do not actually need to memorize the location of where green and red lights are located, especially in the dark when you cannot pinpoint the location of where a light is coming from.</p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Timeline_of_Crayola#1990.E2.80.93present">Emerson Moser</a> - In 1990, Moser was Crayola&#8217;s most senior crayon moulder and retired after 37 years. After moulding approximately 1.4 billion crayons, he revealed that he is actually color blind.</p></li>
<li><p><a href="http://discovermagazine.com/2007/apr/the-upside-of-color-blindness">Camouflage Detecter</a> - There is an upside to being color blind and it&#8217;s that you have the super human ability to detect camouflage like <a href="http://health.discovery.com/centers/kids/colorblind/colorblind_02.html">U.S. soldiers did in World War II</a>. That might also help explain why most animals have some form of color blindness.</p></li>
<li><p><a href="http://www.joystiq.com/2006/07/30/colorblind-gaming-or-table-tennis-is-impossibly-hard/">Colorblind gaming or: Table Tennis is impossibly hard!</a> - A color blind video gamer explains why Rockstar&#8217;s Table Tennis may be the most difficult game ever.</p></li>
<li><p><a href="http://www.colormatters.com/kaufman.html">Seeing Through the Eyes of The Color Blind Shopper</a> - &#8220;Many consumers throughout the United States have impaired or limited information processing capabilities as part of congenital or illness-related disabilities, yet their specific problems and needs are often not formally considered by firms, by researchers, or by students preparing to enter the business world. I learned this quite by accident in my own Consumer Analysis class when I gave a routine assignment to my students.&#8221;</p></li>
</ul>
<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://particletree.com/features/interfaces-and-color-blindness/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Rich Application Architecture&#160;Roundup</title>
		<link>http://particletree.com/notebook/rich-application-architecture-roundup/</link>
		<comments>http://particletree.com/notebook/rich-application-architecture-roundup/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 19:20:59 +0000</pubDate>
		<dc:creator>Tim Sabat</dc:creator>
				<category><![CDATA[Notebooks]]></category>

		<guid isPermaLink="false">http://particletree.com/?p=498</guid>
		<description><![CDATA[When Chris, Kevin and Ryan approached Alex and I to develop Wufoo Unplugged, a desktop application to view Wufoo form data offline, we ended up choosing .NET because in addition to it offering the features we needed like multi-threading, file system access and pre-built Lucene libraries, it was also the technology that Alex and I [...]<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></description>
			<content:encoded><![CDATA[<p>When Chris, Kevin and Ryan approached Alex and I to develop <a href="http://wufoo.com/unplugged">Wufoo Unplugged</a>, a desktop application to view Wufoo form data offline, we ended up choosing .NET because in addition to it offering the features we needed like multi-threading, file system access and pre-built <a href="http://lucene.apache.org/java/docs/">Lucene libraries</a>, it was also the technology that Alex and I were the most familiar with at the time. We weren&#8217;t officially part of the Wufoo Team then (Unplugged was basically our hiring interview) and so we weren&#8217;t asked to develop in an environment outside our comfort zone. As you can imagine, choosing a Windows-only solution left a number of Mac users  <a href="http://wufoo.com/2008/08/13/get-offline-access-and-desktop-notifications-with-wufoo-unplugged/">feeling a bit left out</a>.  And so hoping to help out other developers thinking of creating their own desktop applications that will work on both PCs and Macs for their web services, I thought I&#8217;d do some research into the current state of cross-platform Rich Application Architectures and present my findings here.</p>

<h3>Adobe AIR</h3>

<p><a href="http://www.adobe.com/products/air/" title="Adobe AIR">Adobe AIR</a> has made great strides in providing a cross-platform application architecture that sets a new benchmark for web developers dreaming about making things &#8220;better.&#8221; This environment provides a way for web developers who are comfortable developing in Flash, Flex or HTML to easily port their apps to a desktop environment.  Like other frameworks that produce installable code it can install shortcuts on the desktop and interact with the file system. In the hands of someone familiar with creating Flash interfaces, AIR is capable of utilizing beautiful UIs that are not confined to the browser.  AIR can also use <a href="http://www.sqlite.org/">SQLite</a> as a database, which allows a developer to create a truly disconnected system.  Additionally, using a specified coding model and an Adobe server product called <a href="http://www.insideria.com/2008/07/air-data-synchronization-via-l.html">LiveCycle</a>, offline data synchronization can be handled automatically, freeing the developer the burden of writing this code alone.</p>

<table cellspacing="0">
<thead>
<tr>
<td class="positive">Pros</td>
<td class="negative">Cons</td>
</tr>
</thead>
<tbody>
<tr>
<td>Not confined to browser</td>
<td>Security and trust concerns</td>
</tr>
<tr>
<td>Can interact with the file system</td>
<td>No support for multi-threading</td>
</tr>
<tr>
<td>SQLite database support</td>
<td>LiveCycle requires J2EE Server</td>
</tr>
<tr>
<td>Offline data synch through LiveCycle</td>
<td></td>
</tr>
</tbody>
</table>

<p>One of Adobe Air&#8217;s strengths, the inclusion of an out-of-the-box synchronization, is ironically one of it&#8217;s downfalls.  While this technology may save the developer loads of time, the configuration and maintenance of a J2EE-compliant server like jBoss (LiveCycle must run in a J2EE container)  may prove to be overkill for a lot of organizations.</p>

<p>Another downside of Adobe AIR is the lack of true multi-threading.  Plugins like Google Gears and Silverlight both expose multi-threading out of the box.  The AIR framework, on the other hand, runs on a single thread.  System threads to perform database operations are spawned separately, but once the data is returned, the processing of this data occurs on the same operating thread as the UI. While <a href="http://www.adobe.com/devnet/air/flex/articles/air_sql_operations_06.html">patterns exist</a> to minimize the impact on the user, they may lack the sophistication veteran desktop programmers are used to working with in other environments.</p>

<p>One thing to keep in mind about developing an installable application like AIR, is the responsibilities that comes with the power of developing with AIR&#8217;s API, which is rather extensive. Just like any other application run from an installer, the user makes one choice at the beginning of the process to explicitly trust the application developer and the application. Because AIR has access to the file system, a developer with the wrong intentions could do great damage with it.  While the <a href="http://labs.adobe.com/wiki/index.php/AIR:HTML_Security_FAQ">AIR HTML security</a> is designed to protect developers from writing applications that could be exploited by third parties, the up-front contract between the user and the AIR application still gives the developer a lot of opportunities to do evil.  Check out Lucas Adamski&#8217;s article to get an understanding of the <a href="http://www.adobe.com/devnet/air/articles/introduction_to_air_security.html">AIR security model</a>.</p>

<h3>Google Gears</h3>

<p><a href="http://gears.google.com/" title="Google Gears">Google Gears</a> is a framework that adds powerful desktop functionality to the browser through a toolbar or browser plugin.  Google Gears exposes three major components: <em>LocalServer</em>, which allows developers to cache and serve application resources (HTML, JavaScript, images, etc.) locally, <em>Database</em> to store data locally in a fully-searchable relational database powered by SQLite, and possibly the most important offering, the <em>WorkerPool</em>, which makes web applications more responsive by performing resource-intensive operations asynchronously.</p>

<table cellspacing="0">
<thead>
<tr>
<td class="positive">Pros</td>
<td class="negative">Cons</td>
</tr>
</thead>
<tbody>
<tr>
<td>Few security concerns</td>
<td>Confined to the browser</td>
</tr>
<tr>
<td>Plugin rather than install</td>
<td>Sync left up to developer</td>
</tr>
<tr>
<td>Enhances current browser</td>
<td></td>
</tr>
<tr>
<td>New API advancements</td>
<td></td>
</tr>
</tbody>
</table>

<p>From a security perspective, your users end up making a smaller commitment with Google Gears.  Gears runs within the sandbox of the browser, storing data BLOBs and the SQLite DB within a protected area.  Unlike an installed application, Gears does not have arbitrary access to the file system.</p>

<p>One promising feature in Google Gears is the <a href="http://code.google.com/apis/gears/api_blob.html">BLOB API</a>, which provides a way to reference binary data in web applications.  Google&#8217;s Chris Prince explains in <a href="http://www.youtube.com/watch?v=hapkRYxCU_8">this video</a> how the BLOB API can allow the developer to manipulate a memory stream that the browser can interact with to create an elegant solution for large file uploads.</p>

<p>Google Gears does find itself lacking in two areas: easy offline synchronization and advanced integration with the desktop. No framework is provided for synchronization like AIR. The <a href="http://code.google.com/apis/gears/architecture.html">architecture</a> documentation explains to the developer how to check online status, but leaves the synchronization code up to the developer. Additionally, Gears is confined to the browser and so an application developer has no way to adjust the user experience outside the confines of the page.  While the new Gears API has desktop shortcuts and <a href="http://growl.info/">Growl</a>-like / Growl compatible notifications (depending on your OS), an application designer is very limited in creating the controlled experience you see in most desktop applications.</p>

<h3>Microsoft Silverlight</h3>

<p><a href="http://silverlight.net/" title="Silverlight">Silverlight</a> is a Rich Application Architecture designed by Microsoft meant to topple Flash as the leader in rich online content.  Like Google Gears, it installs as a plugin and runs in all the major browsers.  It offers slick vector graphics support, a sandboxed offline data storage component, and most importantly, access to a reduced version of the .NET runtime.  Like all Microsoft development tools, the framework is steeped in Microsoft-specific buzzwords, but the concept looks compelling.</p>

<table cellspacing="0">
<thead>
<tr>
<td class="positive">Pros</td>
<td class="negative">Cons</td>
</tr>
</thead>
<tbody>
<tr>
<td>Vector Graphics</td>
<td>Expensive Dev Tools</td>
</tr>
<tr>
<td>Sandboxed Data</td>
<td>Market Penetration Low</td>
</tr>
<tr>
<td>.NET framework</td>
<td></td>
</tr>

</tbody>
</table>

<p>Silverlight consumes XAML documents that act as the UI layer instructing the instantiation of objects written in one of many of the languages supported by the .NET framework.  This multi-language support is a key selling-point of Silverlight.  It allows developers from an enterprise to contribute their pre-written libraries to a Silverlight project, provided they meet certain specs.</p>

<p>One major con to the development of a Silverlight project is the barrier to entry set up by the IDE.  Unlike the other dev environment listed here, Microsoft stands alone in charging thousands of dollars for a single developer seat.  For example, outfitting your single designer with <a href="http://www.microsoft.com/expression/products/purchase.aspx?key=blend">Expression Blend</a>, the creatives tool for working with XAML, and two of your developers with <a href="http://www.windowsmarketplace.com/results.aspx?text=visual%20studio%202008%20professional&amp;tabid=1">Visual Studio 2008</a> costs over $1700.</p>

<p>One other major concern is the install base and market penetration of Silverlight.  Microsoft is pushing hard to power big-name events like the Demographic National Convention and the 2008 Olympics, where they reported that of the <a href="http://www.reuters.com/article/marketsNews/idINN2228041820080822?rpc=44&amp;sp=true">50 million visitors</a> nearly 50 percent of them had the Silverlight plugin installed.  Compare that with the over 80 percent of browsers running Adobe&#8217;s Flash and it is easy to understand why website developers may be reluctant to serve a page that requires users to install another plugin.  That said, with Silverlight 2.0 slated for a October 15th release date, you can be sure that Microsoft will be finding bigger venues to show off their shiny new plugin.</p>

<h3>Further Reading</h3>

<p>While this wasn&#8217;t a comprehensive review, I hope it&#8217;ll  give you a nice jumping-off point for your own research. For more information, definitely check out the following articles:</p>

<ul>
<li><a href="http://www.theregister.co.uk/2008/08/18/silverlight_pros_and_cons/">Silverlight Pros and Cons</a></li>
<li><a href="http://www.itwriting.com/blog/310-adobe-air-10-reasons-to-love-it-10-reasons-to-hate-it.html">Adobe Air Pros and Cons</a></li>
<li><a href="http://www.insideria.com/2008/07/air-data-synchronization-via-l.html">Synchronization with LiveCycle</a></li>
<li><a href="http://code.google.com/apis/gears/">Gears 0.4 Release</a></li>
<li><a href="http://www.techcrunch.com/2008/05/28/myspace-shows-facebook-how-its-done-google-gears-to-power-messaging/">Facebook uses Gears to Power Messaging</a></li>
</ul>
<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://particletree.com/notebook/rich-application-architecture-roundup/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Calculating Color Contrast for Legible&#160;Text</title>
		<link>http://particletree.com/notebook/calculating-color-contrast-for-legible-text/</link>
		<comments>http://particletree.com/notebook/calculating-color-contrast-for-legible-text/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 19:14:09 +0000</pubDate>
		<dc:creator>Kevin Hale</dc:creator>
				<category><![CDATA[Notebooks]]></category>

		<guid isPermaLink="false">http://particletree.com/?p=485</guid>
		<description><![CDATA[In the past on Particletree, we&#8217;ve shared some of our favorite resources and guides for helping the color challenged and uninspired get their chromatic deliciousness on. As a designer, getting to choose the colors is often the part of the job I like the best. However, there are times when it&#8217;s nice to be able [...]<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></description>
			<content:encoded><![CDATA[<p>In the past on Particletree, we&#8217;ve shared some of our favorite <a href="http://particletree.com/notebook/show-me-the-colors/">resources</a> and <a href="http://particletree.com/notebook/color-image-scale/">guides</a> for helping the color challenged and uninspired get their chromatic deliciousness on. As a designer, getting to choose the colors is often the part of the job I like the best. However, there are times when it&#8217;s nice to be able to write some code to help make some of the decisions for you.</p>

<p>One of my favorite implementations of using programming to supplement the color picking process was done by the clever Canadians over at <a href="http://dabbledb.com">Dabble DB</a>. All you have to do is upload your logo and their application will automatically pick the colors based on the information contained in the image and create a theme for their web app that will match the logo.</p>

<p><a href="http://blog.dabbledb.com/2007/04/white--or-green.html"><img src="http://dabbledb.typepad.com/photos/uncategorized/2007/07/04/dabbledark.png" alt="DabbleDB Logo Color Picker" /></a></p>

<p>It&#8217;s an impressive feature that helps the user focus on getting things done rather than worry over the details. While I won&#8217;t be going into <a href="http://blog.dabbledb.com/2007/04/white--or-green.html">all of the ideas they used</a> to implement their feature in this article, I do want to take some time to talk about how you can get a legible contrasting foreground color for a piece of text when given a specific background color.</p>

<p>When we were working on the <a href="http://wufoo.com/gallery/">Wufoo Form Gallery</a>, I wanted a way to represent the pre-made color palette themes in a concise format without having to go through the laborious process of making a screenshot for each one. After a lot of trial and error, the following format is what we came up with for the gallery to represent themes:</p>

<p><img src="http://wufoo.com/images/gallery/legend.gif" alt="Form Gallery Theme Legend" /></p>

<p>The problem that we ran into after coming up with a structure that we liked, was that the text inside each color swatch needed to have some sort of logic applied to it so that it would show legibly regardless of whether it was a dark swatch or a light swatch behind it. This is when we turned to color theory to help us out.</p>

<p>According to the W3C, when you&#8217;re evaluating your web site for accessibility, you should ensure that foreground and background color combinations provide sufficient contrast when viewed by someone having color deficits or when viewed on a black and white screen. How does one know if two colors will provide sufficient contrast? Well, the W3C, being the fastidious folks that they are, provide the following definition and formulas to make what seems subjective very quantifiable:</p>

<blockquote>
  <p>Two colors provide good color visibility if the brightness difference and the color difference between the two colors are greater than a set range.</p>
  
  <p><strong>Color brightness is determined by the following formula:</strong> <br />
  ((Red value X 299) + (Green value X 587) + (Blue value X 114)) / 1000</p>
  
  <p><strong>Color difference is determined by the following formula:</strong> <br />
  (max (Red 1, Red 2) - min (Red 1, Red 2)) + (max (Green 1, Green 2) - min (Green 1, Green 2)) + (max (Blue 1, Blue 2) - min (Blue 1, Blue 2))</p>
  
  <p><a href="http://www.w3.org/WAI/ER/WD-AERT/#color-contrast">Techniques For Accessibility Evaluation And Repair Tools</a></p>
</blockquote>

<p>And so, if you&#8217;ve got two colors and their color brightness difference is greater than 125 and the color difference is greater than 500, you&#8217;re in the clear. Unfortunately, the formulas are only a starting point. They can evaluate whether your colors are made to be together, but they can&#8217;t actually decide your colors. Thankfully, the Internet is filled with a number of wonderful people that have tackled the problem head on. One of our favorite solutions we looked at was created by Patrick Fitzgerald over at <a href="http://www.barelyfitz.com/">BarelyFitz Designs</a>. His <a href="http://www.barelyfitz.com/projects/csscolor/">CSS Color Class</a> allows you to refer to colors using abstract names like base and highlight, automatically generate color gradients from a single base color and also adjust the contrast of foreground colors so they can be legibly seen on top of background colors.</p>

<p><a href="http://www.flickr.com/photos/wufoo/2883081740/" title="CSS Color Class"><img src="http://farm4.static.flickr.com/3265/2883081740_383d1ace67_o.png" width="390" height="219" alt="CSS Color Class" /></a></p>

<p>While the CSS Colors Class is great and comes highly recommended by us (we&#8217;ve been able to do some pretty neat experimental stuff with it that we&#8217;ll hopefully use in the future), we thought for our purposes in the gallery, it was a bit too much overhead. Eventually, we ended up creating our own Smarty Modifier plugin based on code we found in the <a href="http://us2.php.net/manual/en/function.hexdec.php#74092">PHP documentation on the hexdec function</a>&#8212;boy, do we love that community. Here&#8217;s the code we came up with, which can be easily be rewritten if you don&#8217;t use Smarty in your development environment.</p>

<pre><code>function smarty_modifier_contrast($hexcolor, $dark = '#000000', $light = '#FFFFFF')
{
    return (hexdec($hexcolor) &gt; 0xffffff/2) ? $dark : $light;
}
</code></pre>

<p>It&#8217;s very simple and very lightweight, which was exactly what we were looking for in a solution for the problem. The way the code works is that given a hex color like <code>#FFFFFF</code> or <code>#CCCCCC</code>, it will return either the hex for black or white depending on what&#8217;s appropriate. You can also pass in variables for <code>$dark</code> and <code>$light</code> in case you want the function to return colors other than black and white. In our Smarty template, we call it in our markup structure like so:</p>

<pre><code>&lt;span class="palette"&gt;
    &lt;var class="w" style="background-color:{$bgHtmlColor};
        color:{$bgHtmlColor|contrast}"&gt;W&lt;/var&gt;
    &lt;var class="l" style="background-color:{$bgLogoColor};
        color:{$bgLogoColor|contrast}"&gt;L&lt;/var&gt;
    &lt;var class="i" style="background:{$bgInstructColor};
        color:{$ftInstructColor}"&gt;I&lt;/var&gt;
    &lt;var class="f" style="background:{$bgFormColor};
        color:{$ftFieldTitleColor}"&gt;F&lt;/var&gt;
    &lt;var class="h" style="background:{$bgHighlightColor};
        color:{$ftFieldTitleColor}"&gt;H&lt;/var&gt;
&lt;/span&gt;
</code></pre>

<p>Notice that the code doesn&#8217;t take those color difference and color brightness formulas into account. Basically, it crudely (yet kind of elegantly) divides the RGB color spectrum into two halves and if the color you give it is on one side, it returns one value, otherwise, the other. Here&#8217;s a very rough visual approximation I mocked up to illustrate the concept:</p>

<p><a href="http://www.flickr.com/photos/wufoo/2881608487/" title="Spectrum Color Contrast"><img src="http://farm4.static.flickr.com/3146/2881608487_87f5f859ac_o.jpg" width="600" height="300" alt="Spectrum Color Contrast" /></a></p>

<p>And so while it&#8217;s not perfect, in 99% of cases, the function does what you need it to do without a lot of number crunching or programming overhead. Here&#8217;s an image showing off the function in action on a number of the themes we created in the gallery.</p>

<p><a href="http://www.flickr.com/photos/wufoo/2882443376/" title="Gallery Color Contrast"><img src="http://farm4.static.flickr.com/3291/2882443376_719d550c7a_o.png" width="500" height="198" alt="Gallery Color Contrast" /></a></p>

<p>We&#8217;ve even recently reused the functionality when we made some <a href="http://wufoo.com/2008/09/16/report-upgrades-and-new-graphs/">upgrades to our graphing system</a> in Wufoo. Now, our graphs automatically determine and use the appropriate color for the grid lines based on the background color a user has selected from their themes.</p>

<p><a href="http://www.flickr.com/photos/wufoo/2881608453/" title="Graph Color Contrast"><img src="http://farm4.static.flickr.com/3051/2881608453_0d81bae4a7_o.png" width="650" height="209" alt="Graph Color Contrast" /></a></p>

<p>This way, the graphs are easy to read and follow even on a dark theme palette. It&#8217;s a small detail that we think makes a lot of difference in an application. If you want perfect contrast, then obviously CSS Colors is the way to go for you, but for us we&#8217;ve been really happy with the results.</p>
<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://particletree.com/notebook/calculating-color-contrast-for-legible-text/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Reasons to Use Inspiring Tools and&#160;Brands</title>
		<link>http://particletree.com/notebook/reasons-to-use-inspiring-tools-and-brands/</link>
		<comments>http://particletree.com/notebook/reasons-to-use-inspiring-tools-and-brands/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 14:09:47 +0000</pubDate>
		<dc:creator>Alex Vazquez</dc:creator>
				<category><![CDATA[Notebooks]]></category>

		<guid isPermaLink="false">http://particletree.com/?p=475</guid>
		<description><![CDATA[Earlier this week, David Heinemeier Hansson wrote a bit about why he thinks indulging in aesthetically pleasing tools should be a guilt-free experience. It was a response to a post by Matt Maroon on News.YC and if you&#8217;re interested, you should also check out Matt&#8217;s counter-response. Hoping to add to the discussion with our own [...]<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></description>
			<content:encoded><![CDATA[<p>Earlier this week, David Heinemeier Hansson wrote a bit about why he thinks indulging in aesthetically pleasing tools <a href="http://www.37signals.com/svn/posts/1247-theres-no-shame-in-looking-good">should be a guilt-free experience</a>. It was a response to <a href="http://news.ycombinator.com/item?id=305008">a post</a> by Matt Maroon on <a href="http://news.ycombinator.com">News.YC</a> and if you&#8217;re interested, you should also check out Matt&#8217;s <a href="http://mattmaroon.com/?p=472">counter-response</a>. Hoping to add to the discussion with our own flavors, we thought we&#8217;d point out some other reasons why you shouldn&#8217;t discount the role of aesthetics when deciding on what tools you should get.</p>

<p>Gavan Fitzsimons and Tanya Chartrand, professors of psychology and marketing at Duke University, did some research on the topic by subliminally priming over 300 subjects with either an Apple or IBM logo. They were then given a brick and asked to come up with as many uses for the brick as they could. The results of the study revealed that brands and our environment influence our thoughts quite a bit. Apparently, the subjects exposed to the Apple logo &#8220;generated significantly more unusual uses for the brick compared with those who were primed with the IBM logo.&#8221; You can watch the researchers talk about the study in the following video:</p>

<p><object width="425" height="344" style="margin:0 auto"><param name="movie" value="http://www.youtube.com/v/iFBnv1dkUmk&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/iFBnv1dkUmk&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></p>

<p>While Fitzsimons has focused some of his conclusions toward the marketing departments behind these brands, it&#8217;s more interesting for us to know that the personality of a company can influence and filter down to users by logo alone. And so the argument can be made that purchasing tools that are aesthetically pleasing and innovatively designed by companies with similar attributes can help inspire our subconscious to also want to create aesthetically pleasing and innovative software.</p>

<p>Here&#8217;s some anecdotal data that will help emphasize the point. J.J. Abrams, one of the creators of Lost, gave a talk at TED about why he&#8217;s so interested in the power of mysteries. A little after the 8th minute, he presents exactly why he uses Apple&#8217;s products when he writes:</p>

<blockquote>
  <p>I love Apple computers. I&#8217;m obsessed. So the Apple computer. The powerbook. It challenges me. It basically says, &#8220;What are you going to write worthy of me?&#8221; I can feel this. I&#8217;m compelled. And often I&#8217;m like dude, today I&#8217;m out. I got nothing.</p>
  
  <p><a href="http://www.ted.com/index.php/talks/j_j_abrams_mystery_box.html">J.J. Abrams - Mystery Box</a></p>
</blockquote>

<p>Chris has written about this before in an article about the <a href="http://particletree.com/features/the-importance-of-design-in-business/">role of design in businesses</a>, but the Japanese believe that all products should strive to have this inspirational quality in their work. In order to have a quality product or service, it needs to be created in a way that satisfies two different ideas of quality:</p>

<blockquote>
  <p>The first, <strong>atarimae hinshitsu</strong>, which is roughly translated as &#8220;taken-for-granted quality,&#8221; is the idea that things will work as they are intended. The second, <strong>miryokuteki hinshitsu</strong>, which means &#8220;enchanting quality,&#8221; is the idea that things should have an aesthetic quality that appeals to a person’s sense of beauty.</p>
</blockquote>

<p>And if you&#8217;ve ever picked up a <a href="http://msdn.microsoft.com/en-us/library/ms993289.aspx">katana</a>&#8212;a Japanese sword of the finest craftsmanship, then you&#8217;ll know exactly how this manifests. The thing to take away from this, of course, is not that Japanese products or Apple computers are the only things to use if you&#8217;re going to be innovative. It&#8217;s that context and environment matters in ways that people sometimes don&#8217;t even realize. Because humans are relationship-making creatures, we are emotionally influenced by the things we encounter over and over again and tools obviously fall into that category. And so, maybe, the choices we make regarding our tools shouldn&#8217;t come down to price alone. And maybe, as the developers of tools, we should strive to make products that inspire others with equal passion and energy.</p>
<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://particletree.com/notebook/reasons-to-use-inspiring-tools-and-brands/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Object Oriented PHP Memory&#160;Concerns</title>
		<link>http://particletree.com/notebook/object-oriented-php-memory-concerns/</link>
		<comments>http://particletree.com/notebook/object-oriented-php-memory-concerns/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 15:29:05 +0000</pubDate>
		<dc:creator>Ryan Campbell</dc:creator>
				<category><![CDATA[Notebooks]]></category>

		<guid isPermaLink="false">http://particletree.com/?p=457</guid>
		<description><![CDATA[It&#8217;s hard to imagine pushing the limits of object oriented PHP so far that your web servers choke, but the truth is those limits are reached faster than you think. We&#8217;ve run some tests over at Wufoo and it turns out that any sort of mass object creation is pretty much not going to work [...]<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s hard to imagine pushing the limits of object oriented PHP so far that your web servers choke, but the truth is those limits are reached faster than you think. We&#8217;ve run some tests over at Wufoo and it turns out that any sort of mass object creation is pretty much not going to work at scale. The problem is this limit on object creation forces developers to balance code consistency, which is desirable&#8212;especially for the old-schoolers, with performance. While replacing objects with arrays when possible makes things a little better, the most performance friendly approach involves appending strings. For your convenience, we&#8217;ve run some tests that measure page execution times and memory usage to create the following guideline to help you plan out what areas of your code may have to break away from an object oriented nature.</p>

<h3>The Benchmarks</h3>

<p>Basically, we set up a simple PHP page to iterate over a loop and create 1) a giant concatenated string, 2) an array of arrays containing the word &#8216;test&#8217;, and 3) an array of objects with one variable set to &#8216;test&#8217;.</p>

<table cellspacing="0">
    <thead>
        <tr>
            <td></td>
            <td>Load Time</td>
            <td>Memory Used</td>
        </tr>
    </thead>
    <tbody>
        <tr><td>Control</td><td>12.6ms</td><td>1.42mb</td></tr>
        <tr><td>11,000&#160;<b>strings</b></td><td>15.7ms</td><td>1.45mb</td></tr>
        <tr><td>11,000&#160;<b>arrays</b></td><td>26.6ms</td><td>3.99mb</td></tr>
        <tr><td>11,000&#160;<b>objects</b></td><td>148.8ms</td><td>7.70mb</td></tr>
        <tr><td>25,000&#160;<b>arrays</b></td><td>44.1ms</td><td>7.25mb</td></tr>
        <tr><td>1,500,000&#160;<b>strings</b></td><td>253.2.6ms</td><td>7.14mb</td></tr>
    </body>
</table>

<p>As the table shows, creating objects takes a good amount of memory and time when compared to a string or array. And since 7.7mb is nearing the default memory limit for PHP, the page is about to time out. Sure, the memory limit can be increased, but the point is that there is still a maximum. For most pages, 11,000 objects is overkill. But in some cases, like exporting a hefty database to CSV format or returning data from a public API, we may want to return 50,000+ records.</p>

<h3>Workarounds</h3>

<p>The good news is that the memory limitation does not put us in a place where the advantages of reusable code is completely removed. We just have to take a few precautions when writing code that has intensive looping or object creation.</p>

<ul>
<li><p><strong>unset()</strong> - Avoid getting at objects through the accessor, and work directly with the recordset loop. After each iteration, unset the object that was just created. After a quick test, 45,000 objects could be created and unset using 1.43mb of memory at peak.</p></li>
<li><p><strong>Static Method Calls</strong> - A static method can be called without the need to instantiate an object. For example, if our desired output is an XML string, but we need some of the objects helper functions, we can still call functions off of the objects statically with Object::function(). Doing so only increased memory usage from 1.45mb to 1.46mb in the string example.</p></li>
<li><p><strong>Paging</strong> - The downside to unset() and static methods is that we have to bypass our accessors to get at the objects and work directly with the loop. A third option is to be strict with paging, and never allow for more than X number of objects to be returned. This will keep the code 100% consistent, but may be a bit more intensive on the database and increase page execution time.</p></li>
</ul>

<h3>Why Does this Matter?</h3>

<p>Many development techniques, such as <a href="http://en.wikipedia.org/wiki/Domain-driven_design" title="Domain Driven Design">domain driven design</a>, keep a set of value objects along with an accessor to each of those objects. The accessors act as an API that make retrieval of the objects easy and consistent. For example, let&#8217;s say we have a <code>User</code> object, and a <code>UserAccessor</code> &#8212; we would call <code>UserAccessor-&gt;loadAllUsers()</code>, which would return to us an array of <code>User</code> objects. Then, we can loop through the array, and display a list of all users and have access to the member variables and functions.</p>

<p>This is great because all developers work with the same objects, and SQL queries are constrained to accessors. Even if this isn&#8217;t your preferred development style, chances are your object oriented approach strives to achieve similar levels of consistency. That said, we can see from the benchmarks above that there may be situations where a portion of code we&#8217;ve created cannot return an array of objects because of memory limitations. Overall, object memory usage is far from a deal breaker, but it is something every developer worried about scaling should be aware of.</p>

<p>For more information, here are a couple of links that may provide some more insight.</p>

<ul>
<li><p><a href="http://www.devolio.com/blog/archives/314-Practical-and-impractical-PHP-Optimizations.html" title="PHP Optimizations">Practical and impractical PHP Optimizations</a></p></li>
<li><p><a href="http://reinholdweber.com/?p=3" title="40 Tips">40 Tips for optimizing PHP</a></p></li>
<li><p><a href="http://www.xdebug.org/docs/profiler" title="XDebug">Use Profiling to Determine Bottlenecks</a></p></li>
</ul>
<p><a class="ptad" href="http://wufoo.com/" title="HTML Form Builder"><img src="/images/ads/wufooad10.gif" alt="HTML Form Builder" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://particletree.com/notebook/object-oriented-php-memory-concerns/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 2.946 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2011-05-13 09:40:15 -->
