Can computer programming be like literature?

example of Python language

example of Python language (Photo credit: Wikipedia)

Programming a computer is unlike most other vocations which are generally considered professions. Writing code is a creative process. OK, the requirements specification lays down the overall dimensions of the playpen. There might even  be some coding standards somewhere on a shelf gathering dust. But within these constraints, the coder is generally free to craft the software any way they want. There is no right or wrong answer, and yet, computer programmers can be very critical of their peers’ programming style.

Some craft their code for brevity. To them, a single deviously, crafted line of code that performs umpteen operations is the pinnacle of the art. Others code for readability. They aim for such self-evident clarity that granny should be able to read the code and have a good idea about what’s going on.

Others code for performance, eking every last cycle of performance out of their composition, often at the cost of the former two. Some code from the hip, typing code in as quick as it comes into their heads. The backspace key is the first to wear out on their keyboard. Others take a long time working out exactly how to lay out the code before they ever go near a keyboard. The actual coding takes much less time than the planning.

I used to work within a team where one of my colleagues was a Christian. No problem with that, except he was a Christian with a capital C. When he introduced himself to people for the first time, he would include his religion in his first sentence. He used to update the comments in every routine he touched to include a verse from the bible. Often, they were poignant and very reflective of the code within.

Another colleague was a Black Sabbath fan. He used to replace any such biblical verse with lyrics from his favourite heavy metal tracks. Again, many were appropriate to the code. This silent coding warfare went on for years. Who knows how much mental effort and time went into the cleansing or infestation of the comments in this way.

To the rest of us, it was something to talk about and the contrast between the two sets of comments were often hilarious. But do I think that computer programming could ever be like literature? As much as I would like to believe it could be, I’m afraid I fear the answer is no. I just can’t imagine a book full of code would ever make the bestsellers list.

Having said that, here are some of the funny comments I’ve come across in my career in IT;



Options.batchSize = 300 // madness? THIS IS SPARTA


// I am not responsible for this code
// They made me write it against my will


// Dear future me, please forgive me.
// I cannot even begin to express how sorry I am.


double penetration ; // Ouch!


// I have no idea what this code does - I only changed line 1397

# To understand recursion, see the bottom of this file

...At the bottom of the file

# To understand recursion, see the top of this file


// I'm not sure why this works, but it fixes the problem.


// Somedev1 - 6/7/2002 Added temporary tracking of logic screen
// Somedev2 - 22/5/2007 Temporary my arse!


// You may think you know what the following code does.
// But you don't - trust me
// Fiddle with me, and you'll spend many a sleepless night
// cursing the moment you thought you'd be clever enough
// to optimise the code below.
// Now close this file and go and play with something else.


// Drunk, fix later.


// Magic - don't touch!


// Not to be used in a production environment

A bottle of Magners Mr Bond?

An Aston Martin DB5 as seen in Goldfinger. Exp...

An Aston Martin DB5 as seen in Goldfinger. Expensive items are often part of a glamorous lifestyle. (Photo credit: Wikipedia)

The world has changed. Traditional business models which rely on advertising to keep them afloat have to evolve or die. When you could count the number of TV channels on Mickey Mouse’s left hand, it made sense for companies to pay lots of money to ply their goods over the airwaves. After all, you were guaranteed a decent share of viewers.

Nowadays, with satellite and cable TV, the audience is more fragmented. Not only that, but many households can now record their programs and watch them later, zipping past the adverts in the process. There are internet services available through which programs can be viewed on demand from most of the major channels. Companies like Netflix and Love Film carry a huge catalogue of advert free content available on demand. A growing number of people are not watching broadcast material at all.

To counter this, advertisers have turned to techniques like product placement. If you can persuade a film producer to feature your products, the viewer gets the subliminal message that he or she will be a bit more like the hero if they use a particular brand. I don’t have a problem with the technique per se, providing it’s subtly done and fits in with the overall film.

In the books, James Bond drove a Bentley. In the transition to screen, his steed of choice is an Aston Martin. I’m OK with that. I can understand that someone who likes Bentleys might also like Aston Martins. When I see him jump into a BMW, it stretches my belief. Would the quintessentially British spy really choose a Teutonic behemoth like a 7 series? When they turn Bond into a lager swilling Mondeo driver, something in my head says “hold on a minute…”

