Tuesday, 8 March 2011

Leaders in Agile - TDD - Virtual conference

On Wednesday 2nd March I attended a virtual conference on Test Driven Development (TDD) hosted by bzmedia. Guest speakers were Kent Beck and Mark Seeman.



TDD is an Agile methodology where software is written in small increments by creating a test that fails then writing the code to make the software pass the test. Once passed, another test is created, the code implemented to pass the test and so on.

A test takes an input, defines an expected output and compares the actual output with the expected one

By breaking up the code into these small chunks (where each chunk should only take around 15mins), comprehensive unit tests are created, and design decisions are made, by the developer as the code is being produced.

The software is complete once you have run out of tests to implement.

In following this method it is possible to reduce the cost of fixing defects on the basis that the longer a defect exists, the longer it will take to find and fix.



unit tests


There are 2 types of tests: those that test the functionality/logic of the code and those that test the implementation. Implementation tests are owned by the software architect; the developer has ownership of the unit tests which test the logic in the code. It is the unit tests that form the basis of TDD and provide the framework required to develop working code.

Not all the functionality can or should be tested; focus on the most important logic

To effectively build unit tests the code needs to be abstract, i.e it needs to function as a separate unit to everything else. This way any external influence can be ruled out as a cause on the results of the test, if the code does have some dependencies then it should be possible to create test doubles which can be used to provide controlled input to the code being tested.



deferred design decisions


Throughout the development, design decisions are being made. The test will be given a name which can then be given to the object/function that is being tested, likewise the names of variables will come out of creating the test. In the end the test suite will define how to communicate with the code (the Interface)

Best practices should be strictly adhered to: objects/classes should be loosely coupled, refactor to avoid repeating yourself by creating helper objects/methods to facilitate code re-use. As the unit tests will already be in place for the existing functionality it will make it easier to validate the changes made during refactoring.



maintaining tests


One of the more challenging aspects of TDD is keeping the test suite up-to-date.

It is not unreasonable to expect twice as much test code as that in the actual software

Even though there will be a lot of test code it would not make sense to create tests for the test suite so the complexity of unit tests should be really simple.

Refactoring is an important part of maintenance so helper methods/classes/frameworks should be used to isolate complexity, this comes at a cost though of creating coupling. The dependency of the tests on the helper methods means that one of the biggest challenges is writing the interface for them as any change to it could break many tests. It is important to minimise the coupling and therefore the chances of creating these fragile tests as they tend to get abandoned or changed when they break.
The code is written to pass the test; the test is not written to pass the code


Summary



  • Reduced defect costs

  • Defer bugs to the test suite rather than the software

  • Software designed during development, by developer

  • Tests are written one at a time

  • Tests should be written to fail, then software coded to pass

  • Tests are automated

  • Keep time tests take to run minimal

  • Outsourcing development isnt Agile

Wednesday, 19 January 2011

Wednesday playlist

