What does “powerful” mean, when discussing programming languages?

后端 未结 14 530
梦毁少年i
梦毁少年i 2021-01-31 04:15

In the context of programming language discussion/comparison, what does the term \"power\" mean?

Does it have a well defined meaning? Even a poorly defined meaning?

相关标签:
14条回答
  • 2021-01-31 04:20

    It does not have a well-defined meaning. In these types of discussions, "language X is more powerful than language Y" usually means little more than "I like language X more than language Y." On the other end of the spectrum, you'll also usually have someone chime in about how any Turing-complete language can accomplish the same tasks as any other Turing-complete language, so that neither is strictly more powerful than the other.

    I think a good meaning for it is expressivity. When a language is highly expressive, it means less code is required to express concepts. To me, this doesn't just mean that you have to write less code to accomplish the same tasks, but also that the code is easily readable by humans. Of course, generally (to a point), having fewer lines of code to read makes the task of reading and understanding easier for humans.

    Having a "powerful" standard library comes into play here along the same lines. If a language comes equipped with thorough, complete libraries, then idiomatic code in that language will be able to benefit from the existing library code and not have to repeat or reinvent common functionality in application code. The end result is, again, having to write and read less code to accomplish the same tasks.

    I keep saying "generally" and "to a point", because once a language gets too terse, it gets more difficult for humans to decipher. I suppose at this extreme, a language may still be considered "more powerful" (or even "too powerful"). So I guess I'm saying my personal interpretation of "powerful" includes some aspects of "useful" and "readable" in it as well.

    0 讨论(0)
  • 2021-01-31 04:20

    I view the term as marketing fluff, no one well-defined meaning.

    If you consider, say, Assembler, C, and C++. On occasions one drops from C++ "down" to C for particualr needs, and in turn from C down to assembler. So that make assembler the most powerful because it's the only language that can do everything. Or, to argue the other way, a single line of C++ code can replace several of C (hiding polymorphic dispatch via function pointers for example) and a single line of C replaces many of assembler. So C++ is more powerful because one line does "more".

    I think the term had some currency when products such as early databases and spreadsheets had in-built languages, some quite restricted. So vendors would tout their language as being "powerful" because it was less restricted.

    0 讨论(0)
  • 2021-01-31 04:21

    There are really only two meanings people are worried about:

    "Powerful" in the sense of "takes less resources (time, money, programmers, LOC, etc.) to achieve the same/better result", and "powerful" in the sense of "is capable of doing a wide range of tasks".

    Some languages are extrememly resource-effective for a small range of tasks. Others are not so resource-effective but can be applied to a wide range of tasks (e.g. C, which is often used in OS development, creation of compilers and runtime libraries, and work with microcontrollers).

    Which of these two meanings someone has in mind when they use the term "powerful" depends on the context (and even then is not always clear). Indeed often it is a bit of both.

    0 讨论(0)
  • 2021-01-31 04:24

    I think that, perhaps coincidentally, the physics definition of power is relevant here: "The rate at which work is performed."

    Of course, a toaster does not perform very quickly the work of putting out fires. Similarly, the power of a programming language is not universal, but specific to the domain or task to which it is being applied. C is a powerful language for writing device drivers or implementations of higher-level languages; Python is a powerful language for writing general-purpose applications; XPath is a powerful language for writing queries on structured data sets.

    So given a problem domain, the power of a language can be said to be the rate at which a competent programmer is able to use it to solve problems in that domain.

    0 讨论(0)
  • 2021-01-31 04:25

    Typically there are two distinct meanings:

    • Expressive, meaning the code tends to be very short and understandable
    • Low level, meaning you have very fine-grained control over the hardware.

    For the most languages, these two definitions are at opposite ends of the spectrum: Python is very expressive but not very low level; C is very low level but not very expressive. Depending on which definition you pick, either language is powerful or not powerful.

    0 讨论(0)
  • 2021-01-31 04:26

    The only meaningful way to describe "power" in a programming language is "can do what I require with the least amount of resources" where "resources" is defined as "whatever costs I'd rather not pay" and could, thus, be development time, CPU time, memory space, money, etc.

    So basically the definition of "power" is purely subjective and rendered meaningless in any objective discussion.

    0 讨论(0)
提交回复
热议问题