I have often seen people fighting over that their favorite language is more "powerful" than others. When it comes to describing a programming language, I can understand what an object oriented language is or what a dynamic language is, but I still can't figure out what exactly a "powerful" language is. What are your thoughts?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
We can't define what a "powerful" language is without first defining the word "powerful."
The literal definition of power would be "potency", and I think we can all agree that the vast majority of compilers - and even many interpreters that aren't Turing-complete - do an equally good job of getting the processor to execute their instructions. So as far as the literal definition, the answer to the question would be "almost any language at all."
Practically, we really ought to stop there; defining a "powerful language" is a bit like defining a "good person" or a "quality product." There is absolutely no objective definition of these words that you could get everybody, or even a majority of experts, to agree upon, and most definitions simply end up begging the question. Depending on who you talk to, power could be any of the following:
Does everybody see what's going on here? Virtually every bullet-point feature can be interpreted as a sign of "power", and so can its exact opposite!
Somebody, somewhere, obviously thought that variable variables were an awesome idea that would make the language very powerful. I won't judge; I'm not a PHP guy.
I propose that instead of all this holy-war nonsense, we all use this Really Simple Definition:
The most powerful language is the one that allows you to ship the highest-quality product at the lowest cost in the shortest amount of time.
Vague? You betcha. That's why anyone who wants to call him/herself a professional has to understand both the programming concepts and the project domain. That's the only way you're going to be able to decide what's "powerful" for you.
Otherwise, you might just be bringing a really big knife to a gun fight.
I maybe biased because I'm a system programmer. I would think a programming language used for all of kernel, system, server and application programming, or support multiple programming paradigms, or both can be called "powerful".
C, C++, D are powerful, but obviously this is just my humble opinion.
There are a few definitions of power beyond Turing completeness. Mark's cited what I tend to think of as "the Paul Graham definition." It's a pretty good definition, with one serious flaw: it's wrong. It's theoretically a very good definition of language power, but you know what they say about the difference between theory and practice...
If everyone was capable of writing perfect code, not only perfectly bug-free but also perfectly future-proof, consistently, then the Paul Graham definition would be correct. But that's obviously not the case. In the real world, the majority of time and effort that goes into software engineering is not taken up by initial creation of the product, but by maintenance afterwards. Depending on which statistics you listen to, (and it probably varies quite a bit from project to project,) maintenance can account for anywhere from 60% to 90% of the total effort that goes into a program.
Maintenance is often performed by people other than the person who wrote the code initially, and frequently months or even years after the initial writing of the code, which means that even to the original coder it may as well be "other people's code" by that point. If you want to be productive during maintenance, you need to be able to quickly ascertain the original intent of the code by reading it.
Therefore, a more powerful language is one that makes code easier to read quickly, not one that makes code easier to write quickly. There tends to be a fair amount of overlap between the two, but the concepts are often at cross purposes as well, since terse syntax will often omit details that a compiler/interpreter is able to infer a lot more easily than a maintenance programmer.
EDIT: There's another important point in describing a language's power: the range of concepts that you're able to express, and how easily you can hit both ends of it. Paul Graham likes to evaluate this one on how high a level of abstraction you can reach, but that's only half of it. Any language that imposes a lower limit of abstraction, beneath which you can't go when necessary, is crippled because the details that are being abstracted away are there for a reason. This is the difference between an easily-readable toy language like COBOL and an easily-readable powerful language: COBOL has no pointers and no access to inline assembly, where you can express any computation, even ones that COBOL is not well-suited to.
COBOL is also not particularly good at hitting the high end of the abstraction spectrum either. According to Wikipedia it has "no user-defined types, and no user-defined functions," which makes it very difficult to create algorithms and data structures.
The right balance of brevity and flexibility.
Great question. Given that many languages are "Turing complete", we can put them all on equal grounds with regards to what they're theoretically capable of. But we don't do that because languages obviously differ from one another. And what is the difference?
The difference is the ability to say a lot of different things with very little. If we could jump right to the extremes, I could make a language that is the best language for automatically initializing a content management system using just one character, 'c'. But what would the point of that be? Sure, it's powerful in a sense of being very brief, but it's not flexible. What you want is a language that allows you to say many different complex things without being too verbose. Without being like assembly, capable of everything under the sun, infinitely flexible but extremely verbose.
A powerful language is a language that allows you to say many different things with the least amount of length possible.
This has been debated repeatedly at great length (e.g., on comp.lang.lisp, several times). I don't think anybody's ever come up with a "right" answer but a lot of people have come up with answers that strike me as obviously wrong.
In the answers I see here, let me pick on Mason Wheeler's answer. On one hand, the issues he covers are important -- but on the other, I can't quite imagine calling them at all related to "power." It's a bit like he's saying his Honda mini-van is more powerful than a top-fuel dragster because it's safer, quieter, has better handling, more passenger room and a much more comfortable ride. All of this is absolutely true, and it's all important. Those factors (among many others) make the minivan much more practical and reasonable for most people -- but they don't change the fact that the minivan's engine produces only about 250 HP whereas the dragster's produces somewhere around 8000 HP.
The problem, of course, is that with vehicles there's a clear-cut definition of what constitutes "power" and what doesn't. With programming languages, it seems to me that the discussion ends up being about equivalent to treating handling, comfort, speed, cargo capacity, and cruising range as all being parts of "power". The result tends to be threads that run on endlessly, generating a great deal more heat than light. Most of the questions that arise basically come down to the degree of importance you attach to completely unrelated and orthogonal features -- e.g., is the ability to program the MMU in assembly language more or less "powerful" than the ability to create higher level functions in Haskell? At least IMO, there's no meaningful way to compare the two, and no meaningful answer to which is "more powerful", or implies more power, or anything of that nature.
As such, as much as I hate to I have to say that in this case, the only meaningful answer is basically a relativistic one -- a powerful language is one that you find helps you to accomplish what you want to. Differences in peoples' goals render most "absolute" measurements of power meaningless at best.
Once you hit Turing complete (and it's easy for a language to do this), "power" doesn't mean much, in the sense that anything you can say in one Turing complete language you can say in another. Mark Canlas' answer nails it: brevity and flexibility makes the difference.
Having said that, Matthias Felleisen's paper On the Expressive Power of Programming Languages makes for interesting reading. In it he attempts to formalise the notion of expressiveness in languages.
There seems to be a lot of disagreement over what constitutes linguistic power. Is it terseness, legibility, adaptability, or just plain Turing completeness? I think that all of these factors come into play, so perhaps the best way to look at it is in terms of stat points. Yes, I'm talking pen-and-paper RPG, here.
The idea is that each language has (roughly) the same number of "points", which can be distributed arbitrarily across a number of categories. For the purposes of discussion, say the only factors are brevity, legibility, and flexibility. A language then might be extremely terse and flexible, but consequently very difficult to read; or very legible and flexible, but extremely verbose.
(Arguably, the number of points that a language has to distribute is defined by the skill of the designer and implementor, but let's pretend that all language designers are equally good at what they do.)
When a language designer decides to increase the strength of a language in one category, they logically take away a fraction of that potential strength from every other category. This is why it's so often said that programming language design is all about trade-offs. From this point of view, the overall power of a language is still not definable, and we have to revert to the tried and true method of categorising languages based on their relative strengths. Not satisfying? Too bad.
You can argue two ways: that a powerful language is one with a relatively even distribution of points (jack of all trades, master of none), or with as many points as possible in one area without leaving others unattended (specialist). There is no such thing as a "renaissance man" language, with perfect mastery in numerous fields. And if that's your definition of the most powerful possible language, then you're just plain out of luck.
For further reading, this article (coincidentally also by Paul Graham, who seems to have mixed opinions) touches on the idea that, difficult though it may be to determine how, programming languages do indeed vary in power. He argues rather persuasively that it's very easy to see how a language is less powerful than your preferred one—it's missing feature X—but very difficult to see how a genuinely more powerful language is in fact so—it's basically equivalent to language X, but with a bunch of other stuff thrown in. I leave you with a quote from that paper:
By induction, the only programmers in a position to see all the differences in power between the various languages are those who understand the most powerful one. (This is probably what Eric Raymond meant about Lisp making you a better programmer.) You can't trust the opinions of the others, because of the Blub paradox: they're satisfied with whatever language they happen to use, because it dictates the way they think about programs.
I think the the power of a language (and thus its usefulness) is proportional to the tools it gives you to translate abstract concepts in code. In this definition, I find C++ extremely powerful, even if mastering it (see also: metaprogramming) it's not easy.
What I like most is that C++ is powerful AND fast. So said dynamic languages (python, Perl etc) are also powerful but that power comes often (but not always) with a big cost: speed. That's because you can do magic with runtime code instead of compile time one. This is not always true,of course.
Programming languages are tools - nothing more, nothing less. Some tools are extremely specialized and well suited for particular purposes; others are generalized and simplified to the point of near uselessness.
I would argue that the most "powerful" language is the one which allows you to achieve your goals with a minimum investment of time, energy and other researces; that is, the language which provides the greatest ROI. In some situations it could be C; in others, Java; in still others, Haskell.
The best thing to do would be to familiarize yourself with a wide variety of languages and what they're useful for. Then, when the time comes to begin a new project, you can make an informed decision about which would be the most appropriate.
Discussions about programming languages are - IMHO - like discussions about mail clients in some Linux newsgroups: they tend to be a flame war. I can remember times when VB6 was popular. There were people even arguing that it isn't a programming language at all, while others created stunning applications with it.
I think programming languages differ already in the concept as the creators had different things in mind when they created/designed the language. So a language that fits one purpose - and under that circumstance is powerful - might not fit another. Naming the language powerful or not is then purely subjective. That said, I do not think that there is a metric that can be applied.
The most Powerful programming language is the one that solves the following linear programming problem:
+ Ease of reading code
+ Ease of debugging
+ Succinctness/brevity of expression
+ Ease of learning/teaching
- CPU usage
- Memory requirements
(And yes, I know, I already posted a completely contradictory answer. That's because I'm a dialectcian.)
This was written in regard to natural languages, but I think it is appropriate to programming languages as well:
A belief that some languages are intrinsically superior to others is widespread, but it has no basis in linguistic fact. Some languages are of course more useful or prestigious than others, at a particular period of history, but this is due to the preeminence of the speakers at that time, and not to any inherent linguistic characteristics.
"Power" simply isn't attributable to one language over another. It would be silly to say "Chinese is a more powerful language than Korean." Likewise, it is silly to say "APL is a more powerful language than COBOL."
There have been several attempts to equate linguistic power with some objective measure. I believe these attempts fail:
My opinion is that discussions of "the power of one language over another" are veiled expressions of the speaker's feelings of superiority over some other group. In short, its prejudice and stereotyping. Of course, people who are prejudiced really, really believe their stereotypes quite strongly, and its unlikely you could persuade them to change their minds.
They are all tools in your tool chest. A hammer can be powerful, but not if you need a wrench. C/C++ is great if you are a systems programmer, but Adobe Flash is probably a better fit for that gaming web site you want to build.