7:Moby
6/8 War:Leftfield
6 Underground:Sneaker Pimps
The 29/8 Steps:Outside
21st Century Poem:Leftfield
World Looking In:Morcheeba
Women Lose Weight:Morcheeba
Why does my heart feel so bad:Moby
What You Think About...:St. Germain
What New York Couples Fight About:Morcheeba
Western Eyes:Portishead
A Well Deserved Break:Morcheeba
Way Beyond:Morcheeba
Waterbaby:Sneaker Pimps
Wasted Early Sunday Morning:Sneaker Pimps
Walking Zero:Sneaker Pimps
Undress Me Now:Morcheeba
Undenied:Portishead
Tosh:Fluke
To Forgive But Not Forget (Lim' Chol V'lo Lishkoach):Outside
Tesko Suicide:Sneaker Pimps
Teardrop:Massive Attack
Swords:Leftfield
Sure Thing:St. Germain
Storm 3000:Leftfield
Stoppa - Drum Head:Stoppa
Spin Spin Sugar:Sneaker Pimps
Space Shanty:Leftfield
Space Junk:Burning Bush
South side:Moby
Song Of Life:Leftfield
So Flute:St. Germain
Slowdown:Morcheeba
Shallow End:Morcheeba
Seven Months:Portishead
Sao Paulo:Morcheeba
Salt Water Fish - Peshay Mix:Ruby
Rushing:Moby
Run On:Moby
Rose Rouge:St. Germain
Rome Wasn't Built In A Day:Morcheeba
Roll On:Sneaker Pimps
Risingson:Massive Attack
Rino's Prayer:Leftfield
Remembrance:Outside
Release The Pressure:Leftfield
Public Displays Of Affection:Morcheeba
Post-Modern Sleaze:Sneaker Pimps
Porcelain:Moby
Pont Des Arts:St. Germain
The Plan:Outside
Phat Planet:Leftfield
Peace - Pts 1 & 2:DJ Food
Over:Portishead
Otherwise:Morcheeba
Original:Leftfield
Open Up:Leftfield
Only You:Portishead
Only The Strong Survive:DJ Krush
One To One Religion:Bomb The Bass
Nights Introlude:Nightmares On Wax
Natural Blues:Moby
Mutant Jazz:T-Power Vs. M.K. Ultra
Mourning Air:Portishead
Moodswing:Outside
Montego Bay Spleen:St. Germain
Minty:Outside
Mezzanine:Massive Attack
Melt:Leftfield
Man Next Door:Massive Attack
Machete:Moby
The Lower We Fly:Outside
Low Place Like Home:Sneaker Pimps
Love Sweet Love:Morcheeba
Love Is Rare:Morcheeba
Let It Go:Morcheeba
Leave Home:The Chemical Brothers
Latin Note:St. Germain
Land Of...:St. Germain
La Goutte D'Or:St. Germain
Killing:Olive
Karmacoma - Unkle Situation Mix:Massive Attack
Journeyman, Pt. 2:Outside
Journeyman, Pt. 1:Outside
Journeyman Pt 2:Outside
Isobel:Björk
Inspection Check One:Leftfield
Inside:Moby
Inner City Life:Goldie Presents Metalheads
Inertia Creeps:Massive Attack
In The Hands Of The Gods:Morcheeba
If things were perfect:Moby
I'll Fly Away:Ballistic Brothers
Humming:Portishead
How Do:Sneaker Pimps
Honey:Moby
Half Day Closing:Portishead
Guitar Flute & String:Moby
Group Four:Massive Attack
The Great London Traffic Warden Massacre:Morcheeba
Good Girl Down:Morcheeba
Get Along Ft. Pace Won:Morcheeba
The Garden Of Earthly Delights:D Note
Friendly Pressure - Pluvio Mix:Jhelisa
Fragments Of Freedom:Morcheeba
Flowers Aren't IV Picking:Outside
Find my Baby:Moby
Fallen (Slight Return):Ape
Exchange:Massive Attack
Everloving:Moby
Elysium:Portishead
El Cid:Leftfield
Dusted:Leftfield
Dub Gussett:Leftfield
Down Slow:Moby
Double Flash:Leftfield
Dissolved Girl:Massive Attack
Cowboys:Portishead
Cool Kids Of Death - Underworld Mix:Saint Etienne
Commander Tom / Attention (Future Funk Remix):Various
Coming Down Gently:Morcheeba
Clubbed To Death (The First Mix By Rob Dougan):Rob D
Clank:DJ Spooky
Charango:Morcheeba
Chant Of A Poor Man:Leftfield
Bump:Dave Angel
Born Slippy:Underworld
Bodyrock:Moby
Black Milk:Massive Attack
Black Flute:Leftfield
The Big 'F' Reunion:Outside
Becoming X:Sneaker Pimps
Be Yourself:Morcheeba
Barbola Work:Black Dog, The
Aqualung:Morcheeba
Angel:Massive Attack
All Mine:Portishead
Afro-Left:Leftfield
Afrika Shox:Leftfield

Wednesday, 24 November 2010

Pangbourne Swim - 2010-11-14

I'm excited to see blue sky out the window having being awoke by the 7.30 alarm. My bag, already packed the night before, bulges with layers with which to scramble on after what promises to be a chilly 1 mile swim down my first river: the Thames. There would be no post-swim shower to aid me in raising my body temperature with which I have become accustomed to at Parliament Hill Lido and I wouldn't have the luxury of a changing area so my sports towel has been substituted for a full sized towel which will keep my modesty intact.

