The Worst Guy in the Band

IMG_2390.jpgIn Chad Fowler’s wonderful Passionate Programmer book (which you should buy), theres a chapter called “Be the Worst”.

Legendary jazz guitarist Pat Metheny has a stock piece of advice for young musicians, which is “Always be the worst guy in every band you’re in”

Chad spins this musical advice into advice for programmers.

Being the worst person on the team has the same effect as being the worst person  in the band.  You find that you’re unexplainably smarter.  You even speak and write more intelligent.  Your code and designs get more elegant, and you find that you’re able to solve hard problems with increasingly creative solutions.

I’ve tried to make a habit of this, and so far I think I’ve succeeded.  You’d need to speak to my co-workers to confirm.  I’m looking for a change in work right now, and its got me thinking.

The advice above is essentially saying be around people who are better than you, so you’re always learning.  But there are a couple of issues with this.

Firstly, you’re good enough to be in the band at all.  Chad talks a little about this in context.  You want to be the worst guy in the first division, rather than the best guy in the second, but that assumes you have the requisite skills to be in the first division.  Secondly, it assumes some relevance or connection between you and the others.

You can become a better saxophonist by playing regular jazz with a really good pianist, drummer and bassist, assuming they let you in to their band, but what if you really want to play drums.  You can’t be the worst drummer in that band.  They already have a drummer who’s good.

Maybe you go join a drumming group.

You’re surrounded by drummers who are better than you.  You are the worst drummer and every day you work with better drummers and get better at drumming.  But now you’re a junior drummer, and you’re getting paid as a junior drummer, and you’re playing basic stuff all the time, which is improving you as s drummer, but not really stretching you as a musician.  Your expert saxophone status does not buy you recognition in that drumming group. You’re a beginner.

What you want is a bigger band.  A band that already has a great drummer, but can hire you for your saxophone skills 6 days a week and indulge your desire to be a junior drummer 1 day a week.

A couple of times in my career I’ve wanted to change direction, and both times I’ve been lucky.  My first proper Ruby job, my Java experience and Agile consulting work was enough to pay my way while I was a junior Ruby engineer working with a team of experts.  My first proper iOS job, that Ruby (and the Agile work again) was enough to justify a senior engineers position and salary while allowing me to essentially be a junior iOS guy and learn the ropes.

I’m feeling like its time again.  I’d like to be a junior something.  Maybe Mac development, maybe project management, maybe something else entirely, but I have to find the right band.  Someone that’ll happily hire my saxophone while I learn my crash from my splash.

 

My pencils are sharp enough

Its time I started blogging again.

I’ve had several over the years and usually end up deleting them after a while.  I used MovableType, and Ghost and Blosxom and Jekyll and all sorts of other tools.  Twitter really killed it for me.  It made it easier to throw out a thought than to sit down a craft a post. This is a wordpress site because it was quick to get working and typing.

I pulled across 3 or 4 older things I still liked, though they’re ten years old and maybe not relevant any more, it meant I wasn’t starting with the pressure of a blank slate.  Back then I was doing Java and Ruby.  These days its ObjectiveC and Swift.

So I guess I’ll see where this goes.

Smalltalk Best Practice Patterns

unknown-1In the 1990s the “patterns” movement in software was in full flight. The poster child, and many peoples introduction to patterns was the so-called Gang of Four book Design Patterns, published in 1994. Design Patterns catalogued a series of blueprints, strategies for combining classes to solve a problem, and the idea spread through the industry quickly, to point where Design Patterns become a buzzword and to some extent lost a lot of its original meaning.

But software patterns come in all different shapes and sizes and one of the people instrumental in the movement towards utilising the notion of describing software with patterns was Kent Beck. Kent is involved with many of the most important (IMO) ideas in software over the last 20 years, including object-orientation through Smalltalk, Test-Driven Development, Refactoring and our subject here – Patterns,.

unknownSmalltalk Best Practice Patterns is a collection of tiny, very specific patterns describing how Kent wrote Smalltalk. I’ve heard Kent describe how the book was written once, and I’ve tried and failed to find a reference.

In essence, when he start to write a line of code, he looked to see if he had a pattern describing what he was about to do. If yes, he used it, if no, he amended an existing one or wrote a new one. The result is a reasonably complete specification describing the choices available to him in writing each and every line of code in a program, from variable naming to inheritance hierarchies.

The power of this method was obvious to me, despite never having really seen Smalltalk before, so in order to properly read the book, I wrote to Wilf LaLonde’s JOOP column asking him for a beginners guide to Smalltalk.  He wrote one for me, and doubtless other Java programmers keen to understand how a “pure” Object-Oriented language worked

Smalltalk Best Practice Patterns is, without doubt, the best programming book I’ve ever read. Despite never having written a line of production Smalltalk in my career, it fundamentally altered how I write code in any language, forever.

Acceptance Testing Classes

I have seen a lot of unit tests in my 10 years as an XP practitioner and coach. I have also had a lot of debates about styles of unit testing. The longest running of these debates is about the role of “mock objects” in TDD.

Martin Fowler has characterised the use of mocks as “interaction testing” in that you are verifying that certain methods get called as a result of stimulating the object under test, rather than that the state of the object changed.

I don’t like this style of testing for a couple of reasons.

The first reason, which will really have to be an article on it’s own, is that it tends to make refactoring a lot harder than it might otherwise be. This is due to a lot of tests that verify specific methods are called in a specific order. The names and order of these methods can change often early in development, as well as later if a large refactoring is performed.

The second is what I wanted to talk about here.

When every collaborator of a class is mocked, it becomes divorced from reality. It is truly being tested in isolation. We verify that when this fake object pokes it in a certain way it responds by poking these other fake objects in a different way. We have no evidence (at this point) to suggest that the object will be poked in the same ways in production.

What we end up with, I think, is a set of acceptance tests for an individual class.

When I mind map this I end up with “waterfall”. We are designing and building and acceptance testing a class in isolation, and increasing the cost of change of that class. We lose a holistic view of the system and are discouraged from refactoring, especially across classes. The software becomes less soft.

Dials to Eleven

Movements arise in context. For people to gather around a shared social, artistic or aesthetic ideal, they usually need some other social ‘norm’ to distinguish themselves from. Movements are as much about what they’re against as what they’re for.

Now, that context may not be responsible for the birth of the idea, but I think it is responsible for turning someone’s idea into a movement, shared by a number of people.

In the case of Extreme Programming, the process was not ‘created’ by Kent Beck as a reaction to RUP. RUP wasn’t the problem at C3. As far as process is concerned, XP primarily addressed shops with no process. But by defining XP as the anti-RUP, the community turned XP from an idea into a Movement. Giving the idea a concrete enemy, enables people to get behind it and take it to the next level.

Ruby on Rails, another example of a movement in software, was born (so the story goes) from David Hansson’s frustration with PHP. Yet again, however, it’s J2EE that defines Rails as a movement. So, in both cases, a transforming idea comes along to bring more discipline to a chaotic environment – no process, or PHP development. In each case, however, what came to define the technology was the larger, more complex (theoretically more disciplined) approaches to process and software architecture. – RUP and J2EE.

In both cases, I see a lever. RUP has it set full on ceremony and documentation. We know we need to ease back on that, but why pull the lever all the way over the way XP does ? In the case of Rails, surely we can get lighterweight than a full J2EE stack without ditching all of the configuration and flexibility ? Why do we need to go for such a constrained solution as Rails ? Why not Spring ?

What’s interesting about that lever is that it’s spring loaded. If we pull it 90 degrees, it snaps back to 45. When we try and reduce the documentation in our process, if we try and drop 10% we’ll end up with only a 1% reduction, or maybe none at all.

XP understood this and set out to pull the lever all the way over (knowing that it would slip back eventually). By saying ‘all code must be pair-programmed’, it sets an ideal that we’re pretty sure can’t be adhered to all the time, but we set the dials to 11 knowing we might hit 9.

The same hold for Rails. When we take the J2EE stack and try and slim it down, maybe using Spring or something, we still end up with thousands of lines of XML. The only way to really change things is to pull the lever all the way over, set the dials to 11, no configuration, no XML, no flexibility.

The Extreme approach can really change things in a way that the softly-softly approach never will.