Today's Question:  What does your personal desk look like?        GIVE A SHOUT

Which one has a worse reputation, JavaScript or PHP?

  sonic0002        2014-05-03 06:26:10       10,262        0    

There has a been a lot of criticism of PHP over being a badly designed programming language. JavaScript seems quite a similar language with loose-typing and flexible array declarations/memory management, but is widely adopted by industry leaders such as Google. Google even has a JavaScript style guide. Many people think that PHP has a worse reputation than JavaScript. Carlos Ribeiro gave his analysis on a high level which doesn't touch the language syntax.

Attributing JavaScript success to it being "the only language for the job" is unfair. JavaScript is hands down a much better language than PHP. At its core it's a fairly consistent language, which follows a few powerful principles. It's a truly dynamic language, prototype-based, that supports functional constructs, all with strong theorethical basis on older languages such as Self and Scheme. JavaScript may have its problems, but at its core is a very coherent and elegant language.

PHP on the other hand was from the start much more hackish in nature. PHP was never intended to be a programming language, much less a object oriented one; it started as a hack to build dynamic pages, which solved this particular problem fairly well, and was easy enough for anybody to try. Most of its more advanced features were tacked over it as it evolved with little 'theoretical' consideration. This can be easily seen in the progression from PHP4 to PHP5 and the now dormant PHP6 project. As a result, the language does not have a coherent design.

The main problems with JavaScript are in my opinion the name (which imply that the language was derived from Java, which is not true in any sense) and the DOM (which is in my humble opinion a terrible hack glued over HTML+CSS code). All the rest are conscious design decisions, which may be debatable as a matter of application or even taste, but have their own merits. The same can't be said about PHP, despite how popular or effective for the job it may be.

PHP  JAVASCRIPT  COMPARISON  REPUTATION 

Share on Facebook  Share on Twitter  Share on Weibo  Share on Reddit 

  RELATED


  0 COMMENT


No comment for this article.