I’m not a professional programmer, Pookah, but layperson to layperson, I figure I’d tackle the explanation of how some computer languages might be better at certain tasks than others. I’m sure the coders here will correct me where I’m wrong, or provide concrete examples where I’m just giving vague generalities.
When you are running a webserver that helps thousands of visitors per second, you want a language capable of handling multiple simultaneous users discretely, one which uses a minimum of run-time and memory space, and one which effectively keeps users restricted only to the parts of the information they’re entitled to. To keep the server’s resource consumption to a minimum, you’d use a language lightweight and nimble enough to process its script quickly.
When you are running a stand-alone program on a computer (a game, for instance, or a word processor) you have the entire computer to yourself, so it needn’t be small or nimble, necessarily. What you want here is that the program be robust: powerful enough to handle what users want, and secure enough that the users can’t foul it up with a few unthinking mouse clicks.
Some languages enable you to define certain terms or objects or functions or processes that you plan to repeat a lot. You might say: “Computer, I want to build a blueprint for all the buttons on this program. They’ll all be round and gray and when you click 'em, they’ll play click.noise. They’ll have text in 'em that’s in Palatino Bold 12 point and they’ll be 40 pixels tall.” Later, you tell the computer, “Okay, I want four Buttons here, just like I said before. One will say OKAY, one will say CANCEL, one will say BACK, one will say HELP.” The computer can then apply the blueprint Button to each instance of that blueprint that you create. You might then want to create a class of items called RedButton, and you say, “Computer, this will be exactly like Button, except it’ll be red.” You can then create some instances of RedButton objects which have the same traits as your blueprint. This kind of computer language is useful for specific kinds of data handling, but not all kinds.
Another language might be particularly good at dissecting strings of text. Your job might be to typeset someone’s manuscript, and you want to go through it and find every “…” that you can and replace it with “. . .” instead, except that when you find “…” you want to leave it completely alone. A text-parsing language would be easiest here, because it has commands written that do exactly this. In another language you might have to program a routine from scratch that will perform this same function.
Another language might excel at handling multiple users. Such a language might give every user a particular level of security, and built into that language is some kind of permission scheme: you can’t get into /secrets/stuff/passwords directory because you don’t have access! Before access is granted, the computer checks who is doing the asking and if it’s okay to tell them. Other languages may not have this feature built in and the programmer must build the security permissions manually.
Last, there are various ways that languages can execute. One is line-by-line, in order, starting at the top. For instance, written in pseudocode:
check recipe
if recipe.needs-sugar then import sugar
if recipe.needs-eggs then import eggs
if recipe.needs-flour then import flour
if recipe.needs-salt then import salt
if recipe.stove-temperature > 0 then openburner = getopenburner(stove) and
set openburner = recipe.stove-temperature
In this program, the computer executes all the lines of code even if you’re making cold cereal. Some languages are slightly more efficient: once they figure out that the recipe does not need sugar, they skip to the next line (because everything after that is irrelevant).
A different language may handle it this way, again in pseudocode:
blueprint for Recipe:
All recipies will have a list of ingredients called list-of-ingredients.
All recipies will say true/false if they need to be cooked, a
variable called is-stove-on.
All recipies will have cooking-temp and cooking-time variables.
end Recipe
cereal = a Recipe
list-of-ingredients [captain_crunch, milk]
is-stove-on = false
cooking-temp = 0
cooking-time = 0
end cereal
friedeggs = a Recipe
list-of-ingredients [eggs, salt]
is-stove-on = true
cooking temp = Medium
cooking-time = 360
end friedeggs
Main:
check recipe
what-we-need = get list-of-ingredients(cereal)
import what-we-need
if is-stove-on(cereal) then setstove(cereal.cooking-temp)
cook-for(cereal.cooking-time)
eat!
end Main
In this style of writing, it can be slightly more efficient because the “fried eggs” part won’t actually run unless it is called upon to do so. It has been defined but the computer need never actually execute that code until it’s needed.