Today I learned that advertisers are experimenting with a new method of product placement. In post production, they digitally splice in the footage of the product they are trying to promote. Maybe they change an advertising hoarding in the background to reflect something suitable to the local audience or maybe they place a can of soft drink prominently on a table in the foreground. Because it is done after the fact, the film could be customised for different audiences.

I’m not sure I like this idea. It might mean that you never see the same film twice. The first time you watch the classic Ice Cold in Alex, you will see a very thirsty John Mills sink a Carlsberg. The next time you see it, he might be drinking a bottle of WKD Blue. Can we really trust the advertisers to splice in content that matches the film?

Cash or cheque?

Money Queen

Money Queen (Photo credit: @Doug88888)

I looked at my first full-time payslip in disbelief. More money in one month than it would take me all year to earn on my paper round. At that precise moment, I felt rich. What am I going to do with all that money?

It’s a shame that every payslip doesn’t come with that feeling. Unfortunately, as time goes on, we get mortgages and cars and other such commitments to mop up all that disposable income. Money felt very different to me back then.

It was more difficult to get at for starters. To make a withdrawal, you had to actually go to the branch. I can’t remember the last time I went to a bank branch. Once in the branch, you had to queue up to see a teller. Once you reached the front of the queue, you wrote out a cheque to yourself, handed it over and in return, they gave you some cash. You could only get cash during your bank’s extremely limited opening hours which meant that almost everyone went at lunchtime. That meant the queues were enormous.

Along came the ATM. Suddenly with your plastic card and a PIN number, you could get your cash when you liked. At first, you were limited to your bank’s own branches still, but it was progress. Mine had a weekly limit of £50 which was just too low to eliminate the tedious trips to the branch.

If you wanted to pay someone else some money, you would write them a cheque. For it to be worth the paper it was written on, it needed to be backed by a cheque guarantee card. I can’t remember the last cheque I wrote out but for some strange reason, my cheque book still lives in the back pocket of whichever trousers I happen to have on. Old habits die-hard.

I remember applying for my first loan. It was for the princely sum of £2,000 to buy a new car. I had to go down to the branch for an interview with the bank manager. I remember dressing up smartly and turning up early, eager to make a good impression. That was over 20 years ago and was probably one of the last times I ever saw a bank manager.

Today, I can pay for my tube ticket with a swipe of my card. I can lend money out to other people without ever leaving my armchair. From that same armchair, I can place bets or invest in the stock market. Some would say that they are one and the same thing. I can also launch a project and ask strangers to invest in it. I can find almost anything I want on the Internet and pay for it there and then. I could probably list off half a dozen different ways to pay someone some money. I bought my last house without seeing a soul (apart from the estate agent).

And yet, despite all that, our financial system seems very antiquated. I still have a pocketful of change and a wallet full of paper money. If I go to a different country, I need to change those coins and notes for different ones. I have a number of plastic cards, each with their own provider, credit limit and statements. I probably have accounts with dozens of institutions, from Amazon and eBay, through to utility companies and banks.

If I want to work out exactly where I am with everything, it’s up to me to collate all the information and do so. I can’t wait for the day when all I carry is my phone and I’m able to see everything about my finances in one place without breaking sweat. Maybe one day.

There’s no excuse for a crap presentation

Microsoft PowerPoint

Microsoft PowerPoint (Photo credit: Wikipedia)

It’s a fact of life that anyone who works in any kind of professional environment has a lifetime of powerpoint presentations ahead of them.

Some of them will be really good. Unfortunately, these will be in a minority. Most of them will be average and some of them will be absolutely atrocious. We forget the mediocre in a heartbeat, but the atrocious and the very best will stick in our minds.

There are many reasons for giving a powerpoint presentation. Some are given to inspire people. Some are to explain concepts or teach people. Some are to make people laugh. What they all have in common is communication. If you want people to remember your performance, you need to be either very good or very bad. The only way to get people to remember what you said is to be among the best – no pressure then.

The first thing to think about is the structure of your presentation. A lack of structure is one of the main reasons for poor presentations. If you don’t know what you want to say or how you want to say it, how on earth will your audience grasp your point. Remembering a poorly structured presentation is hard and difficult to prepare. You are also more likely to overrun or under run your time slot.

People like stories, so a structure that tells the audience where we are today, where we want to get to, how we’re going to get there and what it will be like at the end of a journey will naturally appeal. Another structure that works well is to tell them what you’re going to tell them, then tell them, then tell them again. Then there is the old favourite that follows the PREP acronym; make your (P)oint, give them the (R)eason for the point, then show them the (E)vidence and then remake your (P)oint.

The exact structure you choose doesn’t matter so much as long as you’ve got one and it suits your subject material. As a rule of thumb, I spend most of my time thinking about the structure and what I want to say.

Then you will need some slides. I’m fairly anal about slides. I try to keep text to a minimum and I have a special hatred for bullet points. Words are for manuscripts and blog posts, pictures are for presentations. Every slide should communicate a single concept. Once you have a concept – a Google image search or a chart should be enough to get that concept across. In the later versions of powerpoint, you can even recolour your images so that they all match.

Once you have your slide deck, go through it a few times. I guarantee you’ll see some mistakes. You will also see the best place to break up your presentation with some chapter heading slides. There will also be the occasional slide that appears in the wrong place. A good few passes through remove any howlers and to make the deck flow better.

Then practise. I’m not wildly passionate about practise because if you overdo it, you will lose any spontaneity. The first thing I do is go through the deck and count how many slides are in each section. I write out each slide title and write a bubble around each section of slides with the count next door. So for example, my list might look like this;

  • Intro (4 slides)
  • Where are we now (5 slides)
  • Where do we want to be (4 slides)
  • How we’re going to get there (6 slides)
  • What will it be like (3 slides)
  • Conclusion (3 slides)

I run through that a few times until I can write the section / slide counts out from memory. I then learn the slides at the end of every section so that I’m never taken by surprise when I switch from one chapter to another. Once you can remember that much, it’s only a short leap to being able to write out your entire 25 slide deck from memory.

If you can do that, the presentation itself will be a breeze.

I wish I had a computer like they do in the movies

Jurassic Park (film)

Jurassic Park (film) (Photo credit: Wikipedia)

Depictions of technology in films and TV always make me either cringe or laugh out loud. Either they are so completely antiquated in their depiction or they exhibit properties so advanced that we can only dream of being able to do the same thing. I do feel sorry for the film directors because an awful lot of technology is fairly dull to look at. If you have a whole scene that revolves around your protagonist doing stuff on a computer, it’s going to look very dull indeed unless you spice it up somehow.

Sometimes the film makers do this by making the machine’s display ridiculously frenetic or by making the machine make noises. Often, they go completely over the top and exaggerate what today’s computers are capable of. How many times have you seen a computer which scrolls the characters onto the screen one at a time with a beep accompanying every letter? What about when a particularly grainy satellite image appears and someone says “enhance” and the machine crunches away, the pixels sharpen, the image zooms in and suddenly we can read the exact brand of cigarettes the bad guys smokes.

If someone wants to hack into a system in real life, they spend a long time cracking the defences of the target network. They might use social engineering techniques to unlock an initial chink in the armour. They might perform exacting research into who set up the security. They probably network with other individuals to share ideas. In short, it takes a fair amount of time and what appears on the screen is boring, mundane text. It’s not particularly cinematographic so I guess you can forgive the film makers for trying to jazz things up, but bars slamming shut across the screen or skull and crossbones appearing with some cheesy phrase seem faintly ridiculous.

Here are some of my favourite films and some of their technological howlers;

1. Superman IIIRichard Pryor steals the pence from every transaction in his bank’s computer system. This one touches my heart, probably because I work for a banking software company. He manages to hack into the system by typing the command “OVERRIDE ALL SECURITY”.

2. Independence Day – Jeff Goldblum and Will Smith fly into a really advanced alien spaceship and kill it with a virus. Really? I would have thought that such an advanced civilization might have come across that kind of threat before and don’t get me started on how Jeff Goldblum’s kit could just be plugged in – maybe the U in USB really is universal.

3. Jurassic Park – when our heroes discover that the whole computer system has been hacked by the resident nerdy programmer and locked up as tight as the velociraptor should have been, the young girl taps a few keys on the keyboard before uttering those immortal words “This is Unix, I know this”. She then proceeds to unlock everything in the blink of an eye.

4. Weird Science – two teenage kids create a beautiful woman in their bedrooms using their computer, a modem and a pair of bras on their heads. We have just about got 3D printing, let alone creating anything as complex as a woman!

I look forward to the day when our computers catch up with the movies.

 

Secrets

Paddington station, still a mainline station, ...

Paddington station, still a mainline station, was the London terminus of the Great Western Railway. (Photo credit: Wikipedia)

I have a deep, dark secret. I try to keep it quiet, but occasionally I make an almost involuntary utterance that gives the game away. It is a secret shared with my Dad. When Nan and Grandad were alive, we often used to stay with them.

One evening, Nan gave me a pile of books to read. They used to belong to my Dad. Most of them were unremarkable; the sort of reading material you might expect an adolescent boy to read. In among the smattering of comics and adventure books was the evidence that he shared my secret.

It was about an inch thick and the cover was missing. The binding and the pages showed signs of heavy use. Inside, every page was crammed with listings. I took a sharp intake of breath once I realised what they were. They were listings of locomotives. Many of them had been underlined in blue biro. My dad was a trainspotter. Swindon was a good place to be one because it was pretty much the heart of the Western railways. Many locomotives ended up there for maintenance, so there was a good chance of seeing a wide range of rolling stock.

I’m not a card-carrying, anorak wearing trainspotter, but I do like trains. Occasionally, when we are doing the crossword, I let on that I know that the foldy thing on top of the train that connects to the power lines is a pantograph and that an electric train made up of a small number of motorised carriages is called an EMU (or Electric Multiple Unit). There is a diesel equivalent too, but DMU is not a word.

Sometimes I can’t help myself. Before I know it, I tell people that the train gauge in the UK is 4 feet 8 and a half inches because of Stephenson, but if Isambard Kingdom Brunel had won the gauge wars, our trains would be bigger, faster and more comfortable because the gauge would have been 7 feet and a quarter-inch.

At its peak, the UK’s railway network had 37,000 kilometres of track. It must have been fantastic to have the freedom to travel from almost any town in the country to almost any other and trains used to always be on time. Thanks mainly to the axe of Dr Richard Beeching, today we have about 16,000 kilometres.

For reasons that make sense to someone, we have a separate company responsible for track and train operating companies responsible for trains. Our trains are the most expensive in Europe and they seldom run on time.

I guess that’s progress, but I still like trains. Just don’t tell anyone.

In the cloud

IBM Cloud Computing

IBM Cloud Computing (Photo credit: IvanWalsh.com)

One of the more interesting areas I have been lucky enough to work with is cloud. We run some banks live in the public cloud. The scale of the cloud offerings is simply staggering. There are three main big players; Microsoft, Google & Amazon. Between them, they bought 31% of the world’s CPUs in the last two years and Microsoft alone is pumping a billion dollars a year into the initiative.

I was surprised to learn that the datacenters that make up the cloud are not stocked with the latest generation machines, because slightly older stock makes much more sense on a dollar per CPU cycle basis. Also, the economics are quite surprising. CPU power accounts for less than 1% of the overall cost of the data centre. Between 50 – 90% of power that feeds into the datacenter is eaten up by lighting, cooling, transforming etc. and a sizable proportion is taken up by the storage arrays.

Siting the datacenters is extremely important. The first consideration is power. You need a lot of it and it needs to be reliable & cheap. You also need good internet links. There’s no point siting your fledgling data centre next to a nice shiny power station if people can’t connect into it. Climate is another consideration. Obviously, the hotter the country, the more your cooling costs will be. The last consideration is security. Obviously, the more the customer base builds up, the more attractive a cloud data centre becomes as a terrorist target. The ideal site for datacenters is Iceland. The climate is cool, there is plenty of cheap geothermal energy and all transatlantic internet links pass through Iceland. The UK is a very expensive place for a datacenter due to high land and labour costs.

