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.

11 thoughts on “Choosing a Programming Language

  1. I would have enjoyed this much more if you had toned it down a bit and provided some evidence to back up your opinions. To be blunt, this reads as just a bunch of opinions from someone who considers themselves more of an expert than the article implies. Very little substance, lots of noise.

    I also think it starts on a false premise – my point of view is that a decent programmer should be able to craft an elegant solution with any tool. Equally – a muppet can write nasty code using the most elegant tool.

    Next time I suggest you identify a couple of key points that you want to get across, write the article and then decide if it is was worth it. TL;DR? ‘pretend to offer a review of programming languages, slag off Scala, slag off Java, suggest using the last tool you used anyway’. Not sure it is was worth it.

    All power to you my friend, I haven’t blogged in years :)

    1. Normally I wait a week or more after writing an article to give me chance to tone down the language and present a more considered viewpoint. However, since this was a rant, I decided to publish and be damned :)

      I make no pretense that this is in anyway a useful contribution to what is an important topic, merely my anger at the fashion which drives such important decisions. I may make a follow up post that is more considered as this is a massively important topic.

  2. I’ll try not to take the flame bait and instead bring up reasonable discussion points, but I make no promises. This is the internet, after all.

    > Last time I checked, their turing complete language had the same problem solving capacity as my turing complete language.

    Turing completeness only guarantees that two programs are equivalent _given sufficient storage space and time_. There are many practical applications where this level of equivalence is not acceptable.

    > If the problem you’re solving involves handling lots of XML and you like stack traces: sure, use Java.

    Out of curiosity, why did you choose to exclude C# here? I was under the impression that C# actually made working with XML easier than in Java, especially with the LINQ extensions.

    > Or maybe you really hate yourself and you want a compromise: why choose functional or procedural when you can have both?

    The previous section, “right tool, right job”, seems to suggest that every problem can classified into a distinct category, that there are not problems in the blurry areas between the categories that might benefit from some attributes of both. If your application has some scripting parts, some algorithmically complex parts, and some “data in, data out” parts, what do you do? Force Java into every role? Use a different language for each part? Or use a hybrid language that can support both the roles of OO and functional languages?

    > The best thing with Java, is it stops all the ninja rockstars from showing how ninja they are by writing undecipherable crap.

    I don’t buy this argument at all. I might buy the argument “Java makes it easier to write idiomatic code”, but there are plenty of examples of undecipherable Java code. Bad design isn’t language specific; it can be done in _any_ language.

    > I only need one developer, I want her to be the best I can hire – it makes no difference where the average is.

    This assumes that the best person in the set of candidates is even a feasible person to hire – that they’re willing to work for you under some given set of circumstances (location, pay, etc) and that you’ve actually made _contact_ with the “best” candidate. Of course, from the pool of people you _see and can hire_ you’ll try to pick the best candidate, but a better overall quality distribution can help compensate for factors outside your control which can eliminate good candidates.

    > Language has no correlation with ability: I’ve met some very smart Java developers, and some truly terrible hipster developers.

    I think you’re mistaking correlation with causation here. Correlation between language and ability does _not_ suggest that using a particular language will make you a better programmer _or_ that developers of a particular caliber will necessarily use a given language. All it suggests is that there is _some_ relationship, which may be incidental, between the two features. Asserting that there is no correlation directly contradicts your statement in the last paragraph “Maybe the average quality of the pool will be higher”. This implies a relationship between the two.

    > 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.

    You could have said the same thing about Fortran, C, and Cobol not all that long ago. These languages were, for a time, the lingua franca, but that’s a moving target. Using a language just because it’s the most commonly used now is just as ignorant and picking up a brand new language for use in a production system.

    > 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

    What happened to “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.”?

    > 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.

    From what I’ve been able to gather from the article, you include Node.js, Rails, and Clojure in the list of “hipster languages”. JavaScript, Ruby, and Clojure _all_ have fantastic open source communities comparable to Java. Moreover, languages hosted on existing runtimes, like Clojure on the JVM, have the ability to use existing libraries from their host languages.

    Warning: This is where the flame bait really hit me

    > Or, if you’re a hipster, you use the latest super cool language.
    > Now the hipsters are trying to tell me how awesome their nodes are. Or that clojures are where its at.
    > 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’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
    > 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.
    > 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.
    > 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.
    > 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.
    > 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.

    You start out by relating the ideas of “hipster” and “using emerging technologies”, which is pretty reasonable. But as the article goes on, you start associating “hipsters” with people that solve shit problems, help satisfy the quota of morons, and decree that every language/platform other than Java and C# are “varying degrees of hipster.” You’ve taken a legitimate topic, the choice of programming language, and a discussion with legitimate talking points, like “using the right tool” and “how language choice effects hiring”, and devolved it into bashing new technologies, the people that create them, and the community that supports them. You talk about Scala derisively while barely touching on the reason why, draw conclusions without providing any qualitative or quantitative arguments, and never really address the final point made in your introduction – that while alternative languages might give the developer more expressive power (and thus impact development and maintenance costs), they are still fundamentally all capable of the same tasks.

    This kind of language does not promote useful conversation.

    1. Thanks for the very careful and considered reply, probably more than my ranty post deserved!

      I agree the article ends up becoming a pointless rant against a language I don’t know as well as I ought to (Scala) – but I only use it as an example of how people are migrating from well established languages (primarily C#/C++ and Java) to a multitude of other languages (node, ruby, clojure amongst dozens of others). My main gripe, untouched on in the article really, is *why*? I’ve heard the argument that language X is more expressive / faster / cheaper to develop than language Y – but besides a gut instinct where’s the evidence? This is why I don’t like the hipster attitude, that all the cool kids are using language X so it *must* be better. There is no way to tell, in any meaningful way, whether a language is actually better or worse – so it all comes down to opinion and fashion; which is frankly a ridiculous way for the industry to progress.

      For sure, experience of “non-mainstream” languages is a good indicator of a good developer. It shows an interest in the subject and a desire to learn, and often the motivation to learn in their spare time – all great indicators of a potentially good hire. But would I hire someone *solely* because they’re a fortran developer? God, no. I guess what I didn’t express clearly is that experience of alternative languages is an indicator of a good developer, but the reverse certainly isn’t true. I know great developers who only know C and Java.

      1. Thanks for not taking my response as trolling. The topic is legitimately fascinating to me, which is why I was so excited when I saw your post’s title pop up during my browsing today.

        In the end, I think you’re right; there’s not a lot of evidence supporting the move from well established languages, beyond the critical mass of discontent that seems to be sweeping the developer community. As you yourself said in the post, Java just plain feels *old* at this point, and simply tacking on new features is not a way to fix it. What it’s missing, I think, is a set of principles to drive it’s progress.

        This, I think, is the value I see in languages like Clojure, Haskell, and Scala. Scala is, in many ways, very complicated, but it is usually easy to see how the various complexities trace back to it’s two core goals: to unify functional and OO programming, and to provide all of the tools needed to scale from small to large scale applications. Java is, in many ways, an 80% language. The type system is good enough to model basic type hierarchies, but struggles with higher-order types. Generics are for the most part good enough, but are limited in terms of runtime information and bounds. That’s not to say that every successful language needs to have all (or even any) of these features, but the language must treat these topics consistently, and the motivation for their design should be clear. I think this is what Java has been lacking in the last few years, and why there’s been such a strong interest in alternative languages.

      2. I think you hit the nail on the head: Java feels *old*. Everyone is scratching around looking for the next generation of language. We’ve had the Java/C# generation – what, if anything, will be the next big language movement? Or maybe we are moving to a genuinely polyglot world where we can’t decide or agree.

  3. As a guy who hacks a lot in Python, C# and Java I don’t think Lambdas are half as great as people make out. Why? Well, because a lambda is more or less a way of writing a nested function using a syntax completely alien to the rest of the language. While I think LINQ is very readable, I don’t agree
    x=>x * x
    is better than:
    def sq(x):
    return x * x

    This is of course a very simple example, but anyone who has dealt with a sufficiently complex lambda knows what readability can be like. People treat lambda expressions like some great goodie the functional guys have and we all want. I’m not advocating adding nested functions to Java or C#, but they work great in StandardML (Which is functional) and Python (Which is not, but can do the good stuff).

    When I realised I could nest functions in Python I was really happy, because now I could write pythonic code that looked like the rest of my code and was more readable with the scope that particular function deserved.

    I’m happy Java is getting lambdas though, because I hate inner classes with a passion.

    1. Quite right! I think languages benefit from a deferred execution syntax – but lambdas, certainly in C#, feel alien to the rest of the language. I’m not familiar with nested functions, I think I ought to be. Unfortunately though, these toys can be so badly abused that it’s hard to know whether the syntactic sugar they provide is worth it. But inner classes truly are satan’s spawn.

      1. They are as simple as having functions within functions, that only the container function can see. They’re great when used correctly, but I will admit that I’d prefer to see 4 lambdas nested together than 4 properly indented nested functions.
        But then again, if you did see that, it makes it more obvious that it’s a code smell and should be abstracted to it’s own class, when something like:

        public String getComplexFunctionResult(int x){
        return OverallResult(someOtherFunction(AndAnother(AndOneMore(x))));
        }

        which is usually a sign of great function decomposition and is as readable as your method naming skills in Java :)

        So yeah, after thinking about, nested methods in Java would actually be good, because if they were being abused bugs would be easier to notice, because they’re just plain old methods.

  4. Volker

    “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.”

    I don’t actually disagree with the core of the article, I do want to make a point of contention here though.

    These two are not mutually exclusive. There’s plenty of companies who solve difficult problems in “hipster” languages.

    But I don’t think people who want to work for companies that support their language of preference is retarded. If I got an offer from a primarily Chinese company with little to no support for English speakers, I might consider it if the pay and benefits compensated for having to learn Chinese, but I’d rightly have a preference for an English speaking company because my ability to express myself, solve problems, and interact with people is best in English.
    A programming language is no different in this respect.

    You even bring up this point yourself, that this retraining is a major expense in time and productivity for the employer, but ALSO the employee.

    So I think this is a symptom of people simply wanting to receive a return on the investment of the precious free-time they spent learning the skill(whether they should have is an entirely different argument).

    If they turn down a really well paying position that’s like 2x their “hipster” language then yeah…that’s probably dumb. But if the offers are comparable then they can do their best work with their hipster language.

    1. Absolutely right – all other things being equal I’d rather work in my favoured language than, say, cobol. I was only railing against the people who either don’t know or refuse to work in Java/C# and only want to work in marginal languages “because its cool”. Although the language we work in is important, I’d much rather have interesting problems to solve. Now, interesting problems to solve in an interesting environment – that sounds like a pretty good gig to me!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s