You are currently browsing the archives for the Refactoring category


June 2014 – Is TDD Dead?

Is TDD Dead?

Here lies TDD…

Date: Thursday 26th June 2014
Time: 19:00
Venue: Staffordshire University – Stafford Campus (Octagon building, K102)

Fear not, TDD is not dead, although it’s certainly been talked to death this month. This catchy title has been doing the rounds on the web recently since the Kent Beck + Martin Fowler + David Heinemeier Hansson talks. This month we are going to take a look at it ourselves, try out some different approaches and share our experiences.

For me it all started about 2 months ago when I watched Ian Cooper’s talk on TDD, Where did it all go wrong. I’ve been told over and over, that unit testing gives you the freedom to change code with the safety of maintaining functionality for the customer. So refactoring is the process of changing code without changing functionality, and those like Kent Beck would advocate your test suites allow you to safety refactor to design patterns as they emerge in the system. Yet this video struck a chord, I struggle to refactor code without breaking tests, and so lose confidence that the functionality is unchanged as the tests are now different.  Ian’s video addresses these points by highlighting different approaches and definitions to unit testing, and asks is the way some of use do TDD slowing us down.

We are going to explore this issue by scratching an itch many of you had during last months lean coding challenge, Refactoring! After a quick summary of Ian’s video, we are going to pair up and refactor a completed C# implementation of last months Checkout Code Challenge. It will be covered by two test suites. One set focusing on implementation per method and another suite on behaviour of the system. After an hour of coding we will break for a retrospective to find out how everyone’s refactoring was influenced by the different test suites, the advantages each way of testing has to offer and insights into TDD for agile development.

As we’re going to be writing code in C#, bring your laptop with visual studio set up – Project Code on GitHub

If you’re interested, please sign up on meetup.com

See you there!

Jon Willis

Anagram Kata (Strikes Back)

Date: Thursday 27th March 2014
Time: 19:00
Venue: Staffordshire University – Stafford Campus (Octagon building, K102)

March is all about code kata. We shall be visiting a kata that has been run before – Anagram! If you do not know what code kata is, start with Dave’s Blog and then read his anagram kata post.

We like change, so consider throwing some into this exercise (particularly those who have done it before). Some suggestions:

  • Profile the application, perhaps in both time (execution speed) and space (memory usage).
  • Consider intermediate list processing and storage (structure the word list).
  • Try TDD in a pair.
  • Complete Dave’s suggestions – For added programming pleasure, find the longest words that are anagrams, and find the set of anagrams containing the most words (so “parsley players replays sparely” would not win, having only four words in the set).

The word list we used last time is still available on my blog. Bring your own laptops and whatever programming tools you wish. Wireless Internet access and a desktop computer with which to cut code will be available should you require it.

I look forward to seeing you this March!

June 2013 – Alien Invasion Replay

Alien Faces Vector Image by Vectorportal, on Flickr Re-coloured

Alien Faces Vector Image by Vectorportal

Date: Thursday 27th June 2013

Time: 7:00pm start (Please note time change)

Venue: Staffordshire University – Stafford Campus (K102 – the Octagon building)

Following last months session kicking off the Alien Invasion refactoring process, we discovered that a deeper and fresher understanding of the gameplay and strategies to defend earth would hopefully lead to a quicker and improved refactoring. After further discussion, we decided the best way to learn the problem domain would be to play the game again. Therefore, June’s session will be to have another go at Alien Invasion; a chance to kick some Alien Butt whilst trying to think how REST or other paradigms could be used to allow the kata to become language agnostic.

We have a live server running, so the pre-requisites for the session will be VS2010, an Nunit compliant test running (NUnit-console, Resharper, NCrunch or others). The distributable game component will be provided on a USB stick.

January 2013 – Refactoring legacy code

A little evening refactoring by joe.oconnell

A little evening refactoring by joe.oconnell

Date: Thursday 31st January 2013

Time: 7:30pm start

Venue: The Stafford Ale House

Location: Google Maps

Why Refactoring?

Well, a Happy New Year to one and all! Over the last few sessions, we’ve discussed The Alien Invasion project muted for 2013 – this project aims to change the implementation of the original Alien Invasion Challenge to support language agnostic clients. This will require reworking of ‘legacy code’ defined by Michael Feathers as ‘code without tests’.

To support this project, Paul Williams, suggested that we start 2013 with a smaller challenge to equip the group with the skills and some experience in wrapping legacy code in tests. This will then allow refactoring to be applied safely, without worry that functionality will be regressed…

The challenge

This challenge focuses on a legacy C# component with an automated build script but no unit or integration tests. During the evening, we will progressively get the code under test, at which point we will be able to change the functionality through normal TDD refactoring.

To ensure we all get equal input into the session and encourage communication and shared learning, the session shall be in the Randori Session Format – a first for Agile Staffs? This format also has the advantage of only one development machine being used, and thus there are no software or setup prerequisites for the session. The session will however use Visual Studio 2010 and Resharper to drive unit Tests using NUnit so any exposure of these would be advantageous but not required.

Edited…

The code is available on GitHub and the presentation on Paul’s website. The code will be pushed back at the end of the session for reference. This will also provide the group with exposure to Github to be used for the Alien Invasion.

 


Tag Cloud