Generalisation (by )

One of the things I instinctively do when designing software, given a client's requirements, is to generalise things as much as possible, in order to make it easier to deal with changing requirements in future, or to avoid having to write special-case code to deal with more unusual situations that they already need handled.

Eg, somebody might say "I want a system to transport email and files between computers in my organisation". So you might think: Ok, I'll start by designing a general packet-switching system to transfer data across an interlinked network of computers, with routing algorithms to work out the best paths, retransmission systems to deal with failures, and so on. Then on top of that I'll build an email system and a file transfer system. That way, most of the difficult stuff is done in a single module that deals with getting data from A to B across an unreliable, changing, network. Email and file transfer are then much simpler modules, with as little duplication of work between them as possible. So it's easy to add more functions to the system in future, and any improvements to the underlying routing engine benefit email, file transfer, and any other application equally.

Standard good software engineering practice, right? Modularise and have an abstract API between layers of a system?

However, sometimes I do this, but am then faced with an uphill struggle, as the client starts wanting changes that break the abstraction layers between the modules...

For example, they might suddenly start saying that they want all the email to go via their fast but expensive transatlantic cable, so it gets their quickly, while spending as little as possible - they pay by the megabyte, but emails are small. Meanwhile, they'd like the file transfers to go via the cheap satellite link, which is slow. But nobody's in a hurry with a large file transfer.

Ok...

But the nice routing module we designed doesn't care what application is using it; it just gets given a bunch of data and told to send it somewhere.

So we have two main classes of choice:

  1. Make the routing system, at the point where it has to choose between satellite or transatlantic cable, break the layers a bit by peeking inside the bunch of data it's given to decide if it's part of a file transfer or an email, and decide how to route it based on that. This is quick and easy, but it means that the routing system now needs to know a bit about the applications, so it'll now need updating if extra applications are added or the rules change, which increases maintenance overhead and scope for error.
  2. Sit down and have a think about this requirement, and how it might impact future applications (a bit of prediction and guesswork is required here), and design a change to the API to fulfill that need. For example, adding a "type of service" field to every chunk of data given to the routing system, saying whether it needs to get there quickly or cheaply. This creates a more maintainable system in future, but is also more up-front work.

However, it really makes my life hard when people, after requesting a system with so many esoteric variant cases on a complex operation, and the expectation that more variant cases will arrive in future, that it has to be a very modularised system to control the complexity - but where one case is by far the most common - then start requesting changes to the system that totally ignore the fact that there are any exceptions to the common case.

Which is then a real headache to deal with, as you have to figure out how their feature applies to all the other variant cases as well, and try to explain this to them...

Experiments on animals (by )

I was doing something in the kitchen; Jean was toddling around playing with a hair grip. The kind that's two plastic jaws closed by a spring. She was gripping it on to bits of her clothing, and various objects around the kitchen, experimenting with what it would hold onto well.

She wandered out of the kitchen into the living room, then came back a bit later, looking thoughtful.

"Cat no like it" she said, waving the hair grip at me.

I'm amazed she wasn't crying and nursing a scratch!

Mental modes (by )

Hmmm, it appears I have two mental modes when working.

  1. Deeply focussed into something. I block out distractions to hold onto the focus. This is what I need when I'm programming. Once I get into this mood, I get a lot done, since I have all the pertinent information sitting in my head and all the correct windows open on my computer, but it can be an uphill struggle to get started.

  2. Event driven. When I'm dealing with emails, phonecalls, broken servers, and that sort of thing, I'm in a very different mode, agily flipping between things. I come across problems that will clearly need some deep focus, and I have to put them off for later, since it takes me a while to get out of deep mode and into event-driven mode.

This morning I've been event-driven, catching up on email, dealing with a down server, and now I really ought to try moving back into deep focus mode to work on something else, and I'm finding it hard; my thoughts just keep jumping around!

I really want to decrease my dependence on lots of deep thought mode for earning money; part of this revolves around getting an underling to do more of the programming so I can be event-drivenly mentoring them while doing the considerably easier form of deep thought required to design software architectures for them to implement... which is a work in progress as we speak...

Debugger is not a naughty word (by )

Computers are famed for harbouring bugs, and the high rate of failures in software compared to other industries is a constant cause of embarrassment. I'd like to explore why this is, with an example. And what we might be able to do about it.

Note: Although a lot of the details of the remainder crash are unfortunately very technical, I have done my best to explain things in a way that lay people should be able to make some sense of. However, some things would require a lot of background information, in which case I've just plowed on without explanation. So if you come across things that you don't understand, feel free to skip ahead a bit; you shouldn't lose too much.

Read more »

Bah, back to Rails! (by )

Gah. I was happily thinking that I was slowly getting rid of my last Ruby on Rails projects, when I've ended up on another one. Despite extensive hype, Rails is a bit of a dog... Ruby has some niceties, but also has a lot of misfeatures, and the implementation is still maturing. But Rails is dreadful, dreadful code. It helps you if you're working within its limited model, but as soon as you come across a problem that doesn't fit into that model, you're quickly working at pretty much the same level as PHP and everything else: writing Ruby code that is called upon an HTTP request and has to output some HTML back, albeit with access to a reasonable template language... And it's full of bugs and gotchas that keep you up all night screaming "Why doesn't this wooooorrrkkkkk?!?!?!?".

You see, the project is a major extension of a Rails project we'd mainly finished. We had the choice of rewriting the whole thing in something else (which would involve some time spent catching up with where we already are rather than producing anything new), continuing with Rails, or making a hybrid system, writing the new parts in something else while reusing parts in Rails (which would be a bit ugly).

Since the client wants to see interesting new things appearing after the first week or two, sadly, it had to be Rails...

WordPress Themes

Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales
Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales