<?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>Blog Pav Blog &#187; Software Development</title>
	<atom:link href="http://www.pavley.com/tag/software-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pavley.com</link>
	<description>“A great leap in the dark” – Thomas Hobbes</description>
	<lastBuildDate>Thu, 05 Jan 2012 05:02:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>ARC Memory Management in iOS 5 and Cocos2d-iPhone 2.0</title>
		<link>http://www.pavley.com/2012/01/04/arc-memory-management-in-ios-5-and-cocos2d-iphone-2-0/</link>
		<comments>http://www.pavley.com/2012/01/04/arc-memory-management-in-ios-5-and-cocos2d-iphone-2-0/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 05:02:05 +0000</pubDate>
		<dc:creator>pav</dc:creator>
				<category><![CDATA[Cocos2d-iPhone]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ARC]]></category>
		<category><![CDATA[Game Development]]></category>
		<category><![CDATA[iOS 5]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Xcode 4]]></category>

		<guid isPermaLink="false">http://www.pavley.com/?p=520</guid>
		<description><![CDATA[My rewrite of Dungeonators is crawling along at a glacial pace. Mostly because I can only work a couple of hours a week on the project. But the iOS 5 way to manage memory with ARC (automated reference counting) is making the process far less painful than it was the first time I wrote my [...]]]></description>
			<content:encoded><![CDATA[<p>My rewrite of Dungeonators is crawling along at a glacial pace. Mostly because I can only work a couple of hours a week on the project. But the iOS 5 way to manage memory with ARC (<a href="http://developer.apple.com/library/ios/#releasenotes/ObjectiveC/RN-TransitioningToARC/_index.html#//apple_ref/doc/uid/TP40011226">automated reference counting</a>) is making the process far less painful than it was the first time I wrote my game. ARC uses annotations and some new key words to manage memory on your behalf. It works very well if you&#8217;re doing simple client-side game development and don&#8217;t have to worry about backward compatibility with iOS 4.</p>
<p>Here is an example of how ARC changes your life for the better&#8230;</p>
<p>In the old days you would declare out your ivars, declare your properties, then synthesize and map them together, and release them in a dealloc method. This little design pattern required 4 repetitive lines of code for every ivar (instance variable) and engendered flamewars about  coding style and where underscore should go (if you thought it was necessary to distinguish an ivar name from a property name).</p>
<p>Pre-ARC Entity.h</p>
<pre class="brush: c++">#import "cocos2d.h"
@interface Entity : CCSprite {
BOOL isActive_;
NSString * name_;
}
@property (nonatomic) BOOL isActive;
@property (nonatomic, copy) NSString * name;
@end</pre>
<p>Pre-ARC Entity.m</p>
<pre class="brush: c++">#import "Entity.h"
@implementation Entity
@synthesize isActive = isActive_;
@synthesize name = name_;
- (id) init {
  self = [super init];
  if (self) {
    isActive_ = YES;
    name_ = @"Fang";
  }
  return self;
}
- (void) dealloc {
  [name_ release];
  name_ = nil;
  [super dealloc];
}</pre>
<p>In this new modern era of automated reference counting I just declare properties, I don&#8217;t worry about accessing the ivars directly, and I don&#8217;t write my own dealloc. It&#8217;s a lot less code in a complex game where characters and objects have dozens of properties.</p>
<p>Post-ARC Entity.h</p>
<pre class="brush: c++">#import "cocos2d.h"
@interface Entity : CCSprite
@property (nonatomic) BOOL isActive;
@property (nonatomic, strong) NSString * name;
@end</pre>
<p>Post-ARC Entity.m</p>
<pre class="brush: c++">#import "Entity.h"
@implementation Entity
@synthesize isActive;
@synthesize name;
- (id) init {
  self = [super init];
  if (self) {
    isActive = YES;
    name = @"Fang";
  }
  return self;
}</pre>
<p>To get Cocos2d-iPhone to work with ARC was really easy: I just replace the NSAutoreleasePool object in main.m with the new ARC friendly @autoreleasepool annotation. (I might not have had to do this but it&#8217;s supposedly more efficient.)</p>
<pre class="brush: c++">int main(int argc, char *argv[]) {
//    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
//    int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
//    [pool release];
//    return retVal;
  int retVal;
  @autoreleasepool {
    retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
  }
  return retVal;
}</pre>
<p>The downside, as I stated above, is that your app will only run on iPhones, iPads, and iPods running iOS 5 and you need to use Cocos2d-iPhone 2.0. But I think that&#8217;s a fair tradeoff. Backward compatibility is a killer of the artistic soul and should be avoided where possible. <em>To Err is human, but to upgrade is divine</em> <img src='http://www.pavley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Check out <a href="http://www.raywenderlich.com/5677/beginning-arc-in-ios-5-part-1">Ray Wenderlich&#8217;s excellent ARC tutorial</a> for all the gritty details!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pavley.com/2012/01/04/arc-memory-management-in-ios-5-and-cocos2d-iphone-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When Dogfooding Fails</title>
		<link>http://www.pavley.com/2011/11/05/when-dogfooding-fails/</link>
		<comments>http://www.pavley.com/2011/11/05/when-dogfooding-fails/#comments</comments>
		<pubDate>Sun, 06 Nov 2011 04:35:01 +0000</pubDate>
		<dc:creator>pav</dc:creator>
				<category><![CDATA[Product Design]]></category>
		<category><![CDATA[Tech Trends]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.pavley.com/?p=418</guid>
		<description><![CDATA[For over 20 years we&#8217;ve been eating our own dog food in the software industry and it&#8217;s not working. For the uninitiated dogfooding means to actually use the product you&#8217;re developing. It started out as a radical idea at Microsoft and spread as a way to get developers to experience their customer&#8217;s pain. On the [...]]]></description>
			<content:encoded><![CDATA[<p>For over 20 years we&#8217;ve been <a href="http://en.wikipedia.org/wiki/Eating_your_own_dog_food">eating our own dog food</a> in the software industry and it&#8217;s not working. For the uninitiated dogfooding means to actually use the product you&#8217;re developing. It started out as a radical idea at Microsoft and spread as a way to get developers to experience their customer&#8217;s pain. On the surface it was a very good idea&#8211;especially for an aging corporate culture divorced from its users. When I interviewed with Microsoft in 1995 I was told that all their engineers we&#8217;re given low-end <a href="http://www.pcguide.com/ref/cpu/fam/g3I386DX-c.html">386 PCs</a>. These PCs ran Windows 95 so slowly that the MS developers were incentivized to improve Windows&#8217; performance to ease their own suffering. I don&#8217;t know about you, but I find that Windows is still pretty slow even in 2011 running on a really fast multicore PC. Clearly all this dogfooding is not helping.</p>
<p>So I&#8217;d like to <em>frame an argument</em> against dogfooding and in favor of something else: Plagiarism.</p>
<p>My argument goes like this:</p>
<ol>
<li>Dogfooding doesn&#8217;t work, or at least it&#8217;s not sufficient, because it&#8217;s not a good predictor of software success. Some software that is dogfooded is very successful. Most software that is dogfooded fails. (Most software fails and most software is dogfooded therefore dogfooding fails.)</li>
<li>Dogfooding is really bad because it give you a false sense of doing something to improve your product: &#8220;It&#8217;s OK, I know our software is <em>terrible</em> but we&#8217;re forcing our employees to dogfood it and out of shear frustration they will make things better! Everyone go back to sleep&#8230;&#8221;</li>
<li>Dogfooding reinforces bad product design. Human beings are highly adaptable (and last time I looked software devs are still considered human). We get used to things, especially in a culture where company pride and team spirit are valued (e.g. <a href="http://www.psysr.org/about/pubs_resources/groupthink%20overview.htm">groupthink</a>). Over time poor performance becomes typical performance. It starts to feel natural. Thus slow loading Windows operating systems become the gold standard for thousands of loyal Microsoft employees and customers. Instead of fixing the software we are fixed by it.</li>
</ol>
<p>I believe that the urge to Dogfood is an emergent strategy of mature tech companies that want to rejuvenate their software development process. Management starts talking about Dogfooding when they realize the spark of creativity has gone out and they want to reignite it.</p>
<p>One of the reasons Dogfooding fails is that you never eat your own dog food in the beginning: The dog food didn&#8217;t exist yet. You had to get your inspiration from outside the company. Microsoft Windows was not the first OS with a graphical mouse-driven shell. At some point the Windows devs must have looked at the <a href="http://oldcomputers.net/lisa.html">Apple Lisa</a> and Macintosh computers for inspiration. And the Apple devs looked at the <a href="http://www.digibarn.com/friends/curbow/star/retrospect/">Xerox Star</a>. And the Xerox devs drew their inspiration from the physical world: The first GUI desktop was modeled on an actual physical desktop. No dog food there.</p>
<p>So rather than dogfooding we should talking about plagiarism. If you want to make a great software product <em>eat</em> another a great software product and make it taste better&#8211;don&#8217;t eat <a href="http://answers.yahoo.com/question/index?qid=20080127192201AA1gaMF">yucky dog food</a>.</p>
<p>Microsoft should force their devs to use the fastest computers running the best operating systems with really cool applications. I think they must have bought some MacBook Airs, installed Ubuntu and <a href="http://www.spotify.com/uk/download/previews/">Spotify</a> because <a href="http://windows.microsoft.com/en-US/windows-8/preview">Windows 8</a> looks pretty awesome <img src='http://www.pavley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pavley.com/2011/11/05/when-dogfooding-fails/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Fraction: Does not recognize selector forward::</title>
		<link>http://www.pavley.com/2011/07/23/fraction-does-not-recognize-selector-forward/</link>
		<comments>http://www.pavley.com/2011/07/23/fraction-does-not-recognize-selector-forward/#comments</comments>
		<pubDate>Sat, 23 Jul 2011 16:30:04 +0000</pubDate>
		<dc:creator>pav</dc:creator>
				<category><![CDATA[Nerd Fun]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.pavley.com/?p=396</guid>
		<description><![CDATA[If you&#8217;re crazy like me you love reading really good primers on programming. Not just to learn about a particular language but to enjoy well written technical prose. (Yeah, I said I was crazy). Yesterday, I started reading Stephen Kochan&#8217;s classic Programming in Objective-C (original edition), which was published in 2003. What I like about [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re crazy like me you love reading really good primers on programming. Not just to learn about a particular language but to enjoy well written technical prose. (Yeah, I said I was crazy). Yesterday, I started reading Stephen Kochan&#8217;s classic <a href="http://www.amazon.com/Programming-Objective-C-Stephen-Kochan/dp/0672325861">Programming in Objective-C (original edition)</a>, which was published in 2003. What I like about <a href="http://classroomm.com/objective-c/index.php">Kochan</a> is how he presents the principles of object oriented programming and the syntax of Objective-C without jumping into writing a fancy application. Kochan takes his time to teach each component of the language and the paradigm instead of glossing over the details to quickly get to a utilitarian example.</p>
<p>If you want to understand how a great tutorial is written you can&#8217;t do much better than Kochan. Unfortunately a lot has changed in the Mac OS X world since 2003 and the code examples don&#8217;t compile. The code is fine. It&#8217;s the default compiler setting that have changed. A Google search on the compile error brought me to a a good <a href="https://discussions.apple.com/thread/2140085?start=15&amp;tstart=0">discussion</a> on the problem on Apple&#8217;s developer support forum. You have to dig but the fix is pretty trivial if you know gcc complier flags (which the target audience of a primer are unlikely to know).</p>
<p>My advice to students and armchair time travelers who want to follow the original book is to resist the urge to change the source code examples to inherit from NSObject. Instead use the <em>-arch i386 flag</em> as suggested by very helpful forum user <a href="https://discussions.apple.com/people/Kostantino">Constantino</a>. (Mysteriously Constantino&#8217;s forum name is spelled with a K.)</p>
<p>In other words instead of compiling with</p>
<blockquote>
<pre>gcc <em>ClassName.m</em> -o <em>ProgramName</em> -l objc</pre>
</blockquote>
<p>use</p>
<blockquote>
<pre>gcc -arch i386 -o <em>ProgramName</em> <em>ClassName.m</em> -lobjc</pre>
</blockquote>
<p>To compile and run the OOP first example of the book from the terminal you can copy and paste the following 2 lines:</p>
<pre>gcc -arch i386 -o Fraction Fraction.m -lobjc</pre>
<pre>./Fraction</pre>
<p>And for the full experience, don&#8217;t use Xcode or a fancy text editor. VI is fun, old school, and Apple&#8217;s Terminal a joy to work with.</p>
<p><em>Notes:</em></p>
<ul>
<li>There is a third edition that probably addressed this issue. But what fun is that if you only have the original edition? I would love to set up an old Mac with a vintage version of the Mac OS X to really immerse  myself in the experience!</li>
<li>There is also also a <a href="http://books.google.com/books?printsec=frontcover&amp;id=WM7aTX2hr7EC#v=onepage&amp;q&amp;f=false">Programming in Objective-C 2.0 3rd Edition</a> which looks like a lot of fun to read and which might actually be more relevant if you have an urgent need to write a modern Mac application.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.pavley.com/2011/07/23/fraction-does-not-recognize-selector-forward/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hey It&#8217;s Easier Than You Think (Xcode 4 and Subversion)</title>
		<link>http://www.pavley.com/2011/06/12/hey-its-easier-than-you-think-xcode-4-and-subversion/</link>
		<comments>http://www.pavley.com/2011/06/12/hey-its-easier-than-you-think-xcode-4-and-subversion/#comments</comments>
		<pubDate>Sun, 12 Jun 2011 14:42:07 +0000</pubDate>
		<dc:creator>pav</dc:creator>
				<category><![CDATA[Cocos2d-iPhone]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Source Code Control]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[Xcode 4]]></category>

		<guid isPermaLink="false">http://www.pavley.com/?p=376</guid>
		<description><![CDATA[I love how the new Xcode 4 shows you code changes side-by-side with it&#8217;s version editor view. But I had a little problem. I&#8217;m a subversion fan. Yes, I know, totally not cool. I keep this flaw a secret and I don&#8217;t force my preference on my co-workers nor do I tweet about it. I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>I love how the new Xcode 4 shows you <a href="http://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/SCM/SCM.html">code changes side-by-side</a> with it&#8217;s version editor view. But I had a little problem. I&#8217;m a subversion fan. Yes, I know, totally not cool. I keep this flaw a secret and I don&#8217;t force my preference on my co-workers nor do I tweet about it. I&#8217;m sure with years of therapy and the love and support of my family I&#8217;ll get over it.</p>
<p>But in the meantime I&#8217;m working on an iPhone game and I have a free subversion repository from my <a href="http://dreamhost.com">ISP</a>. I want to continue to use this fee repository even though Apple gently nudges you to GIT with Xcode 4.</p>
<p>I&#8217;m stubborn. I tried GIT and it&#8217;s not doing anything for me. My change control needs are small. The functionality that makes <a href="http://stackoverflow.com/questions/871/why-is-git-better-than-subversion">GIT great</a> is way more than I need: I&#8217;m not working on a large team with a complex build system that has to commit changes with the finesse of a <a href="http://www.imdb.com/title/tt1155592/">tightrope walker</a>.</p>
<p>Today I went back to subversion and my free repository when I had to update my iPhone to the release candidate 3 of the <a href="http://www.cocos2d-iphone.org/">Cocos2d framework</a> (which is host on Github BTW). Back when Xcode 4 was release I just could get Subversion and Xcode to play nice. But being stubborn, I tried again and to my surprise succeeded.</p>
<p>I don&#8217;t think Apple changed much. I think I was just impatient and misinformed. There is a lot of silliness about how to set up Xcode 4 to work with a Subversion repository on the Internets. What worked for me is the functionality that Xcode gives you out-of-the-box (without using the terminal). It was point-and-click but just not automated.</p>
<p>If you&#8217;re interested here is how you get a hosted subversion repository to work with Xcode 4. Have fun and don&#8217;t sweat the snickers from your more version control evolved friends <img src='http://www.pavley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<ol>
<li>Create a new Subversion repository that you can access via your protocol of choice (mine is the open Internet and HTTP because that&#8217;s what Dreamhost provides). Leave this repository empty&#8211;we&#8217;ll use Xcode 4 to set up all the directories. Just remember your URL and password.</li>
<li>Open Xcode 4 and go the Repository tab in the Organizer Window.  Click the tiny little plus sign in the lower left corner to add a connection to a Repository. Enter in the URL and password and wait for the little circle to turn green. Xcode 4 should automagically detect the type of repository. Be patient. This process takes a bit of time and there is absolutely no feedback: Apple forgot to spin the beach ball here.</li>
<li>When you get the green circle click on the root directory icon on the left under the name of the repository and create 3 directories using the New Directory button on the bottom: trunk, branches, tags. Be patient again and wait for the directories to show up in the center pane of the Organizer window.</li>
<li>Click on the name repository on the left and enter the names of our your 3 directories in the 3 fields provided. (See the genius of naming them trunk, branches, tags?) If your spelling is good you&#8217;ll get 3 more green circles.</li>
<li>Click on the Trunk directory on the left and then click on the Import button on the bottom. Select the folder that contains the project you want to put under source code control. Now go away. Get a drink and watch an episode of South Park. You have to be patient because not only is there no beach ball, spinner, or progress bar, there is <em>no green circle</em>!</li>
<li>When you come back you should see your imported directory listed on the main pane. If you click the arrow to the left of it you&#8217;ll find your Xcode 4 project file and a subdirectory of files. Remember to be patient. Your poor overworked laptop has to ask the Subversion server for all this info and it takes way longer than 200 milliseconds to get back to you.</li>
<li>Make sure your original Xcode project is closed and hidden away for safe keeping. Click on the imported project in the main pane of the Organizer window and click on the Checkout button on the bottom. Select a location on your hard disk to store your working copy of the project that won&#8217;t conflict with the original project. It should be OK to overwrite the original but I&#8217;m just paranoid. (Years of experience will do that to you.)</li>
<li>Get a cup of coffee and troll <a href="http://www.reddit.com/r/funny">Reddit</a> for some laughs. When you come back Xcode should ask you in a dialog box if you want to open the project that you just checked out. Say yes and run it just to be sure it&#8217;s all there. (Paranoia again, sorry.)</li>
<li>Now make a change to your and look for the little M to the right of the file name in the Project Navigator pane to show up. Be patient. If it&#8217;s not showing go back the the Organizer Window, back to your Project folder (by selecting its name on the left), and click the Commit button. The little M should now and forever show up next to your modified files in the Project Navigator.</li>
</ol>
<p>I&#8217;m still having a little problem committing from the context menu in the Project Navigator but I can commit just fine from the Organizer Window. Maybe that&#8217;s just how Subversion works with Xcode or more maybe I have to be even more patient. I&#8217;ll let you know!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pavley.com/2011/06/12/hey-its-easier-than-you-think-xcode-4-and-subversion/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cocos2d Tip#3: Making Your iPhone Game Fast</title>
		<link>http://www.pavley.com/2011/04/09/cocos2d-tip3-making-your-iphone-game-fast/</link>
		<comments>http://www.pavley.com/2011/04/09/cocos2d-tip3-making-your-iphone-game-fast/#comments</comments>
		<pubDate>Sat, 09 Apr 2011 18:00:50 +0000</pubDate>
		<dc:creator>pav</dc:creator>
				<category><![CDATA[Cocos2d-iPhone]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.pavley.com/?p=349</guid>
		<description><![CDATA[My first iPhone game, that might actually make it to the App Store, is just about done. (Not done done but almost ready for testing and tweaking.) With the idea that other people beside me might actually play my game I&#8217;ve started to do a very dangerous and high risk activity: Optimization! The all the [...]]]></description>
			<content:encoded><![CDATA[<p>My first iPhone game, that might actually make it to the App Store, is just about done. (Not <a href="http://blog.phpdeveloper.org/?p=148">done done</a> but almost ready for testing and tweaking.)</p>
<p>With the idea that other people beside me might actually play my game I&#8217;ve started to do a very dangerous and high risk activity: <a href="http://en.wikipedia.org/wiki/Program_optimization#Quotes">Optimization</a>!</p>
<p>The all the famous Computer Scientists and Software Architects agree: Optimizing your program is a necessary evil, like the death penalty or bug tracking systems, and to be avoided at all costs.</p>
<p>Well, that&#8217;s not quite true. It&#8217;s premature optimization that is the bad guy here. Don&#8217;t start out programming with performance or scalability in mind, least you optimize code that doesn&#8217;t need it and miss optimizing code that really needs it. (It&#8217;s the same for bug tracking systems&#8211;don&#8217;t put all your junk in Jira or Bugzilla&#8211;just the verifiable, repeatable bugs that you might actually fix one day.)</p>
<p>When I started my game I knew my ideas were going to evolve and I didn&#8217;t want to hard code myself into a corner. I consciously wrote code that I knew would be slow but flexible.</p>
<p>For example I used expensive string comparisons instead of testing for cheap numeric constants. During the initial development phases of my game the strings were self-documenting (I could read them like little notes to myself) and easy to change. Later, when my game solidified and the string comparison were easy to find using Xcode&#8217;s Find in Project command (which is now Xcode 4&#8242;s Find in Workspace command)&#8230;</p>
<pre class="brush: c++">// before optimization
if ([goodGuy.role isEqualToString(@"tank") {
   // aggro something
} else if ([goodGuy.role isEqualToString(@"healer") {
   // fix something
}</pre>
<pre class="brush: c++">// after optimization
switch (goodGuy.role) {
   case CharacterRole_tank:
      // aggro something
      break;
   case CharacterRole_healer:
      // fix something
      break;
   default:
      // oops! This should not happen
      CCLOG(@"unknown character role in %@",NSStringFromSelector(_cmd));
      break;
}</pre>
<p>Changing the type of Character's role property from NSString* to CharacterRole (a typedef'ed int) sped up my game in update methods which were called with every frame change. It was a pain to add all the constants but at least I only had to do it once--even though my conception of a Character and a role changed quite a bit.</p>
<pre class="brush: c++">// Character.h
typedef enum {
    CharacterRole_tank = 0,
    CharacterRole_healer = 1,
    CharacterRole_melee = 2,
    CharacterRole_ranged = 3,
    CharacterRole_boss = 4,
    CharacterRole_add1 = 5,
    CharacterRole_add2 = 6,
} CharacterRole;

// Character.m
@interface Character : NSObject  {
   NSString* _name;
   CharacterRole _role;
   // ...
}
@property (readwrite, copy, nonatomic) NSString* name;
@property (readwrite, assign, nonatomic) CharacterRole role;</pre>
<p>Another big optimization I did was to replace for-loops and with Cocos2d's fast enumeration macros...</p>
<pre class="brush: c++">// before optimization
Character* goodGuy = nil;
for (int i = 0; i &lt; self.goodGuys.count; i++) {
   goodGuy = [self.goodGuys objectAtIndex:i];
   // do something with good guy
}

// after optimization
Character* goodGuy = nil;
CCARRAY_FOREACH(self.goodGuys, goodGuy) {
   // do something with good guy
}</pre>
<p>My list of good guys changes during the game so I stored them in a CCArray&#8211;Cocos2d&#8217;s version of a NSMutuableArray. CCARRAY_FOREACH is a Cocos2d macro supercharged for fast array access. I could have used the Objective-C version of a fast numerator but I like to use as much of Cocos2d as I can. That way when I port my game to <a href="http://www.cocos2d-x.org/">Cocos2d-x</a> (C++ cross-platform version) it will be less work <img src='http://www.pavley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>One of the biggest optimizations I did was to upgrade from Cocos2d 0.99.5-rc1 to 1.0.0-rc. You have to be smart about when you upgrade to a new version of a framework. I don&#8217;t agree with the idea of living on the bleeding edge&#8211;stability of the platform allows me to focus on my own bugs!</p>
<p>Upgrading from Xcode 3 to Xcode 4 also seemed to help, or at least not hurt, performance. The new version of Cocos2d seems to work better with Xcode 4. I&#8217;m still getting used to the shiny new Xcode&#8211;it acts weird and slow on my Mac Mini.</p>
<p>To make framework and Xcode upgrades easy I put very little code into my app delegate class. All I have to do is to comment out&#8230;</p>
<pre class="brush: c++">//[[CCDirector sharedDirector] runWithScene: [HelloWorldLayer scene]];</pre>
<p>and replace it with&#8230;</p>
<pre class="brush: c++">[[CCDirector sharedDirector] runWithScene: [HomeScreen scene]];</pre>
<p>There are lots more optimization I can do if my performance isn&#8217;t where I want it to be: Unroll my loops and get rid of Character lists altogether. But I&#8217;ll lose a lot of abstraction and flexibility so I&#8217;m not going to optimize anything more unless my beta testers complain!</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pavley.com/2011/04/09/cocos2d-tip3-making-your-iphone-game-fast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cocos2d Tip #2: Using CCTimer in Your iPhone Game</title>
		<link>http://www.pavley.com/2011/03/25/using-cocos2ds-cctimer-in-your-iphone-game/</link>
		<comments>http://www.pavley.com/2011/03/25/using-cocos2ds-cctimer-in-your-iphone-game/#comments</comments>
		<pubDate>Fri, 25 Mar 2011 10:02:18 +0000</pubDate>
		<dc:creator>pav</dc:creator>
				<category><![CDATA[Cocos2d-iPhone]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Game Development]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Sprite]]></category>

		<guid isPermaLink="false">http://www.pavley.com/?p=291</guid>
		<description><![CDATA[If you&#8217;re writing almost any type of game, from a puzzler to a FPS to an RTS, tracking time is critical element of the game play. (Except for Angry Birds. You can ponder an Angry Birds level until your iPhone battery runs dry without penalty.) Cocos2d-iPhone provides several means for tracking time in your game [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re writing almost any type of game, from a puzzler to a FPS to an RTS, tracking time is critical element of the game play. (Except for Angry Birds. You can ponder an Angry Birds level until your iPhone battery runs dry without penalty.)</p>
<p>Cocos2d-iPhone provides several means for tracking time in your game and scheduling methods to be called at both regular heartbeats and at arbitrary points in the future. The easiest way to manage time in a Cocos2d-based game is to use a CCLayer&#8217;s <em>scheduleUpdate</em> or <em>schedule</em> methods. Both methods are explained nicely in the <a href="http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:best_practices#timers">timers</a> section of the <em>Cococ2d Best Practices </em>guide. The guide also explains why you should try to avoid using iOS&#8217;s NSTimer class. (Your game will miss out on automatic pause and resume if do use NSTimer.)</p>
<p>But what if you can&#8217;t use scheduleUpdate or schedule in your game because you&#8217;re putting your game logic into a custom class instead of a CCLayer or CCSprite?</p>
<p>For the sake of simplicity and portability I don&#8217;t subclass CCSprite in my games. Instead, I create custom classes to represent my game objects and call update:(ccTime)delta on them from CCLayer objects to make stuff happen. I needed a nice timer class and started to write my own. About halfway though this project I ran into Cocos2d&#8217;s CCTimer. Since I&#8217;m trying to write as little code as possible I abandoned my timer. CCTimer is a nicely written, lightweight timer class that uses NSInvoker to create callbacks and still integrates will with the rest of the Cocos2d-iPhone framework.</p>
<p>Here&#8217;s how it use it&#8230;</p>
<p>First, I store a reference to a timer in my non-Cocos2d class:</p>
<pre class="brush: c++">
// Zombie.h
#import "cocos2d.h"
@interface Zombie : NSObject {
    BOOL _resurrectable;
    ccTime _resurrectionCountdown;
    CCTimer* _resurrectionTimer; // own
    float _rebirthPenalityPercent;
}
@property (readwrite, nonatomic, assign) BOOL resurrectable;
@property (readwrite, nonatomic, assign) ccTime resurrectionCountdown;
@property (readwrite, nonatomic, retain) CCTimer* resurrectionTimer; // own
@property (readwrite, nonatomic, assign) float rebirthPenalityPercent;
- (void) startResurrectionTimer;
- (void) stopResurrectionTimer;
@end
</pre>
<pre class="brush: c++">
// Zombie.m
#import Zombie.h
@implementation Zombie
@synthesize resurrectable = _resurrectable;
@synthesize resurrectionCountdown = _resurrectionCountdown;
@synthesize resurrectionTimer = _resurrectionTimer;
@synthesize rebirthPenalityPercent = _rebirthPenalityPercent;
+ (id) getInstance {
    CCLOG(@"%@: %@", NSStringFromSelector(_cmd), self);
    return [[[self alloc] init] autorelease];
}

- (id) init: {
    CCLOG(@"** %@: %@", NSStringFromSelector(_cmd), self);
    if ((self = [super init])) {
        self.resurrectable = YES;
        self.resurrectionCountdown = 30.0f; // half a second
        self.resurrectionTimer = nil;
        self.rebirthPenalityPercent = 0.10f; // 10% less health
    }
}
@end
</pre>
<p>Second, I define a call back method to stop the timer:</p>
<pre class="brush: c++">
// later on in Zombie.m
- (void) stopResurrectionTimer {
    CCLOG(@"%@: %@", NSStringFromSelector(_cmd), self);
    if (self.resurrectionTimer != nil) {
    // the only way stop a timer is to deallocate it
        [_resurrectionTimer release];
        _resurrectionTimer = nil;
    }
    // do stuff when the zombie dies...
}
</pre>
<p>Third, I define a method to start the timer:</p>
<pre class="brush: c++">
- (void) startResurrectionTimer {
    CCLOG(@"%@: %@", NSStringFromSelector(_cmd), self);
    if (self.resurrectionTimer != nil) {
         // if there is an old resurrectionTimer then deallocate it
         // (this is the only way to stop a timer)
        [_resurrectionTimer release];
        _resurrectionTimer = nil;
    }
    //  allocate a new timer with a built-in factory method
    // the stopResurrectionTimer method is called when
    // the time is up!
    self.resurrectionTimer = [CCTimer timerWithTarget:self
                                             selector:@selector(stopResurrectionTimer)
                                             interval:self.resurrectionCountdown];
}
</pre>
<p>Fourth, I add a call to update the timer in my CCLayer&#8217;s update method:</p>
<pre class="brush: c++">
// ZombieGameLayer.m
- (void) update:(ccTime)delta {
    [self.zombie.ressurrectionTimer update:delta];
}
</pre>
<p>Finally, Somewhere deep in my game logic I start the timer at the right dramatic moment.</p>
<pre class="brush: c++">
// somewhere else in Zombie.m
- (void) die {
    // call when killed
     CCLOG(@"%@: %@", NSStringFromSelector(_cmd), self);

    // if resurrectable start resurrectionTimer
    if (self.resurrectable) {
        [self startResurrectionTimer];
    }
}
</pre>
<p>It&#8217;s important to note that at the time of this blogging, the CCTimer documentation claims the interval value used to determine the length is in seconds, but really it&#8217;s in milliseconds (that is 1/60 of a second). If want your timer&#8217;s call back to run in 2 minutes set the CCTimer interval to 160.0f.</p>
<p>It&#8217;s also important to note that CCTimer is independent of frame rate: This might be obvious but sometime you want to execute an action every frame an sometime you want to execute it every few milliseconds.</p>
<p>If things aren&#8217;t working make sure you&#8217;ve told your layer to schedule updates in it&#8217;s init method and make sure you are updating your timers from your layer <img src='http://www.pavley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pavley.com/2011/03/25/using-cocos2ds-cctimer-in-your-iphone-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android SDK Compatibility with Eclipse and JDK</title>
		<link>http://www.pavley.com/2010/08/08/android-sdk-compatibility-with-eclipse-and-jdk/</link>
		<comments>http://www.pavley.com/2010/08/08/android-sdk-compatibility-with-eclipse-and-jdk/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 15:13:38 +0000</pubDate>
		<dc:creator>pav</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tech Trends]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.pavley.com/?p=255</guid>
		<description><![CDATA[I recently switched my development workstation from a MacBook Pro to a Windows desktop PC. Yeah, I know, I&#8217;m going against the trends but it&#8217;s a sweet machine I assembled myself based on recommendations from Ash. Immediately I ran into compatibility problems with Google&#8217;s Android SDK and the current versions of Eclipse (Helios) and the Java Developer [...]]]></description>
			<content:encoded><![CDATA[<p>I recently switched my development workstation from a MacBook Pro to a Windows desktop PC. Yeah, I know, I&#8217;m going against the trends but it&#8217;s a sweet machine I assembled myself based on recommendations from Ash.</p>
<p>Immediately I ran into compatibility problems with Google&#8217;s <a href=" If you develop on Mac OS X or Linux, you do not need a special driver to debug your application on an Android-powered device.">Android SDK</a> and the current versions of <a href="http://www.eclipse.org/">Eclipse </a>(Helios) and the <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">Java Developer Kit</a> (JDK Version 6). In a nutshell Google&#8217;s cool Android dev tools don&#8217;t work with Helios&#8211;you need to install Eclipse 3.5 (Galileo). Galileo require&#8217;s JDK Version 5. All this info is prominently featured on the Android <a href="http://developer.android.com/sdk/requirements.html">system reqs</a> page&#8211;but <a href="http://www.wired.com/gadgetlab/2008/01/steve-jobs-peop/">who reads any more</a>?</p>
<p>Digging up old versions of Eclipse is easy. You can find <a href="http://www.eclipse.org/downloads/packages/release/galileo/sr2">Galileo here</a>.</p>
<p>Digging up old versions of the JDK is a bureaucratic nightmare. You can find <a href="http://www.oracle.com/technetwork/java/javase/downloads/index-jdk5-jsp-142662.html">JDK Version 5 here</a> but to install it you have to fill out a form, give away PII, and then wait for an email.</p>
<p>One way around Sun Oracle&#8217;s walled garden is to install <a href="http://download.openoffice.org/">Open Office 3.2.1</a> which installs Java 1.6 (JDK Version 6) in such away that everything compiles.</p>
<p>Now that Google is <a href="http://www.ditii.com/2010/06/01/google-switching-over-to-mac-os-x-and-linux-os-on-windows-security-issues/">throwing away</a> all their Windows PC&#8217;s I&#8217;m sure this compatibility nonsense will get even worse. Here is a note from Google about <a href="http://developer.android.com/sdk/installing.html">enabling debugging</a> of Android Phones:</p>
<blockquote><p>If you develop on Mac OS X or Linux, you do not need a special driver to debug your application on an Android-powered device.</p></blockquote>
<p>Damn it! I might have to go back to coding on the Mac and only using my PC for trival tasks like gaming and web browsing. Ironic huh?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pavley.com/2010/08/08/android-sdk-compatibility-with-eclipse-and-jdk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Volunteer Scrum Master Handbook</title>
		<link>http://www.pavley.com/2010/04/30/volunteer-scrum-master-handbook/</link>
		<comments>http://www.pavley.com/2010/04/30/volunteer-scrum-master-handbook/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 22:01:43 +0000</pubDate>
		<dc:creator>pav</dc:creator>
				<category><![CDATA[Agile Principles]]></category>
		<category><![CDATA[Management & Leadership]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[project management]]></category>
		<category><![CDATA[Scrum]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.pavley.com/?p=234</guid>
		<description><![CDATA[I have to disclose upfront that I am more of an Agile guy than a Scrum guy. Which is to say I feel more at home discussing Agile in general than Scrum in particular. (I&#8217;m not even sure how to capitalize it&#8211;SCRUM or scrum?) Over the years I&#8217;ve made my peace with Scrum and as [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-235" title="Scrum Masters Handbook" src="http://www.pavley.com/wp-content/uploads/2010/04/scrum-masters-handbook.png" alt="Scrum Masters Handbook" width="363" height="303" /></p>
<p>I have to disclose upfront that I am more of an Agile guy than a Scrum guy. Which is to say I feel more at home discussing Agile in general than Scrum in particular. (I&#8217;m not even sure how to capitalize it&#8211;SCRUM or scrum?)</p>
<p>Over the years I&#8217;ve made my peace with Scrum and as I dig into it&#8217;s theory and history I find I have few real arguments with the brainchild of Schwaber and Sutherland. My arguments are not with Scrum but with Professional Scrum Masters.</p>
<p>Over past 19 years that Agile/Scrum have reshaped the process of software development many of the traditional roles of software engineering have drastically changed or simply gone away. Technical Writers, Business Analysts, and non-coding Development Managers aren&#8217;t needed much by self-organizing teams that talk directly to Product Owners and write up their backlogs on sticky notes. But the one big role that Agile/Scrum has made obsolete is the hard nosed, battle tested, two fisted, lock jawed, steely eyed, organization shaking, cat herding Project Manager.</p>
<p>Back in the day it was the Project Manager who got things done. The good engineers were taught to be sheep and good senior managers were turned into putty by the power of the Project Manager. Microsoft&#8217;s variety of Project Manager, the TPM, is still a legend in the industry. It was Windows Vista epic failure and not Agile/Scrum that finally dethroned the TPM.</p>
<p>So when an organization finally buys in to Agile/Scrum where do the people who filled the roles of the waterfall process go? Product Managers became Product Owners. Development Managers who could code became team members or even team leads. Spec writers and Business Analysts moved on. Often Project Manager became Scrum Masters&#8211;If the non-coding Dev Managers didn&#8217;t beat them to it first.</p>
<p>It is where I got my first bad taste of Scrum: Project Managers turned Scrum Masters who were still doing Project Management. These pseudo-Scrum Masters were the ones with the Microsoft Project plans detailing every sprint from here to release. They demanded status explained in non-technical terms during the daily standup. They stuffed the sprint backlog too tightly (or sandbagged it) and argued with Product Owners over priority. What a mess! It was all Bagile and Fragile.</p>
<p>At least with the non-coding Dev Managers who become Scrum Masters the social graces were respected and they generally stayed out of the way (lest a technical question come their way).</p>
<p>To combat the pseudo-Scrum Master I like to use the role of the Volunteer Scrum Master (VSM). This is just one of the team members (either a coder or a tester) who plays the role of part time Scrum Master. It&#8217;s a volunteer and rotating position which can be filled by anybody but the Product Owner. Most of the time the VSM writes code or tests. When the need arises the VSM laces up his boots and does Scrum Master things: Calls for help to scare away any chickens, reminds everyone to follow the process, and let&#8217;s me or the full time Scrum Master know that those servers need to be updated by Ops. The VMS removes impediments to the success of the sprint by communication not coercion.</p>
<p>It&#8217;s not a glamourous job. There&#8217;s no extra pay. There is no authority. You don&#8217;t get to wear a uniform or the keys to the executive washroom.</p>
<p>While the job of a VSM is simple and straight forward it can be hard for a new recruit to know where the Scrum Master job starts and ends. So I ask each VSM to think of his part time job as a journalistic one. Observe what is going in the scrum. Take notes. Report findings to the full time Scrum Master or one of the Engineering Directors.</p>
<p><em>Note: Team members should be responsible for managing themselves. A Scrum Master is not Mom or Dad or a Police Officer. The best way to remove impediments is to communicate them to someone who can address them.</em></p>
<p>Let&#8217;s review how the VCM fits into the role of the Scrum Master&#8230;</p>
<table border="0">
<tbody>
<tr>
<td><strong>Responsibility</strong></td>
<td><strong>Pro Scrum Master</strong></td>
<td><strong>Volunteer Scrum Master</strong></td>
</tr>
<tr>
<td><em>The Scrum Master is not the leader of the team</em></td>
<td>In Theory</td>
<td>Yes</td>
</tr>
<tr>
<td><em>The Scrum Master teaches the process</em></td>
<td>Yes</td>
<td>Has to learn it first</td>
</tr>
<tr>
<td><em>The Scrum Master has no authority and may not make commitments</em></td>
<td>That&#8217;s idea but&#8230;</td>
<td>Definitely yes</td>
</tr>
<tr>
<td><em>The Scrum Master surrenders control to the Product Owner</em></td>
<td>Hopefully</td>
<td>100% Yes</td>
</tr>
<tr>
<td><em>The Scrum Master is an enforcer of rules</em></td>
<td>Sure</td>
<td>Nope</td>
</tr>
<tr>
<td><em>The Scrum Master sets up the meetings</em></td>
<td>If she has time</td>
<td>Nah, set up your own meetings!</td>
</tr>
<tr>
<td><em>The Scrum Master maintains the backlog and updates the Scrum board</em></td>
<td>Busy work</td>
<td>All team members should pitch in</td>
</tr>
<tr>
<td><em>The Scrum Master explains to management what the team is doing</em></td>
<td>Bad idea (It&#8217;s the Product Owner&#8217;s Job!)</td>
<td>Wouldn&#8217;t bother</td>
</tr>
<tr>
<td><em>The Scrum Master acts as a buffer</em></td>
<td>When there is no other option</td>
<td>Dials 911</td>
</tr>
</tbody>
</table>
<p>As you can see the Pro Scrum Master has to be careful. As the Scrum canon defines her job there is some inherent contradiction with the job of Product Owner and even some chicken-like (i.e., management) responsibilities. The VMS has no such ambiguities. He&#8217;s just passing through&#8211;his sense of self-worth isn&#8217;t caught up with the role.</p>
<p>Using VSM enables an organization to limit the number of Pro Scrum Masters, minimize political struggle, and help the team members learn the game of Scrum (the best way to learn is to volunteer).</p>
<h5>Here are some sources that help define a Scrum Master&#8217;s Role:</h5>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Scrum_(development)#Roles"><span><span style="color: #000000;"><span style="text-decoration: none;">http://en.wikipedia.org/wiki/Scrum_(development)#Roles</span></span></span></a></li>
<li><a href="http://www.scrumalliance.org/articles/82-scrum-turtles"><span><span style="color: #000000;"><span style="text-decoration: none;">http://www.scrumalliance.org/articles/82-scrum-turtles</span></span></span></a></li>
<li><a href="http://www.scrumalliance.org/articles/52-empowering-teams-the-scrummasters-role"><span><span style="color: #000000;"><span style="text-decoration: none;">http://www.scrumalliance.org/articles/52-empowering-teams-the-scrummasters-role</span></span></span></a></li>
<li><a href="http://scrummethodology.com/the-scrummaster-role/"><span><span style="color: #000000;"><span style="text-decoration: none;">http://scrummethodology.com/the-scrummaster-role/</span></span></span></a></li>
<li><span style="color: #000000;"><span style="text-decoration: none;"><a href="http://stackoverflow.com/questions/127807/what-does-a-scrum-master-do-all-day">http://stackoverflow.com/questions/127807/what-does-a-scrum-master-do-all-day</a></span></span></li>
<li><a href="http://www.scrum.org/scrumguides/">http://www.scrum.org/scrumguides/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.pavley.com/2010/04/30/volunteer-scrum-master-handbook/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Agile Fables</title>
		<link>http://www.pavley.com/2010/04/28/agile-fables/</link>
		<comments>http://www.pavley.com/2010/04/28/agile-fables/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 22:30:04 +0000</pubDate>
		<dc:creator>pav</dc:creator>
				<category><![CDATA[Agile Principles]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[project management]]></category>
		<category><![CDATA[Scrum]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.pavley.com/?p=223</guid>
		<description><![CDATA[I love a good fable. The kind that Aesop used to write with animals acting out human morality tales. Of course, if you do the research, you quickly find out that Aesop didn&#8217;t write most (if any of the fables) we ascribe to him and like Shakespeare he probably never existed. I don&#8217;t let reality [...]]]></description>
			<content:encoded><![CDATA[<p style="font: normal normal normal 12px/normal Helvetica; text-align: center; margin: 0px;">
<p><img class="aligncenter size-full wp-image-230" title="Aesop_woodcut_Spain_1489" src="http://www.pavley.com/wp-content/uploads/2010/04/Aesop_woodcut_Spain_1489.jpg" alt="Aesop_woodcut_Spain_1489" width="490" height="450" /></p>
<p>I love a good fable. The kind that <a href="http://en.wikipedia.org/wiki/Aesop">Aesop</a> used to write with animals acting out human morality tales. Of course, if you do the research, you quickly find out that Aesop didn&#8217;t write most (if any of the fables) we ascribe to him and like Shakespeare he probably never existed. I don&#8217;t let reality like that spoil my appreciation for Aesop&#8217;s work.</p>
<p>For Scrum Masters, Project Managers, and fans of <a href="http://www.davidco.com/what_is_gtd.php">Getting Things Done</a> there is nothing like the fable of the <a href="http://childhoodreading.com/Arthur_Rackham/Tortoise_and_the_Hare.html">Tortoise and the Hare</a>. The slower, but diligent tortoise wins the race over the quicker, but arrogant hare. The only problem Agile process lovers have with this fable is that it&#8217;s not true! The tortoise (Waterfall) always loses to the Hare (Agile).</p>
<p>But we have a paradox: Most chickens (managers, stakeholders, investors) and even some pigs (engineers) agree with Aesop! The tortoise always beats the hare because the tortoise makes a plan and executes it well, even if he is a bit slow. (If the tortoise fails it&#8217;s because a chicken yells at her to hurry up and so she speeds up and screws up. Call it the &#8220;Fable of the Spineless Tortoise and Impatient Chicken.&#8221;)</p>
<p>To resolve this paradox I&#8217;d like to tell the &#8220;Fable of the Tortoise, Hare, and Monkey.&#8221;</p>
<blockquote><p><em>A Hare one day ridiculed the <a href="http://office.microsoft.com/en-gb/project/default.aspx">Microsoft Project</a></em><em> plans and change control documents of the Tortoise. The latter, laughing, said: &#8220;Though you be swift as <a href="http://golang.org/">Google Go</a></em><em>, I will beat you in a race to deliver working software.&#8221; The Hare, deeming her assertion to be simply impossible, assented to the proposal; and they agreed that the Fox (VP of Product Management) should choose the requirements, and define the release. On the day appointed for the race they started together. The Tortoise never for a moment stopped, but went on with a slow but steady build cycle straight to the end of the course. The Hare, trusting to his native widgets, cared little about unit testing and user feedback, and lying down under his desk after long night of coding, fell fast asleep. At last waking up, and logging on as fast as he could, he saw the Tortoise had reached the goal, and was demoing to the Fox.</em></p></blockquote>
<p>But the story doesn&#8217;t end yet&#8230;</p>
<blockquote><p><em>By the time the Hare caught up with the Tortoise and the Fox he saw the Tortoise slam her laptop shut and slump away. The Hare asked for an explanation. &#8220;Why didn&#8217;t he Tortoise win?&#8221; The Fox explained that what the Tortoise delivered was very late to market and the requirements were were out of date. &#8220;But,&#8221; the Fox said, &#8220;Happily for all, the Monkey has delivered working working software that meets most of our customer&#8217;s high priority needs!&#8221;</em></p>
<p><em>&#8220;Monkey? Where the hell did the Monkey come from?&#8221; Exclaimed Hare.</em></p>
<p><em>&#8220;Ah yes,&#8221; sighed the Fox, &#8220;While you were crashed out under your desk, the Monkey came and delivered a working prototype. I told her that it wasn&#8217;t quite right so the Monkey went away and came back a little while later with a revised prototype. It took a few tries but eventually the Monkey got it right and won the race. In fact the Monkey&#8217;s working prototypes helped me understand what I was asking for. You see when I gave the requirements to you and the Tortoise, there were a few stories I missed and during the race a new competitor entered the market. Even if you hadn&#8217;t fallen asleep you would not have won as I had to keep moving the goal. Our customer, Mr. <a href="http://plato.stanford.edu/entries/paradox-zeno/">Zeno</a></em><em>, is a hard man to please!</em></p></blockquote>
<p>Just in case you&#8217;re not into reading between the lines here&#8217;s my analysis of this fable (since I wrote it my analysis should hopefully be accurate).</p>
<p>The Hare lost the race because he had to fight the <a href="http://en.wikipedia.org/wiki/Law_of_the_handicap_of_a_head_start">Law of the Handicap of a Head Start</a>. This principle states that pioneers and innovators lack a clear signal. They are out in front, they have no one to follow, and so their advantage becomes a handicap. Often the first movers are stuck building their software on immature technology that becomes obsolete before it is finished. The United States has this problem with its <a href="http://technology.globalthoughtz.com/index.php/internet-infrastructure-in-the-first-and-second-worlds/">Internet and telecommunications infrastructure</a>. We got there first but now we are lagging in connectivity. The Hare development process, starts out fast and light but never stops to get feedback&#8211;its one big long sprint. A lot of code is written. Little of it is ever used.</p>
<p>The Tortoise lost the race because we no longer live in the world of the 4th century BC. Slow and steady hasn&#8217;t been a winning strategy for a long time. The goal keeps moving. Actually the ancient Greek philosopher Zeno wrote his own fable where he counters Aesop. In <a href="http://www.mathacademy.com/pr/prime/articles/zeno_tort/index.asp">Achilles and the Tortoise</a>, the Hare-like Achilles can&#8217;t catch up to the Tortoise (who has been given a head start) because every time Achilles reaches the spot where the Tortoise was, the Tortoise has moved on. This is the problem of accomplishing an <a href="http://en.wikipedia.org/wiki/Supertask">infinite number of tasks</a> in a finite amount of time. Somehow we do it every day (but if you really think about it your brain hurts). The Tortoise development process, creates <a href="http://www.threeriversinstitute.org/Testing%20Dichotomies%20and%20TDD.htm">dichotomies</a> every step of the way: Design, Development, Test, Release, Post Release, et etc. Dichotomies are full of <a href="http://en.wikipedia.org/wiki/Infinite_regress">infinite regressions</a> and thus are never finished.</p>
<p>The Monkey won the race because he used an Agile development process. First the Monkey took a prioritized subset of from the list of infinite tasks (and every project has a never ending number of bugs and feature requests) and delivered them to the Fox (Product owner) as working software. It was was rough but the Fox had the results in plenty of time to give feedback and course corrections. Thus the Monkey was not subject to the Law of the Handicap of a Head Start. Second the Monkey kept repeating these short sprints of implementing the high priority tasks and getting feedback on a real working system so that as the goal moved she could quickly change course. The Monkey development process, done right, treats every sprint as a whole, where no dichotomies are created. The software is released to the user, it does what it does, feedback is gathered, and the process is repeated until a winner is declared.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pavley.com/2010/04/28/agile-fables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Managing the De-Motivated</title>
		<link>http://www.pavley.com/2010/04/18/managing-the-de-motivated/</link>
		<comments>http://www.pavley.com/2010/04/18/managing-the-de-motivated/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 18:13:23 +0000</pubDate>
		<dc:creator>pav</dc:creator>
				<category><![CDATA[Agile Principles]]></category>
		<category><![CDATA[Management & Leadership]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[change]]></category>
		<category><![CDATA[project management]]></category>
		<category><![CDATA[R&D]]></category>
		<category><![CDATA[Scrum]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.pavley.com/?p=207</guid>
		<description><![CDATA[It still amazes me how a process created by engineers for engineers can make so many engineers so unhappy. I’ve seen all kinds of responses to Agile from engineers. Some are immediately enthusiastic. Others are cautiously optimistic. Many are amused and cynical. And some are down right hostile. Over time the responses polarize and the [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-208" title="cute-sad-kitten" src="http://www.pavley.com/wp-content/uploads/2010/04/cute-sad-kitten02.jpg" alt="cute-sad-kitten" width="400" height="347" /></p>
<p>It still amazes me how a process created by engineers for engineers can make so many engineers so unhappy.</p>
<p>I’ve seen all kinds of responses to Agile from engineers. Some are immediately enthusiastic. Others are cautiously optimistic. Many are amused and cynical. And some are down right hostile. Over time the responses polarize and the body of engineers undergoing an Agile process split into two camps: Those for whom Agile is working and those for whom it isn’t.</p>
<p>I’d like to point out that I’m not talking about Fragile (Waterfall Agile) or Badgile (just a plain bad Agile implementation). Fragile and Badgile don’t work for anyone, not the Agile fanboys nor the management types that mistakenly create these processes. (If your boss says, “Agile yes, but we must have controls!” then you’re headed down the road to sadness.)</p>
<p>Unfortunately in my experience there are really good engineers out there for whom Agile in all its <a href="http://www.versionone.com/Agile101/Methodologies.asp">manifestations</a>, from Scrum to XP, just doesn’t work. I’ve done a fair amount of work to figure out why and what to do about it. I’m going to use Scrum in my examples but this isn’t a problem of flavor. However you enact the <a href="http://agilemanifesto.org/principles.html">principles</a> the problems are the same for this segment of the engineering population. Also note this isn’t a generational thing. Agile-challenged engineers come in all shapes, sizes, sexes, IQs, and ages.</p>
<p><em>The top four reasons why Agile doesn’t work for some engineers:</em></p>
<ol>
<li><strong>You have to like to talk to people.</strong> Engineering as a profession self-selects for people who find human-machine interactions more interesting then human-human or human-animal interactions. People who like to talk to people become salesmen or lawyers not programmers. But for some <a href="http://weknowengineers.blogspot.com/2008/05/strong-silent-type.html">engineers</a> human-human interaction is down right painful. If you are not into <a href="http://www.agilemodeling.com/essays/communication.htm">face-to-face communication</a> Agile is not for you.</li>
<li><strong>You have to need and accept help.</strong> I love to remind people that intelligence is a side effect of evolution not its goal. (The gold of evolution, if there is one, to enable a species to adapt to a changing environment. <a href="http://www.physorg.com/news83410847.html">Intelligence</a> is just one experiment in adaptation and probably not the most successful one since it’s only worked for one species.) I’ve found that some really intelligent engineers are so smart that it’s difficult for them to accept help (like a prioritized backlog or a bug report) from people they view as obviously less intelligent. You can call this arrogance but then would Mozart have accepted help on his symphonies?</li>
<li><strong>You have to embrace change.</strong> Many people from all walks of life have difficulty handling change—rapid or slow. They just don’t like the idea that the world they have finally gotten used to and mastered no longer exists. Some of these <a href="http://www.similarminds.com/types/changeaverse.html">change-adverse people</a> happen to be engineers. You can spot them easily. They are programming in languages and paradigms that are no longer on the leading edge. I often have to say to them: Yes, you can still write <a href="http://seekingalpha.com/article/194128-microsoft-in-danger-if-office-margins-fall-to-google-app-levels">desktop applications</a> but nobody under 40 is going to care.</li>
<li><strong>You have to like focusing and working on a schedule.</strong> Whether your sprint in two weeks or two months isn’t important. What is important is that you stick to it—even it means, and it usually does, modifying your work to fit the time window. For the Agile-challenged engineer this is a blasphemy akin to chopping eight inches off the left side of the Mona Lisa. They see their software as a whole that isn’t finished until it is finished. Scrum’s timing boxing technique is admittedly arbitrary. The <a href="http://mises.org/daily/3461">creative process</a> cannot be bounded by deadlines without losing its integrity. At least that’s their argument. I see it differently, and can give lots of <a href="http://claudsy.wordpress.com/2010/01/09/deadlines-necessary-to-the-creative-process/">contrary arguments</a>, but rational argument has little impact on personal preferences. These engineers find sprinting to be stressful where the Agile-friendly engineer finds sprinting to be liberating.</li>
</ol>
<p>At the end of the day it’s a waste of time to force people to do something they simply don’t want to do. Unenthusiastic people need to find something they are truly enthusiastic about. There is nothing wrong with the Agile-challenged. They are master craftsmen, they are very smart, they are mavens, and they are artists. So what is an Agile organization to do with them?</p>
<p>The first thing to do is get them out of Agile. These engineers are wasted on Scrum and will simply quit and make a lot of other miserable on their way out. Smart unhappy people can make a lot of mischief!</p>
<p>The second thing to do is to create a lab, give them a mission, and turn them lose. It’s interesting to note that many of famous labs in the history of computation have been notoriously bad at implementing and productizing their creations. Xerox Parc invented most of what we use when we use <a href="http://www.nundroo.com/lisadesk.gif">personal computers</a> yet it is in decline. It’s too bad that Xerox Parc didn’t merge with Apple or Microsoft, organizations that are good at creating markets and feeding them incremental improvements. Instead Apple and <a href="http://research.microsoft.com/en-us/">Microsoft</a> developed R&amp;D labs of their own so that they have a never-ending fountain of new ideas and home for their dreamers.</p>
<p>You can’t and shouldn&#8217;t manage the lab with Agile techniques and you must not staff it with Agile-friendly engineers. The engineers who thrive under Agile get lost in lab, their ideas can’t compete with the Leonardos and Michelangelos.</p>
<p>In the end the secret to managing the de-motivated is finding a place for them in the organization where they are motivated to be. Agile is great but it cannot be applied to all problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pavley.com/2010/04/18/managing-the-de-motivated/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