A large bowl of muesli is the breakfast of choice, a carb-fest which would fuel the fire needed to keep me warm and keep the engine going. A quick check through the inventory and i'm on the road to the meeting point at Pangbourne station. The 55 mile journey sees the blue sky turn overcast the further round the M25 I go; come the M4 the motorway signs warn of fog which is met just outside Reading and by the time I reached the station it's looking to be a typical damp dull autumnal morning.

I'm greeted by the sight of around 20 Outdoor Swimming Society members hanging about outside the station, looking like a group of youths outside a local shop who are up to no good, and am welcomed by the organiser Chris before getting chatting to some of the other members whilst we wait for the last to arrive.

The compulsory safety briefing follows which in summary consists of: your safety is your responsibility and rather than an organised event this just happens to be a group of individuals swimming in the same place. This is of no surprise and a welcome change to the tedious health and safety which is insisted on in this day and age for any sort of organised event. In my opinion the removal of responsibility of personal safety is one of the main reasons why swimming has been made a criminal offence in reservoirs and lakes in this country, owners are scared of legal action for someone who does not give water the respect it deserves.

Safety briefing over, we head off to inspect the finish point before making our way to the start where we invade the car park and turn it into an al fresco changing room. Clothes discarded, wetsuits and swimming caps donned, we pose for the obligatory photos and then head across the fields toward the river. Some local fishermen look on in bemusement as our group trapesed round a small lake like migrating seals, rarely seen in these parts admittedly, all in good spirits despite the cold and damp weather.

We reach the river and waste little time in sliding into the cold water which pricks the skin and sends a chill through as I let some into the neck of my wetsuit. Not waiting round, as time in water this temperature is precious with hypothermia just around the corner, we head off downstream with the near non-existent current.

I start off with a breaststroke in the thick green soup, which hides my hands a foot in-front of me underwater; there wasn't going to be any wildlife spotted below the surface today. What I can't see under the water is made up for by the unique perspective I have at water level from the middle of the river: willows and other trees with a residue of autumn leaves them lining the banks. River fowl hug the sides and bubbles on the waters surface map out our route down the river which welcomes us to progress onwards. Occasionally I would break into a front crawl, which soon brings on a headache of the kind which is caught by eating ice cream too quickly, and so I would revert back to breaststroke or flop onto my back or adopt a side stroke.

The group have spread out by now, a few striking out in front and others taking there time. I have partnered up with a guy from Oxford who had kindly given me a lift to the start point in his VW camper (One thing that is so attractive about the whole outdoor swimming scene is that it is a social activity, something that you would not necessarily associate with swimming), chatting as we followed the flow, talking of places we'd been and getting ideas of where to head to next.

We pass a herd of cows on the left bank, intrigued by the strange creatures floating past them, who follow us for a way. A father and son on a moored barge silently looked on as we drift past. After around 20mins we see a couple of the land crew waiting for us at the finish point, this comes as a welcome sight as my hands are telling me that they have had just about had enough of the chilly waters. Another 5 mins and we reach the end, vacating the water with one last cold water rush as the wetsuit empties through the legs which are kept relatively warm during the swim.

I head straight to the kit car and retrieve my bag of layers, taking little time to get as many layers on as I have. The passing cars have the sight of an open air changing room as we strip off out wetsuits on the roadside, prompting the odd bib of the horn. Once we are all changed, and having enjoyed a Thermos cup of tea, we head back to the start point to retrieve the cars before heading to the post swim debrief and lunch at the Swan pub. The official temperature is 7.6 degrees which is a good degree and a half colder than we had thought before entering.

Fed and warmed we all head our separate ways with a healthy glow, a new group of friends and a feeling of well-being that can only be achieved by getting a bit wild.

Wednesday, 27 October 2010

Haiku #8

The days grow shorter
from dew covered grass mist rises
leaf fall brings Autumn

Tuesday, 10 August 2010

Haiku #7

my biggest mistake?
is surrendering to love -
i'd do it again

Friday, 30 July 2010

Haiku #6

If you were to ask
in all sincerity, then…
I would say of course!

Friday, 16 July 2010

Haiku #5

Law of attraction,
Involuntary dialation
when our eyes first met