≡ Menu

A few years back I was telling one of my former colleagues about a new technique I’d discovered and had been using for a little while: test driven development (TDD). I was full of enthusiasm for this, at the time to me, new technique.

His first question to me surprised me a little: “yes, but is it as fulfilling”?

I was initially unsure how to answer, but said something like yes, that I felt a lot more productive and seemed to spend a lot more time writing code.

After much time spent coding in different TDD environments and after more time to reflect, I can now say for certain that yes, it is more fulfilling.

Let’s consider for a minute to the situation prior to TDD:

    • spending a lot of my time in the debugger, trying to find annoying bugs in other people’s code (or mine)
    • not feeling totally secure in the code base at any point in time, until the QA team had tested it
    • being uncertain about making changes or refactoring, particularly in code that wasn’t written by me, in case I didn’t know what I had inadvertently broken
  • With TDD I enjoy the feeling of being much more confident both in the code I write, and in the code base itself, because it is covered by tests. I like that I can fix bugs or refactor with confidence, knowing that I can run tests to ensure I haven’t broken anything. And that an automated build will also run tests after every check in. And that my team is doing the same.

    I like that I can write a test to reproduce a bug, and then write the production code to fix the bug. And then run all tests to make sure that I haven’t broken anything elsewhere.

    I like that I don’t have to waste as much time stepping through code in the debugger.

    I like that I can go home at night, knowing that all my code has been integrated successfully and that all tests have passed.

    The resulting code base produced is better quality, and bugs can be fixed with more confidence.

    I know that all of the above is only as good as the quality of the tests and of their code coverage. But that’s what being a pragmatic programmer is about; and it’s still a huge leap forwards from the previous situation.

    Feels pretty fulfilling to me!

    { 0 comments }

    I am currently reading The Art of Unit Testing by Roy Osherove. He recommends the following naming convention for tests:
    [MethodUnderTest]_[Scenario]_[ExpectedBehaviour]

    Which I am glad is similar to that which I’ve adopted in the past:
    [MethodUnderTest]_Should[ExpectedBehaviour]_When[Scenario]

    I think the latter makes for easier reading. Though I admit that the convention recommended by Roy makes for easier ordering/categorising of tests by scenario.

    Whichever method is chosen, I think it’s important that the same standard is adopted by the whole team.

    { 0 comments }

    I’ve been on the road in South America for nearly 2 months now. Actually, I’ve found it surprisingly difficult to find time to read whilst travelling (excluding travel guides!). Most of my time has been taken up by travel experiences, organising, and the inevitable socialising. But for better or for worse, the long bus journeys in South America have proven to be the saviour of my reading.

    This is what I’ve read so far:

    Ancient Futures: Learning from Ladakh

    by Helena Norberg-Hodge
    This must be the quintessential travel book. It’s the story of the Leh tribe in the Ladakh area in the Kashmir region of northern India, which was documented over 16 years by Norberg-Hodge. She made extraordinary efforts to get to know the people and their culture, which included learning their language, and she watched the impact as they went from minimal contact/trade with the outside world, to mass tourism and western-style development. The book raises real questions about the nature of western-style progress, especially regarding life satisfaction and happiness. Everyone should read this book.

    Crucial Confrontations: Tools for Resolving broken promises, violated expectations, and bad behavior

    by Kerry Patterson, Joseph Grenny), Ron Mcmillan, Al Switzler
    This is a book all about how to safely confront people… you know, what most of us try to avoid doing, because it’s usually easier to avoid, and/or because most of us do it poorly. The book offers a lot of great, practical advice with plenty of examples. Everyone should read this book.

    Underground: Tales of Hacking, Madness, and Obsession on the Electronic Frontier

    by Suelette Dreyfus with research by Julian Assange
    This is a book co-authored/researched in the late 90’s by Julian Assange, of Wikileaks fame. I found out about it when researching Assange’s background; it’s a book about the underground hacking scene in the early 90’s, which he was involved in. The book is meticulously researched and brought back a lot of memories for me of the computer scene that existed back then, a time when as a 15 year old I could think of nothing more fun then messing around on my Commodore Amiga 500 (why didn’t someone tell me?!). Fittingly, this was the first book I read on my Kindle. (Not everyone should read this book.)

    How To Win Any Argument: Without Raising Your Voice, Losing Your Cool, Or Coming To Blows

    by Robert Mayer
    My friends may find this amusing given how much I love a good, err, discussion, but the book isn’t exactly as one would expect from the title. It’s about how to put forward persuasive arguments, either in writing or verbally. It covers subject matter such as the techniques used in marketing and politics: very useful if you want to learn how to build a case using techniques that professionals use, and/or further understand how products are marketed to us and how politicians manage to win us over!

    30 Sentences For A Millionaire Mindset

    by Dragos Roua
    This book was recommended to me by a former colleague of mine, and I also read it on the Kindle. Firstly, this isn’t one of those <groan> “how to become a millionaire” type of books. It’s more a set of rules for a successful and healthy mind-set, with details on how to action change, if required. A lot of the rules are just common sense and some are down-right simplistic, but some are really inspiring. One might suppose this book could be opposite to the ideas presented in Ancient Futures (mentioned above)… I would say, diplomatically, yes and no… 30 Sentences, to me, seemed mostly about how to avoid common traps in a Western, consumer society which are to the detriment of your well-being, and instead to seize back your time and money and use the system to your advantage.

    The Intelligent Investor: The Definitive Book on Value Investing

    by Benjamin Graham
    (Reading right now). As the title might give away, this book is THE classic book for value investing, written by Benjamin Graham, the mentor to billionaire investor Warren Buffet. Everyone who wants to be a successful investor should probably read this book. I must admit, it’s a little dry to read while travelling, though…

    { 0 comments }

    HoPE is a very nice WordPress theme by Patrick that I’m currently using for a travel blog.

    I’ve found two minor niggles with Version 2.5.8 so far: the theme doesn’t display italics, bullet points for unordered lists or numbers for ordered lists. The fix is quite simple (just to return the styles to their defaults) but I thought I’d post the stylesheet fixes in case anybody else has the same problem:

    1. Edit the style.css file. You can do this via your WordPress admin interface by clicking on the menu item Appearance->Editor, then choosing the style.css file
    2. Search for
      i, em, dfn, .fn, cite{font-style:normal;}

      and replace with

      i, em, dfn, .fn, cite{font-style:italic;}
    3. Search for
      .entry-content ul{list-style-type:none;}

      and replace with

      .entry-content ul{list-style-type:disc;}
    4. Search for
      .entry-content ol{list-style-type:none;}

      and replace with

      .entry-content ol{list-style-type:decimal;}
    5. Update the file
    6. View your website again (don’t forget to click refresh your browser to clear the cache)
    { 0 comments }

    In my last post I mentioned the idea of an “overseas wallet”, ie one that you take with you when travelling and that only holds the items that will be useful when on the move.

    George Costanza holding a wallet he can barely close

    (Sony Pictures/Television)

    That means we need to have two wallets… but the technologist (and minimalist) in me asks, why are we still carrying around a wallet at all…?

    This is becoming a step closer to reality with the spread of devices that contain near-field circuits (NFC), where you can swipe your phone to pay, and with the scramble for payment service providers to capture this emerging market.

    I can’t wait! Having to carry a wallet around is annoying.

    My wallet tends to grow bigger over time while I busily accumulate more cards, more receipts, more coins… until at some point, like when it reaches George Costanza size, my human garbage-collection process kicks in to sort out the mess.

    A smart-phone wallet could mean that the following could all be stored electronically:

    • cards, whether they be credit cards, debit cards, travel cards, health care cards, even my driver’s license.
    • receipts… perhaps in a system that would allow me to retrieve them by date, by store. I could even tag work-related expenses which would make doing expenses a dream rather than a chore.

    I would also need never worry about my cards ever expiring or wearing out!

    So, what’s holding us back? Naturally, replacement of the traditional wallet would rely upon the ubiquitous availability of such payment systems. This still seems a long while away. After all, we still can’t use current credit/debit cards everywhere yet. We still need to carry some cash.

    Other potential hiccup could be, what would happen when the phone’s battery goes flat when you really need to use the card…? Aha! The NFC designers might say: the specification also defines a card-emulation mode, so that the device could behaves like an existing contact-less device, such as RFID.

    The ‘elephant in the room’ could be that losing your phone could mean that you could no longer purchase anything. That’s quite a problem! One can imagine the scenario: “I’ve lost my phone! Argh, now how can I purchase a new one… without a phone?”.

    It seems my dream of giving up my leather wallet might be a while away yet, until we have universal availability of devices/terminals… and a solution to the problem of a lost phone!

    { 0 comments }