Choosing a Programming Language

What programming language to use is probably the single biggest technical decision facing a project. That one decision, affects every one that follows – from the frameworks and libraries you can use, to the people you hire. So how do you go about choosing what programming language to use?

The truth is, you probably do what most people do and use the same language you used on your last project. Or, if you’re a hipster, you use the latest super cool language. A couple of years ago all the cool kids were on rails. Now the hipsters are trying to tell me how awesome their nodes are. Or that clojures are where its at. Last time I checked, their turing complete language had the same problem solving capacity as my turing complete language. Really what they’re arguing is their language gives them better expressive power: it’s faster to write and/or cheaper to maintain.

Right tool, right job

As the old adage goes: always use the right tool for the job. If you need to automate some command line maintenance task – use a language that’s good at shell scripting: bash, perl, hell even ruby; don’t use Java. If the problem you’re solving needs a desktop client that integrates seamlessly in a Windows environment: use C#, don’t use Java (be quiet Java on the desktop fanboys, just be quiet). If the problem you’re solving involves handling lots of XML and you like stack traces: sure, use Java.

The biggest distinction normally comes down to algorithmic complexity. If what you’re working on has a lot of algorithmic complexity, use something that’s good at expressing it: a functional language, like haskell or F#. Or if, like 90% of webapps, what you’re doing is data in, data out you need a language with good OO power to try and model your domain: Java and C# are both good choices here, along with almost every other modern language out there.

Scala

Or maybe you really hate yourself and you want a compromise: why choose functional or procedural when you can have both? Why miss out on every language feature thought of over the last 50 years when you can have them all, baked into one mess of a language? Yes, if that sounds like you, you probably think you’re a hipster but you actually missed the boat by several years: its time to learn you some scalas.

I suspect part of the reason Scala is gaining so much popularity is that it finally gives all the frustrated Java devs the language toys they’ve always wanted. Java really is an unbelievably retarded language now, it’s incredibly frustrating to work in. As someone that’s just switched to C#, I’ve relished all the new language gadgets and geegaws I’ve got to play with. Have they made the code any better? With lots of toys comes lots of complexity and variety, making code hard to understand and hard to maintain.

The thing is, Java is a toy language: any idiot can write decent idiomatic Java. The trouble is, Java is a toy language: everyone is forced to write screeds of noddy idiomatic, idiotic Java, no matter how much of a ninja rockstar they are. The best thing with Java, is it stops all the ninja rockstars from showing how ninja they are by writing undecipherable crap. I fear the impact lambdas will have on the maintainability of the average Java codebase as everyone starts finding new and confusing ways to express everything.

Hiring

Another reason to choose the right programming language, is it affects the developers you can hire. But does it really? I work in a C# shop now, do I turn down Java developers? Hell no. A good developer is a good developer, regardless of the language. To dismiss potential recruits because of the language they know is retarded.

And the trouble is, if you think that hiring only python or node developers will get you a better standard of developer: you’re wrong. The pool will simply be much smaller. Maybe the average quality of that pool will be higher, who knows, who cares? I only need one developer, I want her to be the best I can hire – it makes no difference where the average is.

Language has no correlation with ability: I’ve met some very smart Java developers, and some truly terrible hipster developers. I’d rather cast the widest possible net and hire good developers who are happy to use the technologies we use. To do anything else is to limit the pool of talent I can draw from; which, lets be honest, is pretty limited already.

Another argument I’ve heard is that the technologies you use will limit candidates willing to work for you – some developers only want to work in, say, clojure. Well, they’re retarded then. I’d rather have people who want to work on interesting problems, regardless of the language, than people who would rather solve shit problems in the latest hipster language. Now if you work for a bank, and all you have are shit problems? Sure, go ahead and use a hipster language if it helps you hire your quota of morons. If nothing else it keeps them away from me.

Lingua Franca

Take a room full of hipster language programmers and ask them to form teams. What happens? Magically, you’ve now got a room full of C# and Java developers. Almost every developer will know at least one of these two languages – they are the lingua franca. Everything else is frankly varying degrees of hipster.

