Skip to content

Vergleichen Programmieren Sprachen?

I was first pointed to the Comparing of Programming Languages by the reffered article. Innermost I felt sympathy for the noble goal of short code, produced by a high-level programming language like Java or Python. But at daily work I was confronted with problems, insolvable using these high-level languages, but solvable by more machine-oriented PLs like C. That’s why just the length of code couldn’t be the only true criterion for PLs.

So, I thought, what else might be the noble goal? Some comments already showed, that concrete circumstances of a problem play an important role – thus, the question should be „[…]Choose a language in which your problem can be expressed most naturally[…]“.

But I still wasn’t pleased. So I had lively email-discussions with Steffen, and here are some comparing results:

character string
To get the length of a character string, you have two possibilities:
  1. You include the length of the character string expressly into the datatype (e.g. Java’s string). This method storages redundant information and that’s why you need on the one hand more memory, but have faster access to the string’s length on the other.
  2. You count the characters of your string (e.g. in C). This method needs some more time to get the right length, but it avoids the storage of redundant information. Very helpful if you have just a few bytes of memory, e.g. at an IC.
Most high-level PLs are so called object-oriented (oo). But did you know, that oo isn’t useful, if you want to cast your software-programms into real hardware? Why not? Very easy: in hardware all interconnections and all components must be known right from the compiling-time, not only from run-time!
Some PLs (e.g. C, C++) have a pre-processor, which is proceeded before the real processor. Its directives are frowned upon C++, but grandly used in C – especially if you have just a little scope on memory: the directives are nothing but textual substitution and replace constants.
bounds verification
Some PLs help programmers finding out-of-bounds violations by verifying these bounds permanently. It’s very comfortable and can help you to save time in case of errors. But some PLs don’t give a programmer this sort of aid: here programms can run faster, but the programmer himself has to keep an eye on probably violated array-bounds and the like …
virtual machines
„Modern“ PLs (e.g. Java) use a virtual machine (VM) in which the programm runs. This has a very nice advantage: code written once may run on every computer possessing such a VM – mostly. All other PLs have to be translated into machine-code by the correct compiler: correct for the according operating system (OS) and/or the according microcontroller. These compilings can be very confusing, especially if some compilers using different syntax or semantic. This is very likely for C: some compilers understand for (int i = 0; i < 100; i++) and for others you’ll have to declare the int i first: int i; for (i = 0; i < 100; i++). Very confusing …

So, I think, depending on what sort of problem you want to solve with a computer-programm, there exists a set of possible programming languages. And depending on the set of programming languages, a programmer should choose the best one by

  • production of shortest code,
  • clearness (i.e. readability),
  • maintainability (i.e. re-readability) and
  • personal preferences,

shouldn’t he?

Post a Comment

Your email is never published nor shared. Required fields are marked *