Monday, 4 April 2011

Castles in the air

In a previous life I was a psychiatric nurse. whilst I was doing my training I came across a cool quote to do with neurotics, psychotics and psychiatrists. I'll repeat it below. It's attributed to Jerome Lawrence, a famous American author and playwright.

"A neurotic is a man who builds a castle in the air. A psychotic is the man who lives in it. A psychiatrist is the man who collects the rent."

Now in a previous life my Dad was a structural engineer. One of the things he used to say about his job was that when architects came up with a cool looking design for a building the structural engineer would take those pretty pictures and make sure the finished, pretty, building wouldn't fall down.

What, you may be wondering, is what my old man's and my previous jobs has to do with what I'm doing now in terms of being a developer...

Well, I'm tasked with making things work, I'm not always privy to the decisions that go into why they should work, but I have to make them work!

This is lovely!

I get told to do something, sometimes I get told what techniques to use to do that thing - more often than not I get to decide what techniques I get to use.

So I go off and to that thing. If it's a web-app I get to decide on what mix of server- and client-side technolgies to use... being something of a fan of ajax I usually plump for JavaScript.

I use JavaScript just so long as it doesn't slow me down too much. I'll write a script that takes every element of a page which needs content and get it dynamically, until I'm making something silly like 150 ajax calls, and then I'll realise that the server would be better off making those calls before the page ever reaches the client. PHP on the server is an order of magnitude quicker than JavaScript on the client!

Thus I get to my theory of gradual optimisation. Do something so that it works - it might not be pretty but it'll work - and then squeeze every last bit of it until it's a lean, mean, web-app. That'll often mean making changes to the page structure so that the bits that were filled in dynamically are removed if there's nothing to process but hey-ho!

No comments:

Post a Comment