Monday, 28 March 2011

Writing a JSONP codec for openrasta

So it seems Openrasta supports json out of the box, but I needed it to support jsonp - in order to do cross-domain calls.

Stealing the original json codec, I've implemented a jsonp codec, code below.
Really enjoying openrasta so far - very quick to get up and running, simple conventions, and easily extendable !

To use the codec :

ResourceSpace.Has.ResourcesOfType<MyStuff>()
.AtUri("/mystuff")
.HandledBy<MyStuffHandler>()
.TranscodedBy<JsonpDataContractCodec>();

Friday, 25 March 2011

AppHarbor - Continuous delivery done right

So I've just joined a startup dev company - http://www.agilex.co.uk , and we were wondering what to do about environments.
We didn't really want to run a bunch of hardware out of our office, as we couldn't really afford it, nor could really be bothered with it.
We'd heard of, and used Heroku in the past in a non-commercial sense, and it looked pretty cool, but only supported ruby based apps. Then we fell upon AppHarbor - Heroku for .NET, or as they say "Azure done right" (cheeky little hook , but I love it !) .

If you know nothing about appharbor or heroku - the principle is this : we'll host, compile and deploy your code. Oh, and we'll also run your unit tests, and if they fail ... no deploy. Its all hosted on Amazon's EC2 clound offering, so can scale nicely.

So it sounded great for us, and to be fair we were only looking for a couple of things - we wanted to push our code somewhere where we didn't have to maintain the hardware.

But after a few days of using appharbor, it slowly started to dawn on me that appharbor is so much more than a hosting platform which compiles and deploys your code.
Its flippin' continuous delivery. With a single click (or git command). And they're doing it - right now. And you can too :)

As someone who's being in the agile space for a while, I'd always looked upon continuous delivery as a bit of a golden unicorn (or do I mean goose ?)- I've heard people do it, and wanted to get there, but the implementation was always elusive to me.
If you think about how hard continuous delivery is - its quite tricky. OK, maybe its not rocket science, but places I've worked in the past would have trouble implementing it.
Thats what is so amazing about appharbor - they've done all the legwork - they've automated the frick out of the whole process.
New IIS site ? Clickety click. Done. New DB ? Mysql or SQL Server sir ? Done. Deploy your code sir ? Push once again to the appharbor master, default master branch, with the build behaviour, with the build behaviour ....

I feel liberated - I don't care about system teams, DB teams, copying code to here, maintaining that CI server there -I just "push once again", and my code is live (and if you want to roll back the code, you just click "deploy" on a previous version. Yay !).

So its been weird - I suddenly have continuous delivery. And all I had to do was sign up to appharbor. Its that simple. It can be for you too : http://appharbor.com .
Their tagline is "Azure done right". I'm sure thats true - but for me, its more than that - its part of the agile journey done right.

BTW ...
@ferventcoder has some great videos on appharbor where he throws the magic of roundhouse & other chucknorris goodies into the mix : http://geekswithblogs.net/robz/archive/2011/02/18/appharbor---azure-done-right-aka-heroku-for-.net.aspx

If @appharbor is reading this - please find a way of pulling that chucknorris craziness into the DB space !

Saturday, 5 March 2011

Kanban and Scrum.

Whilst I've been trying to do agile for several years, I've never been in a scrum team that I would consider as really working. I'm sure there are scrum teams out there that estimate well, sprint well ,and deliver great software. But I've never been in one, and I'm sure there are a lot of people out there that have had a similar experience as me in implementing scrum. The point of this post is to offer an alternative - something that might work for you, if scrum isn't.

There will be some people who read this that will argue that I've never done Scrum properly - that my pain-points are due to the fact that a lack of engaged product owner, or overzealous project managers, or an undisciplined team.
Whilst that might be true, I've tried to do scrum in 4 companies over the last couple of years, and I feel a theme is emerging (and yes, I know that theme could well be "you is doin' it wrong").

On paper, Scrum seems good - estimate some work, check your velocity, fit the the number of stories into the sprint as will fit that velocity in order of priority. Do the work; sprint ends, demo to the customer; accept feedback. Rinse and repeat.

Waterfall says analyse some features, work out how long it will take, commit to a deadline. Do the work, timebox ends; demo to the client.

But in my experience, Scrum often feels a bit like mini-waterfall.

Scrum's not exactly the same as waterfall - there are some clear improvements that exist in the scrum approach - quicker feedback, ability to change course & react to stakeholder input. Estimation of work is better because you're estimating every 2 weeks rather than once at the beginning.

But when I'm doing Scrum, I feel that its not enough - the feedback isn't quick enough, and the project managers start to treat it as a sequence of mini-waterfalls. They start asking why we didn't manage to fit in all the stories we put into the Scrum, and start micromanaging.
Now there are several reasons it feels like this - the main ones probably being that the PM's never really get on board with Scrum, and push the "feeling" of it to mini-waterfall. Coupled with that fact that the team is probably not very good at estimating, and we're not really engaging with the stakeholders, and still using PM's as proxy stakeholders.

But thats one of my problems with Scrum - its almost too easy to fall into mini-waterfall when you don't have available all the aspects that would make Scrum succeed - access to stakeholders, and either PM's that embrace Scrum (or dare I say it no PM's at all).

I'm also not particularly engaged with the idea of velocity or timeboxing.
When does a business care about velocity ? What does velocity mean to them ? Businesses deal in money and days. I've never been comfortable with this fibonaccian sequence of abstract points. I don't know what they mean. I'd rather say "small, medium, large, crazy big". I know that small is a couple of days, medium is a few days, large is a week, and crazy big needs to be broken down.

Timeboxing feels like overcommitting - in the same way waterfall is overcommitting. In most sprints I've been in, we've either delivered everything, and pulled in more work, or not delivered everything we'd estimated we would. I've rarely delivered exactly what we'd estimated.
Now that could be a problem in estimation, and I'm sure there are teams out there that are making it work, but I'm sure there are plenty of people who arn't.

So why do I think Kanban sorts out the pain-points I've experienced with Scrum ?
Scrum "pushes" work (a bunch of features) into a timebox. Kanban "pulls" work on a feature by feaure basis.
I like that for several reasons.
Firstly, it leaves little room for PM's to take control. Work is done when work is done.
The business just cares about delivering features - and Kanban gives that. The business doesn't care about velocity. The business knows if a team isn't delivering software quick enough - you don't need velocity to tell you developers arn't up to scratch. A business should employ developers that care - if they care, then you'll get good software delivered quickly. Its about trust, and respect.
Secondly, the feedback cycle from Kanban is immediate - you don't have to wait for the sprint to end. Couple with continuous delivery, the business sees immediate results.
The pipeline is simplified - get feature, clarify it, code it, push it.

I think Kanban can also work for PM's as long as they back of a bit. PM's need to engage in costing and timesheets - a fact that developers often don't understand, nor care about - but businesses often need. But with Kanban, costings and timesheets are done at the end of the pipeline - after the fact, not before it. They'll work in facts, not estimations, because the feedback cycle is so short (ie features get completed and signed off every few days, not every few weeks).