Bones' Blog of Stuff About Things

24 Jan

I’m Not a Fan of Compromise, and That Includes Java

In my job, I use Java. I don’t claim to be an expert in Java, as we certainly don’t use any language esoterica, and seeing as we don’t employ any of the J2EE frameworks and libraries that get classed as “knowing about Java”, I suspect that in most Java circles I would be considered a bit ignorant. Bearing this in mind, it could be argued that I’m not really qualified to criticise Java and if I were about to make an argument based on some comparison of specific language features or libraries I would entirely agree, but I’m not going to do that, I’m just going to explore why I, as someone comfortable with Java syntax and tools, never choose Java myself.

To me, Java is an unnecessary compromise. To contextualise that statement, I’m talking about its use for my own projects. In the world of work, the fact that people know about Java and feel safe putting some cash behind a project built on Java is a pragmatic reason for choosing it to use it, even if it doesn’t represent the best technical solution. It’s a proven language, with a wealth of tools and supporting structures in place and large numbers of developers available who are familiar with it. I can’t say I would expect anyone to spend much energy fighting the tide of opinion that a new project in a Java shop should be written in Java just like the last project, and I don’t in the one I’m in. When I get home though… when I think about a little (or big) project that I might like to do… well, Java doesn’t get a look in. Why? Well it’s not because of any great disadvantages, it’s because of it’s lack of great advantages. Again… to me.

When I start a project, I have a number of considerations that affect what language I’m going to use. I consider what general areas the project is going to encompass, networking, database access, windowed gui, command line high-speed graphics etc., I consider what platform I want to run it on, be that specific hardware, or OS, or a more abstract platform like the Web, I consider what level of computational performance I’m likely to need and I consider what sort of support I need in terms of advice, frameworks, libraries etc.. I consider these things amongst other issues and I choose the language that will provide what I need and allow me to get the job done most easily. The kicker is that despite the fact that I’ve been coding in Java as part of my working life for about 4 years now (and I was familiar with it already before that), it never wins out in this consideration.

I did imagine that I would sometimes use Java because it is cross-platform, but the reality is that so is Python, so is C with a bit of care. For most purposes, cross-platform compatibility is a matter of choosing your libs carefully and/or abstracting your own code from non-compatible interfaces. Java doesn’t really help immensely in most circumstances, because it’s either a case of compatibility being easy to achieve in any language, or its an area where it’s difficult (or at least some effort) in all languages and Java doesn’t make a lot of difference either way. If I was writing something where I needed to be concerned with the sort of low-level bit-twiddling that cross-platform C code sometimes involves then I imagine that twiddling would be indicative of other reasons why C was still the thing I wanted to be writing it in.

At one point I thought I would start to use Java for my own work because I wanted to stop writing in C/C++ so much and the number of libraries available for Java was a draw for speeding development up. Over the past six months though, I’ve seen that Python offers as much functionality and most of it seems far easier and quicker to use. Of course, Python is slower than Java, but if I want speed then I’ll write a Python extension in C, thanks very much or I’ll just use C from the start.

Perhaps I’m unusual in that I’m happy to write C or C++ and I’m happy to make the initial effort to learn a new language like Python, but I can’t help but feel that Java sits very much between these languages as a rather uncomfortable compromise. It’s a useful compromise, no doubt, and it does most things mostly well, but I have to wonder whether, if Java rose as a higher-level language than C used for ease of development and abstraction from the hardware, are its days are numbered as computing power renders the performance costs of even higher-level scripting languages like Python irrelevant for most purposes? If I want speed I go under Java and if I don’t need that speed then I go over it. I doubt I’m alone in this attitude and it seems a very sensible approach to take.

Leave a Reply

© 2012 Bones' Blog of Stuff About Things | Entries (RSS) and Comments (RSS)

GPS Reviews and news from GPS Gazettewordpress logo