The truth is the most important thing when choosing a language is how many developers on your team, and those you plan on hiring, already know the language. If everyone on the team has to retrain into say, smalltalk; and everyone you hire needs hand holding while they learn the new language – that’s a cost you have to factor in. What’s the benefit you’re getting from it?

Secondly, how easy is it to get support when you hit problems? The open source community around Java is awesome – if you’ve got a problem, there will already be 15 different solutions, some of which even work. If you work in C#, your choices are more limited – but there will be choices, some of which aren’t even from Microsoft. If you’re working in the latest hipster language, guess what? You’re on your own. For some people that’s the draw of hipster languages. For those of us wanting to get work done, it’s just a pain.

In the end, the best advice is probably to use the same language you used on your last project: everybody already knows it and your tooling is already setup around it. This is why Java has quickly become the new cobol.

The Economics of Car Rental

We’re flying back to the UK for a week later this month, so once again we’re forced to rent a car. Both sets of parents live too far from public transport for it to be a realistic option, even assuming the trains in the UK break the habit of a lifetime and work for a change. (Rail replacement bus service? What sadistic bastard thought of that?)

It got me thinking about the outrageous cost of hiring a car for the week. To get a car large enough for the three of us and all our luggage (who knew we needed to take a kitchen sink for a 1 week trip?), it will cost us over £200 for the week. I could practically buy a car more cost effectively than that… if only there was some way of everyone clubbing together to buy a car that you can drive when you need it. Scaled up, you’d have… a car rental company. Are they just ripping us off? Or does it plausibly cost that much to hire cars out? I made up some numbers to see if it would shed any light on the situation.

New price £24,000.00
Price @ 3 yrs £12,000.00
Annual running costs £2,000.00
Cost over 3 yrs £18,000.00

A fairly low-spec, family sized car would cost about £24,000 to buy brand new. Assuming you kept it for 3 years, and allowing for insurance and up-keep etc, I reckon you’d need to make about £6,000 a year to cover it. Is that a lot?

Annual cost £6,000.00
Average utilisation 50%
Min daily cost £32.97

Assuming the car is being used 50% of the time, you’d need to charge about £30/day to make your £6,000 a year back. Which works out about the same as I’m actually paying – so it’s probably not a million miles wide of the mark. Which is slightly depressing – unless you buy an older car, and risk spending more money on maintaining it and repairing it… it’s difficult to see how you could rent a car for less than they currently charge.

Although I’m hiring a car for the week, I don’t actually need the car for 7 full days of 24 hours. Maximum, I’ll probably be in the car for 12 hours across that week. If only there was a way that I could rent a car for an hour at a time? (Zipcar and the like only serve big cities, which is useless when you’re visiting the sticks)

Self-Driving Cars

Well, maybe this is where self-driving cars could massively change things. With a self-driving car, it wouldn’t matter that I’m parking up in the middle of nowhere. It can scoot itself off into the nearest city to continue ferrying people about. I’d only need to pay for the time I actually use it.

Annual cost £6,000.00
Average utilisation 25%
Min hourly cost £2.75

Obviously the utilisation would be lower (I can’t imagine many people will need carrying about in the middle of the night). But instead of paying £230 for a week’s car parking, I could instead pay £33 for 12 hours of driving. In theory, the car would still be paid for over three years – but the cost to individual users would be massively lower.

Not Just for Holidays

At those prices, could it even replace my main car?

Annual mileage 12000  miles
Average monthly mileage 1000  miles
Average speed 40  mph
Average monthly time 25  hours
Average monthly cost £68.68

If I was paying for the exact same car, to spend the bulk of it’s time parked outside my house, it would cost £500 per month. But renting it by the hour is a fraction of that. Of course, if everyone did this, you’d need a massive number of cars to cover the peak demand at rush hour – but the utilisation could drop to 5% and it would still be cheaper than owning the car outright. That’s each car in use for just over 1 hour each day, given that’s the average UK daily commute that seems easily achievable.

So, it’s 2013, I only have one question:

Where’s my goddamned self driving car?