It all depends where you’re going (and where you start)

As developers, our main task is to make the journey from A to B. A is you and the idea of an application, and B is the actual application, working well, a happy client and job (or flow of work) security for you.

As with any other journey, how you make it very much depends on where A and B actually are, and how they’re connected into transport options.

Continue reading »

Post Divider

Video: code generation with Sprouts & TextMate

Sprouts & TextMate code gen from Stray on Vimeo.

Recently a few people, including Troy (@troygilbert) and Paul Robertson (@probertson) have been asking about my workflow with TextMate and Sprouts.

So I screencapped an example of where I really feel like they are giving me a power-up. I’m sure you can do this level of code generation in many other IDEs, but the ease with which you can do it with Sprouts+TextMate makes it hard to resist.

Continue reading »

Post Divider

My mailman doesn’t open my mail

or, implement the Mediator-Mini-Controller anti-pattern at your peril.

Postman Pat, Postman Pat, Postman Pat and his black and white cat. Early in the morning, just as day is dawning, he picks up all his post bags in his van.

Postman Pat doesn't open the mail. He's a very good mediator. (US translation – a Postman is a Mailman, they don’t really all have cats in the UK)

The robotlegs out-of-the-box implementation – what I like to think of as the standard issue trousers – relies on a version of the mediator pattern.

In this usage, the mediator’s job description is clear: deliver stuff from the application’s shared event dispatcher to the view, and from the view to the event dispatcher.

Like any good delivery service*, it also offers enhanced packaging for your exotic sending needs. Perhaps slipping your simple MouseEvent into an air-mail-approved CustomEvent envelope.

A good delivery service also varies its delivery approach based on the type of thing being delivered. Simple letters belong in the mail box. Packages requiring a signature lead to a knock on the door. Fragile goods are handled carefully.

But, and it’s a vital distinction, the mailman doesn’t open the mail. Continue reading »

Post Divider

TDD: The Starwars Answer vs The MacGyver Principle

“But what if you write a bug – like a typo or something – into the test? I mean, your tests aren’t going to be perfect, are they?”

This is a genuine question someone – understandably – asked me earlier this week when I was introducing them to the idea of TDD.

I have two answers to this question: The math answer and the Starwars answer. Continue reading »

Post Divider

Don’t dehydrate your code

Dry, cracking earth - don't make your code as dry as this

It's possible to be too dry.

DRY (don’t repeat yourself) is one of the first principles you learn as a fledgling coder.

When you build your first loop, you’re embracing DRY, and all the wonderful code-shrinking that comes with it. And it feels good, and we’re taught to seek out repetition as a terrible code smell, and do away with it as soon as possible.

But it’s possible to be too DRY
- no, really, it is.

When considering repetition for refactoring, there are two different questions we can ask:

  1. ‘Are these two blocks of code the same?’
  2. ‘Do these two blocks of code serve the same purpose?’

Continue reading »

Post Divider