Role of C,C++,python,perl in Web development
Please bear with me experts i'm a newbie in web dev.
开发者_运维技巧With html,css can take care of webpages.. javascript,ajax for some dynamic content.. php for server side scripting,accessing databases,sending emails,doing all other stuf...
What role do these programming languages play? Can they do any other important task which cannot be done by PHP?
All languages can all do basically any task any other one of them can do, as they are all Turing complete.
PHP works as a server-side scripting language, but you can also use Perl, Python, Ruby, Haskell, Lisp, Java, C, C++, assembly, or pretty much any other language that can access standard input and standard output for CGI communication with web content.
PHP is widely used because a) it's easy to learn a little and go, and b) the rather tedious CGI protocols are skipped, as the language handles them for you, so you can just plug your PHP script into an HTML page and not have to know how your program reads the information at all. This makes web programming easier for PHP, but the PHP interpreter is written in C, which does all the heavy lifting, so logically if PHP can do server-side scripting, so can C. Since most other languages are written in C, they too can do server-side scripting. (And since C compiles down to assembly, assembly can do it too, and so can any language that compiles down to assembly. Which is all of them not already covered.)
The language is where the actual logic of your application resides.
Perl, Python, Ruby etc. are all server side scripting languages (although their implementations and deployment methods are quite different).
As for "Can they do any other important task which cannot be done by PHP?", not really. All the languages are equal 'power' wise but the language design and capabilities make the development experience quite different.
Here's a relevant link about some of the things PHP gets right by a rather prolific Pythonista http://blog.ianbicking.org/2008/01/12/what-php-deployment-gets-right/
Another difference between your language choice is speed. An app written in C is going to run faster and require less system resources in general then a higher level scripting language. In a small scale app, you'd never notice. If your site is the next facebook, you will.
Here's a good example of a choice of languages having a very real effect: http://developers.slashdot.org/story/09/12/20/1433257/The-Environmental-Impact-of-PHP-Compared-To-C-On-Facebook?art_pos=9
If you'd like to understand how all of these different programming languages can be used for server-side scripting, read up on CGI.
精彩评论