Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What makes some programming languages more powerful than others? [closed]

I'm going to reveal my ignorance here, but in my defense, I'm an accounting major, and I've never taken a computer science class.

I'm about to start a new project, and I'm considering using Python instead of PHP, even though I am much more adept with PHP, because I have heard that Python is a more powerful language. That got me wondering, what makes one programming language more powerful than another? I figure javascript isn't very powerful because it (generally) runs inside a browser. But, why is Python more powerful than PHP? In each case, I'm giving instructions to the computer, so why are some languages better at interpreting and executing these instructions? How do I know how much "power" I actually need for a specific project?

like image 205
smfoote Avatar asked Oct 18 '10 21:10

smfoote


3 Answers

When Paul Graham talked about Lisp being the most powerful language available, he meant most expressive. You can express any program in any turing complete language. That's the whole point. What makes one language better than another (for a particular task) is its ability to define a given program more concisely or clearly. For most programming tasks, that's what matters.

Occasionally (and I mean very occasionally) performance starts to play a role, and features like the ability to embed assembly language easily in your program matters. But for the most part, it's about the ability to express your ideas clearly and concisely.

like image 131
dieuvn3b Avatar answered Oct 07 '22 03:10

dieuvn3b


I hate statements of the sort "language X is more powerful than Y." The real question is which language makes you more powerful. If language X allows you to write better code (that works) faster than Y does then, yes, X is more "powerful".

If you are looking for an objective explanation of language powerful-ness ... well, good luck with that.

like image 32
ktdrv Avatar answered Oct 07 '22 01:10

ktdrv


It's not really a matter of power, but a matter of what you're trying to do and how you try to do it. You could say that Python is "more powerful" because it comes with a large set of built-in libraries, or that C++ is "more powerful" because it's much faster, or that Haskell is "more powerful" because it uses lazy evaluation - in short, it's really a matter of opinion. But I haven't seen many desktop apps written in PHP, and I don't see web apps written in C++ (though there are probably exceptions, of course).

Some languages simply offer what is considered an "elegant" way to perform certain tasks. For instance, look at a factorial function in Haskell:

factorial 0 = 1
factorial n = n * factorial (n-1)

Some might consider this elegant mainly because it reflects the mathematical definition clearly. But is this better than another implementation? No. (Especially since this would overflow the stack.)

In conclusion, use what you feel is best for your task - if you're best with PHP, and you don't want to learn Python, than don't. If you're interested in what it's like, then check it out. Don't learn it because it's "more powerful."

like image 37
li.davidm Avatar answered Oct 07 '22 02:10

li.davidm