<feed xmlns="http://www.w3.org/2005/Atom">
  <div xmlns="http://www.w3.org/1999/xhtml" class="info">
         This is an Atom formatted XML site feed.
         It is intended to be viewed in a Newsreader or syndicated to another site.
         Please visit <a href="http://www.atomenabled.org/">atomenabled.org</a> for more info.
  </div>
  <title>Blogging Pubbitch</title>
  <link href="http://www.pubbitch.org/blog/index.atom" rel="self"/>
  <link href="http://www.pubbitch.org/blog/index.html" rel="alternate" type="text/html"/>
  <id>http://www.pubbitch.org/blog/tech.atom</id>
  <updated>2010-03-13T09:47:21+00:00</updated>
  <author>
    <name>Simon Stewart</name>
  </author>
  <entry>
    <id>tag:pubbitch.org,2009:entry,123849956188644</id>
    <title>Reviving Agiledox</title>
    <link href="http://www.pubbitch.org/blog/2009/03/31/reviving_agiledox" rel="alternate"/>
    <updated>2009-03-31T11:39:21Z</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
<p>In a galaxy far, far away there was a tool that I really liked, but never pushed into my builds. Nevertheless, it changed the way that I thought about code, and how I thought about my tests.
</p><p>
That tool? <a href="http://agiledox.sourceforge.net/">Agiledox</a>.
</p><p>
The idea is simple: a class under test ("Foo") is normally tested in a class that's named after the class under test ("FooTest"). If the test names reflect roles and responsibilities, we can automatically generate documentation. The way to do this is to take the test names, strip the word "test" from them and un-camelcase the names. That is:
</p><p>
<pre>
public class FooTest extends TestCase {
  public void testShouldDoThis() {}
  public void testShouldDoThat() {}
  public void testOnTuesdayShouldMeltdown() {}
}
</pre>
</p><p>
becomes:
</p><p>
<b>Foo</b>
<ul>
<li>Should do this</li>
<li>Should do that</li>
<li>On tuesday should Mmeltdown</li>
</ul>
</p><p>
Now, the twist is that there's something missing here: an explanation as to why the Foo class was written in the first case. The class under test sometimes contains a meaningful top-level javadoc. It makes sense to drag that in too. 
</p><p>
Voila! Documentation!
</p><p>
Docs on their own are pretty meaningless, but I like the fact that this is a handy way to drive a conversation about OO design, testability and code quality.</p>      </div>
    </content>
  </entry>
  <entry>
    <id>tag:pubbitch.org,2009:entry,12377528833638</id>
    <title>Leave This Place Alone for Three Minutes</title>
    <link href="http://www.pubbitch.org/blog/2009/03/22/leave_this_place_alone_for_three_minutes" rel="alternate"/>
    <updated>2009-03-22T20:14:43Z</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
