Choosing the language that you will code in is incredibly important—it can determine if a project succeeds or fails.
In this article, we will look at common requirements for projects and languages that would suit those projects.
When first starting a project, it is very easy to get carried away, but this will often result in a project that fails. Such mistakes that a lack of planning can result in include wasted learning time, incorrect designs, rebuilds, and even damage to parts. But one area in particular that is not usually given much attention is what programming language should be used!
Your next project may use a computer or microcontroller and therefore require programming so what language will you choose?
Many newbies will go online and Google questions like...
“What is the best language?”
“Is C better than Java?”
“What language should I learn?”
These questions, though valid, don't necessarily yield the right results when you're starting out. Why?
The answer is simple. Comparing languages like this is like comparing a hammer to a table saw. One tool will be good for hammering nails, while the other is good for cutting wood!
So which language should you use for a project? Below is a method for assessing your project's requirements to determine which language may be best for you.
To help decide on a language, you can use the chart below. Some of the most common languages are listed, showing benefits as well as areas that provide more difficulty.
The first task when deciding a language is to list out the major requirements of the project, followed by the minor requirements.
Then, using the chart, score each language on the chart against the project requirements, and the language with the highest score will most likely be the optimal language.
Seasoned programmers may know how to make a language work for them; this guide is for those who do not.
Programming Language Scoring
Processing speed: How fast the program will be executed
Readability: How difficult it will be to read code
Simplicity: How easy it will be to get working and use libraries
GUI: How easy it will be to get a GUI (graphical user interface) application running
Graphics (2D): Ease of using 2D graphics and its speed
Graphics (3D): Ease of using 3D graphics and its speed
Cross-platform: How easy it will be to run the program on different platforms (Windows, Mac)
Specialty processor: How useful the language will be on a device such as a microcontroller
Weighting Your Score Values
The most basic method for using the chart involves looking at your requirements and then scoring them to see which languages come out on top.
However, some requirements may be more important than others, which is why you may also want to add weight to the score values depending on the criteria importance.
For example, if processing speed is twice as important as readability, you would multiply processing speed scores by 2.
Note: Why does Python have a low readability score?
Some readers may be wondering why I have scored Python lower on readability than other languages. There is a reason for this!
Many coding languages use braces to section up code and have clear entrant points (such as main()). Python, however, does not, and this can make code look like blocks of text, which are much harder to read. Braces, in my opinion, clearly show a code block and semi-colons on the end of lines indicate that the code on that line is an instruction instead of a declaration or description. While Python prides itself on readability, readers should be aware that large Python programs can get tricky to read.
One last point on Python is the use of “self”. If you have ever coded classes in any other language then you will know where I am going here.
Basically, if a Python class object has variables that are specific to itself (such as an enemy’s health), it has to be referred to as self.health instead of health. This gets old very quickly, and many classes have large numbers of the word “self”, which makes it irritating (especially if you forget to include it).