The datacentres are populated using pre-fabricated containers containing 5,000 CPUs in readymade racks, preconfigured with storage. When the container is delivered, they plug in power, network & water (for cooling) and the container starts initializing. Not all the servers in the container can start up at the same time as the thing would melt, so they start up in waves equally spaced around the container. A typical datacenter will have many of these containers with typically 2 – 3 being added every week.

With this many machines, hardware failure is a fact of life. Anything up to a 3% failure rate is business as usual. If the failure rate hits 10%, the machine vendor dials in and performs remote diagnostics on the container. If the failure rate hits 30%, the machine vendor sends out an engineer to inspect the container and perform any remedial action necessary. If the failure rate hits 50%, the container is powered down and replaced.

I was surprised by how flexible the Azure cloud is. There are three ways you can use it. The first is what they call the “web role”, which allows any kind of web-based activity (web pages, active server pages, web services etc). The second is what they call the “worker role” which allows you to do pretty much anything providing the software you want to run does not require installation (i.e. it can be copied across) and does not need to access the registry.

There were big challenges to overcome. Because you never really know which machine your application is running on or where your data is, it gives regulators a heart attack. There is also the fact that the database is what they call “eventually consistent”. Because your data is spread around and copied onto different machines, there is no real backup as we would normally consider it. You can back up your data to a local backup, but if your database is big, you may want to take advantage of the service they offer whereby they post you a tape once a day. There is no such thing as a printer connected to the cloud so if you want a hard copy of anything, you have to get creative.

The costs of a cloud based solution are *very* compelling, especially when you consider that you are effectively getting a fully managed, fault tolerant data centre. There are a number of pricing options depending on how much you want to commit to. There is everything from pay as you go, right through to volume licensing. If I had my way, I’d put every server in the cloud.

 

What’s the time Mr Wolf?

Railroad watch

Railroad watch (Photo credit: mpclemens)

I could never spend a large amount of money on a watch. To me, they are utilitarian devices that I can consult during the day to see where I’m supposed to be. That doesn’t mean I attach no importance to my timepiece. If I manage to walk out of the house in the morning without putting it on, I know I’m doomed to a day of looking at my bare wrist in a reflex action that’s very hard to shake. Of course, now I also carry a mobile phone. This device can tell me the time perfectly adequately, so why haven’t I consigned my analog wrist mounted device to the scrap-heap?

There is a certain amount of sentimentality as my mum gave me my current timepiece, but if I’m honest with myself, that’s not the only reason. Firstly, I have to fish my phone out of whichever pocket its hiding in. When I look at the digital numbers on the face of my mobile phone, my brain has to mentally convert these glowing figures into the analog constructs I’m used to. I don’t know how many times I look at my watch in a day, but probably enough to consider it too much of a faff to replace with my phone.

My first ever watch was a wind up affair. It came with a dour warning about the dangers of overwinding the mechanism lest the delicate clockwork parts inside break. I remember going into school one January morning and being confronted with the first digital watches. No need to wind these up, they’re battery-powered. Look, my one’s got a light so you can tell the time in the dark. If you press this button, you can see the date. One of them even had a tiny calculator built into the face of the watch with a miniscule keypad containing the buttons.

As a sucker for anything new, I found myself drawn to the dark side. The promise of no winding. The snazzy features. Being able to tell the time in the dark. But after a few minutes of playing, I decided that the new devices had significant drawbacks. The displays, being dark grey on a grey background, were difficult to read. The minute buttons were so small and hard that keeping them depressed for any length of time hurt your finger. The absolute worst thing about them was their appearance. They lacked the simple elegance of the analog face. In its place was a cheap looking display with all the charm of a cold, wet fish.

If the rumours are to be believed, Apple are about to release a watch. I’m sure it will be amazing and packed with multimedia features. No doubt it will be very successful, just like all their other recent inventions. Just so long as they don’t forget the fundamental purpose of a timepiece. When I look at my wrist, before I want a multimedia extravaganza, I want to know the time.

Hands off, that’s mine!

A man protests Digital Rights Management in Bo...

A man protests Digital Rights Management in Boston, USA as part of the DefectiveByDesign.org campaign of the Free Software Foundation. (Photo credit: Wikipedia)