<p>Well, it's been seven days, and I'm now back from holiday and plugged into the Net again. Looks like it was a big week: <a href="http://blogs.msdn.com/ie/archive/2009/03/19/internet-explorer-8-final-available-now.aspx">IE 8</a> was released, as was <a href="http://google-latlong.blogspot.com/2009/03/street-view-cures-homesick-blues.html">Street View in the UK</a> (finally!), <a href="http://news.yahoo.com/s/nm/20090320/bs_nm/us_sunmicro_ibm1">IBM is in talks to buy Sun</a> (for Java and the consultancy revenue it generates, presumably?) and <a href="http://www.scifi.com/battlestar/">Battlestar Galactica</a> comes to an end (though it's still not available on itunes yet, so no spoilers please!)
</p><p>
Perhaps I should take some time out more frequently?</p>      </div>
    </content>
  </entry>
  <entry>
    <id>tag:pubbitch.org,2009:entry,123400940180418</id>
    <title>Portakabins</title>
    <link href="http://www.pubbitch.org/blog/2009/02/07/portakabins" rel="alternate"/>
    <updated>2009-03-12T01:39:12Z</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
<p>Portakabins are wonderful things. Temporary buildings that are designed to fill a certain need, but only for a well defined period. They are also terrible things: they're &quot;<a href="http://www.artima.com/intv/goodenough.html">good enough</a>&quot; to the point where people sometimes use for far too long, despite the fact that as permanent accommodation a properly designed building is far better.
</p><p>
Of course, there's a software development analogy in here. Teams often throw in a temporary fix to a problem that's &quot;good enough&quot; for now. Life would be a lot more pleasant if the job was done properly, but perhaps the team is bridging to a new architecture, or time pressures mean that as long as &quot;this code-path here&quot; works fine then it's okay.
</p><p>
The problems start when that portakabin is never removed --- who has time to go back and clean up things that are working? Someone comes along, looks at this thing that was created as temporary hack and decides that, actually, yes, that is how code should be written. Oh! The pain of Example Driven Development! Suddenly, what should have been a quick fix turns out to be how things are done. 
</p><p>
Perhaps this explains my visceral dislike of seeing temporary hacks being thrown into a code base; we're just saving up long term pain at the cost of doing something we're not happy with today. Reminds of the saying &quot;Of course a shortcut takes more effort. If it didn't it wouldn't be a shortcut, it would The Way&quot;</p>      </div>
    </content>
  </entry>
  <entry>
    <id>tag:pubbitch.org,2009:entry,12335053870611</id>
    <title>Open Source Libraries: Forking Forever</title>
    <link href="http://www.pubbitch.org/blog/2009/02/01/open_source_libraries_forking_forever" rel="alternate"/>
    <updated>2009-02-01T16:23:07Z</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
<p>You've maintained a temporary fork of a library for a while, but you need to ship your product to external customers, or the developers of the library aren't interested in your fixes, or you're just feel that what you'd like to do most with your precious free time is to maintain a library. 
</p><p>
The only decent thing to do is make the fork permanent.
</p><p>
There's a whole bunch of choices to make here, but they all start with the same action: changing the package name. Unless you're officially taking a project over, this single action means that other teams can make a reasoned choice about migrating from the original version to yours. It also means that as your fork and the original diverge teams don't have to fight about which library they should be using. 
</p><p>
If you're forking so that you can ship a product or project, then changing the package name decouples your project from the forked library's release schedule: you become free to ship with snapshots with your fixes applied. If you're forking because the underlying library has some major issue that's not being properly addressed, you put yourself in a great position to open that project up to other contributors and allow yourself the freedom to change APIs as you see fit. Lovely.
</p><p>
Actually, the case where you're forking to allow your product to be released is an interesting one. It's similar to the case where you want a temporary fork, in that you probably want to continue tracking the current HEAD release so that you can fall back to the original library as soon as possible. In this case, the best thing to do is to automate the package renaming; write a script that does the grunt work of renaming the packages. You can then hook it into the <a href="http://www.pubbitch.org/blog/2009/02/01/open_source_libraries_handling_a_fork">process described in my previous post</a>, meaning that you have the advantages of your own private world with the opportunity to fall back to the original library when necessary.
</p><p>
Which is nice.</p>      </div>
    </content>
  </entry>
  <entry>
    <id>tag:pubbitch.org,2009:entry,123350280032475</id>
    <title>Open Source Libraries: Handling a Fork</title>
    <link href="http://www.pubbitch.org/blog/2009/02/01/open_source_libraries_handling_a_fork" rel="alternate"/>
    <updated>2009-02-01T16:15:55Z</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
<p>So, you've finally run into a situation where you want to upgrade one of your project's dependencies but one of your other dependencies prevents you from doing so. In the ideal world, things would just work seamlessly, and you could just grab the latest version, but sometimes life's just not like that.
</p><p>
Oh well. Time to fork that library!
</p><p>
Before we begin, we have a choice to make: is this a temporary thing, or are we never planning to return from whence we came? It's extremely unlikely that you're actually interested in maintaining your own fork of a library indefinitely, so let's work our way through a temporary parting of the ways. Life is made simpler because there's probably just a few things that are wrong or need changing and we'd be pleased to roll back to the original library once those small issues are fixed. Everything should centre on allowing us to get back to the ideal situation. 
</p><p>
The first step when forking is to write a failing test that exposes the missing functionality. Maybe this test is just "when I new up this object, the constructor throws an exception". Maybe it's "when this method is called, the wrong value is returned" Whatever it is, encapsulate it, because once this test passes with a later version of the original library we're going to drop our fork. Write a test per feature of bug that you're planning on adding or fixing.
</p><p>
Until then, we're going to need the source. Check it out from the project's source repository. If you can't do that, figure out how to get the source. You're going to need it, because the next thing to do is to fix a single failing test. Not all of them. Not five of them in one go. One failing test. Create a patch between the original source and the version that causes your test to pass. Keep that patch under your source control system, next to the library. Now repeat the process for each failing test. This way, there's a patch per feature of bug.
</p><p>
The reason for doing this becomes clear when we upgrade the library. The process becomes:
</p><p>
<ul>
<li>Check out the new version of the library source</li>
<li>Run your tests. Delete the patches associated with any passing tests.</li>
<li>If you have no patches to apply, delete your fork!</li>
<li>Apply your patches, one at a time. Run the associated test until it passes. You may need to "freshen the patch" once you're done.</li>
<li>Rinse and repeat for each failing test</li>
</ul>
</p><p>
Taking a step back, the whole process boils down to three steps:
</p><p>
<ol>
<li>Identify what's wrong</li>
<li>Automate proving that it's wrong.</li>
<li>Fix the problem and maintain the delta.</li>
</ol>
</p><p>
As part of being a "good citizen", and to minimise the amount of time that your forked version of the library exists for, send the failing test and the fix to the project owner. 
</p><p>
But what would we do if we want to ship with a forked library? Or what happens when your differences are too great? That, dear reader, will be what the next post is about....</p>      </div>
    </content>
  </entry>
  <entry>
    <id>tag:pubbitch.org,2009:entry,123316418600203</id>
    <title>Open Source Libraries: What Not to Do</title>
    <link href="http://www.pubbitch.org/blog/2009/01/28/open_source_libraries_what_not_to_do" rel="alternate"/>
    <updated>2009-01-28T17:38:14Z</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
<p>How hard can it be to use an Open Source java library in your project? I mean, all you need to do is drag the JAR on to your CLASSPATH and your done. Oh right, yeah, fine. You need the dependencies too. And the dependencies of any dependencies. And so on. 
</p><p>
But I mean, it's not hard is it?
</p><p>
Certainly not to start with. But then there's a new version of the library that you could use. And it deletes an API you use. Or you're not sure whether it'll work properly. Or it's a bad day to upgrade the entire codebase. Or you have no idea whether something will work or not. So what do you do? What do you do?
</p><p>
Don't do this: have a second copy of the library in your source tree. That's dumb. That's dumb because you're depending on classpath ordering, which may or may not happen consistently. 
</p><p>
Which means that you need to have only one copy in your source tree at any one time. This also means that if you need the latest and greatest feature from a library, you're effectively becoming something like the <a href="http://gump.apache.org/">Apache Gump</a>, and sometimes something's not going to play well with something else. That's when it gets fun. That's what I'll cover tomorrow....</p>      </div>
    </content>
  </entry>
  <entry>
    <id>tag:pubbitch.org,2008:entry,122739786895416</id>
    <title>iPhone 2.2 for the Traveling Man</title>
    <link href="http://www.pubbitch.org/blog/2008/11/22/iphone_22_for_the_traveling_man" rel="alternate"/>
    <updated>2008-11-22T23:51:08Z</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
<p>I think it's fair to say that the <a href="http://www.apple.com/iphone/">iPhone</a> is the best phone I've ever owned, but with the release of the new <a href="http://www.apple.com/iphone/softwareupdate/">2.2 software update</a>, it just got a whole lot better.
</p><p>
I'm away from home right now, and will be for some time, and that means that I've had to make choices about which bits of techy paraphernalia I can bring with me. Unless I'm willing to do myself an injury, I can only really take one laptop on the road with me, and given that I'm here for work, it's the work laptop that came with me. Not, and this is important, my personal laptop.
</p><p>
It's important because I also brought my iPhone with me. Before I left, I synced up as many podcasts as I could, but some of these, especially the news podcasts, go stale pretty quickly. Without being able to connect to my personal laptop, there wasn't a mechanism to download new podcasts, rendering the latter parts of any trip devoid of fresh news.
</p><p>
Aside: I almost said &quot;fresh content&quot;, but felt a little of sick at the back of my mouth, and so have skillfully avoided management-speak once again. Hurrah! Now back to the main thrust of this post. Mentally delete this paragraph and append the next one to the end of the last one, please.
</p><p>
No more! With the 2.2 release, I can download new podcasts, either of the set that are already synced with my iPhone or by using the built-in iTunes app on the phone to pick and download new ones. Sure, it would be nicer if this happened automatically, preferably using the same preferences I have on the desktop version of iTunes, but just having the option of downloading something new is a real boon.
</p><p>
Of course, to get this feature, I need to be able to install the 2.2 software update on my iPhone, and this is where Apple have once again done the Right Thing. Although I can't sync the iPhone with anything other than my personal laptop, I can do a software update on any machine running iTunes. It's not the sort of feature that you need on a regular basis, but when you find out it's there, life becomes a little more easy. Finding out that this capability is present brings me to another feature of the iPhone that I like: the ubiquity of the power lead, and the fact it plugs into the USB socket. It's a little roundabout, so please bear with me.
</p><p>
Back in the day, it was virtually impossible to run out of charge on a Nokia phone. Everyone had one, and because of this, everyone had ready access to the charger. Better still, all the phones used the same size connector. Wonderful. And then Nokia changed the size of the connector, and people started buying other makes of phone. Suddenly, it became a lot easier to run out of charge, and I started to have to bring my Nokia charger with me, along with the adapter so I could use it abroad. And a second adapter for my laptop. Or, as I did on a regular basis, you can juggle the foreign plug adaptor, switching to using it to charge the item with the least power as necessary. 
</p><p>
Frankly, having a Nokia phone had become a major PITA.
</p><p>
The ideal for me is to be able to take one power adapter and to be able to charge everything from that. Ideally at the same time. The iPhone, the model of convergence in action, allows me to carry one device instead of two to meet my music-listening, phone-calling desires. It uses the same cable to charge and connect to the Mac as the iPod always has, and given the ubiquity of the iPod, that means that this particular lead is easy to get hold of. Because it plugs into the USB socket of my laptop (or, indeed, any machine) it's possible to charge that and the lappie from the same adapter. As a quirk, when you plug an iPod into a machine, iTunes often starts up, and will tell you about any new updates that might be present for the shiny piece of Appleness you've just plugged into the <a href="http://en.wikipedia.org/wiki/USB#History">Intel designed port</a>.
</p><p>
I'm sure that there are other goodies to do with the iPhone that make it indispensable --- the mail client, with its ability to access emails even when offline, has saved me a whole host of grief, and my wife and I now no longer bother to know where we're going actually is until well after we leave the house thanks to the combination of GPS, <a href="http://maps.google.com/">Google Maps</a> and access to <a href="http://journeyplanner.tfl.gov.uk">JourneyPlanner</a> --- but the universality of access to the ability to charge the device, coupled with the ability to get new podcasts, means that the iPhone meets all my traveling needs for now.
</p><p>
It would be nice to be able to tether my laptop to its 3G connection sometimes....</p>      </div>
    </content>
  </entry>
  <entry>
    <id>tag:pubbitch.org,2008:entry,122320542984245</id>
    <title>Permanent and Temporal Coupling</title>
    <link href="http://www.pubbitch.org/blog/2008/10/05/permanent_and_temporal_coupling" rel="alternate"/>
    <updated>2008-10-05T11:17:09Z</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
<p>Just a quick post on this, because I find these two concepts useful when talking about dependency injection.
</p><p>
<b>Permanent Coupling</b>: Where you can't imagine the object existing without this dependency. The crass example is &quot;a person has a brain.&quot; These should be injected via an object's constructor and I'd expect to see them appear in the app's config files (Guice, Spring, Picocontainer, whatever)
</p><p>
<b>Temporal Coupling</b>: The dependency is a temporary collaborator of another object, but you can imagine the object being just fine without it. The example would be &quot;a person uses a watch to tell the time&quot; (no puns were injured to bring you this example) I would expect to see these temporary collaborators to be visible as part of a method signature. I humbly submit that injecting these dependencies in the constructor is a mistake.</p>      </div>
    </content>
  </entry>
  <entry>
    <id>tag:pubbitch.org,2008:entry,121742028183019</id>
    <title>Git Rebase</title>
    <link href="http://www.pubbitch.org/blog/2008/07/30/git_rebase" rel="alternate"/>
    <updated>2008-07-30T12:18:01Z</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
<p>It's taken me a little googling to find this out, but when a &quot;git rebase&quot; halts because of a merge conflict, the way to deal with it is by manually editing the file, correcting the merge and then doing either a &quot;git add&quot; or &quot;git rm&quot; of the affected file, followed by &quot;git rebase --continue&quot;
</p><p>
It's all so obvious now.</p>      </div>
    </content>
  </entry>
  <entry>
    <id>tag:pubbitch.org,2008:entry,121343041050253</id>
    <title>Gears on Firefox 3</title>
    <link href="http://www.pubbitch.org/blog/2008/06/14/gears_on_firefox_3" rel="alternate"/>
    <updated>2008-06-14T08:00:10Z</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
<p>I must be late to the party, but <a href="http://gears.googlecode.com/">Gears</a> finally works on Firefox 3, which is a Good Thing considering that <a href="http://www.mozilla.com/en-US/firefox/3.0rc3/releasenotes/">RC3</a> has just been released. Yay! On the downside, <a href="http://reader.google.com">Google Reader</a> isn't showing up properly when I access it offline. Oh well, I'm sure that it'll be fixed soon.
</p><p>
On a related note, I've had the opportunity to delve into the Gears codebase. There's some pretty cool stuff in there, and if it wasn't Open Source it wouldn't have been so easy to use it as a learning tool. It's a pretty hefty amount of code, which makes getting to grips with it a slightly intimidating experience, but it's organised well and once you've started it starts to make more sense. 
</p><p>
I find myself wondering how easy it is to attract new developers to the project: I know that the number of languages used in WebDriver puts some potential contributers off, and we've got far less &quot;mass&quot; to deal with. I'm working on the theory that the modularisation of both projects helps make getting started easier, and once people are involved it becomes less daunting to tackle the areas that seemed too hard to even look at.</p>      </div>
    </content>
  </entry>
</feed>
 
