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

Freelancers: try{harder} Level Up, £600 off!

Newsflash: The price for freelance attendees of try{harder} – Level Up will now be £699.

How? The mentors originally agreed to do the conference for a nominal sum to cover expenses plus one day of pay, but in the interests of making try{harder} – Level Up accessible to more freelancers, we’re now running the conference on an expenses-only basis.

Although there’s only a week and a bit to go, we expect that at this price those last places will go fast – so, if you have an opening for the week of the 19th March and you don’t want to miss out, get in touch now. (Hell, make an opening for the week of the 19th!)

The winter try{harder} 2012 will be the first week of October, but at present there are no slots at that conference available – all of the original group from 2011 have said they’d like to keep their place in 2012. So this is the only opportunity for newcomers to experience try{harder} in 2012.

Should I really invest in flash-based learning, now?

If you’re thinking of shifting away from AS3 as your primary platform, Level Up couldn’t be more suitable:

Till Schneidereit (Swiftsuspenders) has been working in JavaScript for some time, and as he’s also now helping Mozilla to develop FireFox, he can blow your mind with the latest live-debugging / rapid-prototyping tools available for JS.

Plus, most of the mentor sessions are platform neutral, and many are geared towards our current development climate:

Till Schneidereit: Project Forensics
How to detect the clues that allow you to make changes in someone else’s codebase, fast.

Shaun Smith: Robotlegs 2
Architecting for extension.

Stray: Fluent code
Creating DSLs, fluent APIs, helpful builders and meta code, with examples in AS3, php, Ruby and JavaScript.

David Arno: You can be a polyglot too
How to efficiently analyse and adopt new programming languages.

Michal Wroblewski: Maximizing performance in mobile games
You’ll learn that optimizing performance on desktop and mobile require different strategies. Covering rendering options including the latest AIR SDK 3.2 possibilities and also which gaming frameworks will help you achieve this. Prepare for a ‘tricks&tips’ intensive presentation.

Robin Wilding: Maximising developer flow

Angela Relle: How useful are your user stories?

Bonus offer: Come to try{harder} – Level Up and get a free ticket to btplay

We’ve got one btplay conference ticket to give away to the next person to sign up for Level Up who wants to attend both.

The btplay conference: Play, Beyond Tellerand, is 25th – 26th April, 2012, in Cologne, Germany.

I’m speaking at the conference and also running an AI workshop on Building Intelligent Applications (Workshops are not included in the standard ticket we’re giving away).

Post Divider