[caption id="attachment_36" align="alignleft" width="300" caption="Photo from -bast-"][/caption]
While our aim in this blog is to be language-agnostic, obviously you do need to pick a language in which to write your software. In this and the next post, we're going to explore some of the considerations to selecting that language. Before starting a new project it is always worth thinking about the language in which it will be coded. A programming language is more than just a syntax, it is a way of thinking about, and phrasing, the problem and solution. Each programming language also brings with it a collection of libraries and tools, performance criteria, target platforms and a host of other pros and cons.
What languages do you already know?
You may already know a programming language. This can be very handy, because it means you won't have to spend time learning the basics of the language before you can start using it productively. However, because different languages differ in both their strengths and their weaknesses, it's a good idea to consider the problem you're attempting to solve and seeing if another language is a better fit.
For example: Matlab (a commercial language originally developed to do things like matrix mathematics) is a good choice if your project requires a lot of matrix manipulations. However, if the task involves a lot of nested FOR loops and no mathematical manipulations, Matlab may not be such a good choice (because its FOR loops are poorly optimised). In this case a compiled language such as C++ might be a better option.
The upside of using a language with which you're already experienced is that you don't have to spend time learning the basics. The downside may be that you're failing to use another, currently unfamiliar, language that would be better suited to the task. The cost-benefit analysis you have to make is whether your well-honed experience with Language A means you can produce a good solution more rapidly than if you switched to Language B, which is more appropriate to the task but you'd have to learn from scratch.
The platform, or platforms, that your program will be running on will have a large impact on the language you can use and the languages you can use will be determined by the compiler. If your target platform is a PC then you will have a wide choice of compilers and hence languages, but if you are using more specialized hardware then your options will probably be more limited. This is where mature and widely used languages are of most use as they, and their libraries, are more likely to be supported on the target platform. For instance, C and C++ have compilers that can target a wide range of hardware and, because of their wide support, have libraries that will work with this diverse hardware. The disadvantage of C/C++ is that they are compiled languages so if a different platform must be supported then the program must be recompiled. Java, on the other hand, runs on top of another program (called a virtual machine) which means if a Java Virtual Machine exists on another platform the program can work without being recompiled. However the performance of the program is strongly dependent on the quality of the Virtual Machine.
The financial cost of the development tools and the compiler will affect the choice of language. Microsoft make a very comprehensive IDE and associated development tool that, as you might expect, target the Windows environment. The cost of these tools varies depending on who you are (student, academic institution, non-profit organisation). At the other end of the spectrum the Open Source movement has provided a wide range of libraries, compilers, tools etc. that are 'free' to use. The word 'free' has several different interpretations and you must be careful as to which licenses apply.
Is there a project requirement?
Sometimes, there won't be a choice of language, because it will have already been decided. This decision may have come from a superior or collaborator. It may be the only sensible choice because you need to use some specialist libraries or tools, or you maybe joining an existing project with an extensive code base. This is all fine and in many ways makes your life easier as you don't have to make the decision! Even in this case, though, it's still well worth looking at the language in order to better understand it so that you can play to its strengths and avoid its weaknesses. After all, at this point you're stuck with it so you might as well go into the project with your eyes open.
After studying the current language and other potential candidates you may even think you can make a good case for choosing a different language. However, beware of the tendency to see only problems with the current language and only the advantages of a new language. It is also easy to underestimate the time it takes to become proficient at the new language, as well as ignoring that your productivity will be a lot lower until you've gained that proficiency. Remember, the grass isn't always greener on the other side of the fence. And on a non-technical note, the current language may well have been someone else's 'bright idea', so it would be no bad thing to give it due credit.
Someone to ask for help
Related to the previous criteria. Is there anyone who you can ask about the language if you get stuck? While it's a good principle to try to be self-sufficient about using a programming language, sometimes reading the manual and using Google aren't enough and simply having an expert to ask can be a metaphorical life-saver. So if everyone in your department uses Fortran, and the project is generally written in Fortran, you'll know people to ask if you also use Fortran.
These are some of the considerations when choosing a programming language for your project. In the next article, we'll look in more detail at whether a given language is appropriate for the task.
Choosing a programming language - Part 2