There is a saying in England that possession is nine tenths of the law. Today where we live surrounded by consumerism, ownership has become a very important concept. Whether we like it or not, society almost defines us by what we own. Against this backdrop, it seems bizarre that these days, ownership of many things has become a good deal more ephemeral.

My first experience of gainful employment was a paper round. I worked 7 days a week lugging around a paper bag that, at the outset of my round at least, weighed almost as much as I did. The worst day was Sunday where newspapers ballooned to 6 or 7 times the size thanks to all the supplements that came for free. The first thing I did when I got paid was head down to town where I foolishly blew my first week’s wages on some records.

My mum was less than impressed with my new acquisitions. She wanted to know what I was going to do for the rest of the week with no money. To me, the answer was obvious, listen to Dire Straits and Bananarama. I had no money the week before when I didn’t have a paper round, so I didn’t appreciate why it was so bad to have no money this week.

I feel sorry for the poor sod who has inherited my paper round today. Not only are the newspapers twice as big as they were, but when he foolishly blows his wages on music, the chances are that he won’t even own the titles he chooses. He will hand over his hard earned wages to some dot com or another in exchange for a license. OK, so that license will allow him to listen to his music. It won’t, however, allow him to lend his music to his friends. He won’t be able to sell it on, nor will he be able to leave it to his kids. In short, he never owns anything.

I have a number of books, but I have even more in electronic format. Most of these titles are protected by digital rights management software. Because I am a big fan of one particular publisher, more of my titles come from that company than any other. A few years ago, that company decided to exit from the electronic publishing industry, taking all their titles with it.

Suddenly, all my eBooks disappeared. Without apology or refund, the company rescinded my access to those titles I know and love. I checked the license terms and they were quite within their rights to do so. If you are going to put a button labelled “buy now” next to some kind of electronic product or another, then give me what you are advertising. Otherwise, the wording should be changed to “license now temporarily with limited rights”.

Four eyes, four eyes!

English: Eye with a contact lens (myopia).

English: Eye with a contact lens (myopia). (Photo credit: Wikipedia)

Schoolchildren can sniff out weakness at 20 paces. It doesn’t matter whether you have crooked teeth, ginger hair or a slightly rotund midriff. Once they smell blood, they go in for the kill. Call it taking the Michael or extracting the urine, such teasing to a small child can be mortally wounding. Of course, once you’re older, such behaviour doesn’t tend to wound so much.

I wore spectacles from an early age. Because my prescription changed every 6 months, it made no sense to spend a huge amount on any eye correction I wore, so I suffered the ignominy of National Health glasses. These were spectacles provided by the state for those who couldn’t afford to pay for fashionable eye correction.

By necessity, they were cheap. There was only one design which came in chunky plastic. You could choose between brown, black and a kind of tortoiseshell colour. In the rough and tumble of childhood play, broken glasses became a fact of life. Mum or Dad would carry out makeshift repairs using sellotape or superglue. When I started wearing them, the lenses were like milk bottles, fashioned from thick, heavy glass.

Thank goodness, over time the manufacturers turned to plastic which cut down the weight significantly. In addition, they worked out how to make the lenses much thinner. The bridge of my nose was grateful for both developments.

Several people (including Da Vinci and Descartes) dreamed up concepts for contact lenses, but it was 1949 before someone came up with a design that was bearable for any period of time. The original lenses did not allow oxygen through to the eye which led to all sorts of nasty side effects. Over the coming decades, more sophisticated, comfortable and safer designs were developed.

As soon as I started work, I sought freedom from the spectacles I’d been shackled to. I happily wore contact lenses for a number of years, before my laziness overcame my vanity. I don’t miss all the faffing around. I do miss the ability to see in the rain or to have a clear view when coming in from the cold.

So every 2-3 years, I spend the equivalent to a top of the range iPad on new spectacles. If only on economic grounds, if I was brave enough, I should invest in laser eye surgery. Developed in the 80’s from IBM technology, it was Dr Stephen Trokel who pioneered and applied the excimer laser in a ground-breaking procedure. The idea of burning away bits of my eye to sculpt the perfect lens sounds like it would be difficult to fix if they got it wrong.

One day, a quick injection of stem cells or the insertion of some nano-technology that adapts to your exact correction requirements will be safe, pain and error free. Call me a coward, but I think I’ll wait.