Where am I? I’m repairing my shared event-dispatching system….

So, it turns out that the whole shared event bus concept is totally old-hat. And I don’t mean Java 1.0 old-hat, I mean some time between the primordial slime and the first organisms that had cells that weren’t all identical.

Disclaimer: the following is an analogy and my biology knowledge is sketchy.

Most interesting creatures, including humans, use hormones to allow decoupled systems (organs and stuff) to respond to changes in each others’ state. The shared event bus is your blood stream, and the hormones are the events. Some parts of the body monitor state – hydration, blood sugar, sodium levels, infection markers … – and when they detect that the system is going out of whack they release those little event hormones in appropriate quantities. Other organs listen for those hormone events and then react accordingly.

In some cases the listener is even double-decoupled (a phrase I have liked for a long time). For example the hypothalmus releases one hormone event, the pituitary picks up that event, considers it in the presence of a few others and releases another hormone event, and then the kidneys, adrenal glands and many other organs get busy in response. And sometimes they even release another hormone event that – say – the pancreas is totally interested in.

At least that’s the idea.

Unfortunately my shared event dispatching system is borked.

My key event dispatcher has stopped dispatching some important events, and some of the organs got so bored of never hearing anything of interest to them that they’ve tuned out (or actually decayed).

This means that all those automagic processes that the body takes care of without us even noticing – balancing fluids, electrolytes, blood sugar, immune response, wakefulness and so much more – aren’t automagic anymore. In a nutshell I have a kind of “diabetes of all the things”, known as Addison’s.

The joy of the reproducible bug

The good thing about the diagnosis is that after several months – or maybe even several years – of bizarre and seemingly random errors (crazy stuff like stopping breathing in response to a cold drink), we’ve finally tracked down the problem to a core bug, and it’s reproducible! Of course the borked-build is already installed, but it can still be patched. Phew!

The patch consists of me, a set of drugs, a handful of gadgets that measure stuff and the willingness to manually monitor and control systems that we normally expect to be automatic. Basically, I have to dispatch my own events. Mostly just by swallowing pills but sometimes by injecting myself deep into muscle or direct into a vein (which some teenage version of me thinks is kind of fun).

The patch also requires enormous amounts of support from my GP, diabetes nurse, endocrinologist, endo nurses, pharmacist and the NHS in general, who collectively saved my life in March when I was much closer to blue-screening than any of us had realised. The fact that I get all of this care without ever being asked whether I’d like to pay by cash or card, is amazing.

I’m not quite at beta version of Stray 2.0 yet, but I’m getting there, agile style, one new use-case at a time.

So – there you have it, my quietness – and indeed my exit from the Robotlegs team, though I didn’t know it at the time, I just knew that I didn’t have the energy for everything on my plate – is all down to my need to master this manual event-dispatching business. As most of team try{harder} said – “shoulda used Signals!”

 

 

 

Post Divider

Service testing crib post

Services have such a hard life. Only one way to succeed and so many different ways to fail. *sigh*

To save myself from having to repeatedly trawl my brain for those different ways, I’m capturing them here.

The various scenarios I test, for a service that returns URLVariables which include XML data and some sort of boolean signifier of success/failure, are:

  1. Good path, good data, everything is happy
  2. Non-existent path (404)
  3. Empty script that never returns
  4. Script that returns something that isn’t URLVariables (usually an error message)
  5. Script that returns valid URLVariables including structurally borked XML
  6. Script that returns valid URLVariables and valid XML but the boolean ‘did we win?’ is set to false

Depending on the data being returned, and the process that just took place on the server, there may be further investigation of the validity of the data, and sometimes I’ll also add a time-out test, but the 6 above are my staples.

By using a consistent return-data signature for a whole project, I only need one set of server-side scripts to call on for 3-6 in all my service tests.

That’s it. As you were.

Post Divider

try, catch and finally moving on from Robotlegs

Robotlegs original logoThis week I officially excused myself from the Robotlegs core team.

The ‘why?’ is really pretty exciting: I’m writing a new book, and it’s in an area that I have been pushing my publisher to let me write on for a few years, the working title being: Head First Intelligent Applications.

We actually signed off on the book a long time ago, but things were moving so rapidly in the web-apps domain that we’ve spent a while in gestation. What was originally targeting Python is now targeting node.js.

Intelligent Applications is an umbrella term for AI and Machine Learning. Data and patterns and algorithms… I am a maths-geek to the core, so this is a dream project for me.

After this book, it’s my partner’s turn to do some writing, and mine to do the housework. And after that, I plan to get involved in teaching the next generation of programmers – so I don’t anticipate returning to Robotlegs in any significant role. I want to make that clear because it would be bad for the project if you all kept my seat warm for me – the joy of open source is that it really doesn’t matter if one individual moves on.

But stepping aside from Robotlegs is not purely a not-enough-time decision. Continue reading »

Post Divider

Rhyme Harder: an alternative pair-programming provocation

At March’s try{harder} Level Up conference, we did our usual day of code-retreat style pair-programming.

The intent is to pair for around an hour at a time with a number of different partners. All code is thrown away at the end of each cycle, because the focus is on process and reflection, not progress. At the start of each cycle you begin again on the problem, as if the code you’ve written previously had never been written.

Whether or not you should keep the understanding you gained is a more complex question; it’s impossible to unlearn, but by cycle 6 you’re generally pretty certain that what you learned in cycle 1 was not that useful after all.

Pairs can vary language and approach – we used Ruby, Python and AS3 – but there’s an emphasis on some kind of test-driven process. Test-driving can happen through conventional TDD, BDD or – our favourite at try{harder} – “TDD as if you meant it”, in which all production code is written in the test case.

We like the “TDD as if you meant it” approach because it forces you to defer committing to a definition of the solution in terms of classes, and we find that the code we write is often very different from the code we expected to write at the start of each session.

Why change the exercise?

In the past we’ve used Conway’s Game of Life as the provocation. It works well, but in some ways it feels too meaty (especially in AS3) – offering so much scope that it’s easy to vary sessions simply by shifting between the domains of the problem (the rules, the display, rendering, cycle controls and so on).

For the purposes of reflecting on tdd-fundamentals, clean code, method and variable naming, and so on, the provocation-problem chosen is almost irrelevant (provided it can be understood and held in mind without taking up too many attention slots). We were all set to use Conway’s Game of Life as usual, when, during a seminar about ‘hard to test’ code, we stumbled upon a smaller problem that led to the opportunity to reflect in more detail on the “assumptions and understanding” axis of test-driven programming. We’ve nick-named the problem “Rhyme Harder” and it goes a little something like this: Continue reading »

Post Divider

try{harder} Level Up: sponsored by JetBrains

Great news! I’m dead chuffed to be able to announce that JetBrains are sponsoring try{harder} Level Up.

Thanks to JetBrains, all participants will get a full Personal License for IntelliJ IDEA 11, which would normally set you back £155.

Can’t code withoutJava IDE with advanced HTML/CSS/JavaScript
editor for hardcore web-developers

try{harder} Level Up is a collaborative-learning conference aimed at mid-to-senior developers with a background in ActionScript. It’s taking place next week – 19th to 23rd of March, in Nottingham, UK.

try{harder} Level Up is a residential course – you’ll be sharing a luxury lodge with other participants, and the freelance-discount price of £699 (reduced from £1300) includes accommodation and some food, so your only other costs will be transport, beer money and dinner.

Numbers are limited to 16 – 8 try{harder} Mentors, including the people who brought you Robotlegs and Swiftsuspenders, and 8 new participants (one of them could be you!).

We only have a handful of spots left, so get in fast!
Continue reading »

Post Divider