It’s official: Javascript sucks harder than PHP

Share this article

The surprise outcome of last nights webtuesdayJavascript sucks harder than PHP. I still can’t quite believe it.

Maarten took the PHP corner against me in the Javascript corner, both of us shamelessly advocating each language under various headings – 1 minute max per topic – no outright lies although often bordering on truthiness. Verdicts provided by the audience, based on who could shout loudest from a choice of “OK – 0 points”, “Annoys – 2 points”, “Sucks – 4 points”, “Sucks hard – 6 points” and “Blows – 8 points”, with help from the Suckometer (thanks to the Net-Policy team for QWizard).

Now this might not sound very scientific. For starters, how can you compare PHP (server-side) to Javascript (client-side) – apples to pears? But it’s not quite so black and white, as you’ll see from the slides – there is server-side Javascript just as there is client-side PHP. And if you ignore that distinction and focus more purely on their respective merits as programming languages, there’s plenty of room for comparison. Meanwhile you might argue that a secret ballot is essential for impartial rating but that misses the opportunity for one angry coder to remind everyone just how bad it all is.

And we had some very experienced hands in the audience (many knowing both languages intimately as well as Java, C, C++, Ruby, Perl etc.) but still stunned by the final verdict: that Javascript sucks harder – I thought I’d clinched it with CSS selectors for dependency injection but by using a negative rating system, hype and buzzwords were quickly slaughtered – it became a process of catharsis in which the “winner” was the one that came out hurting less – this is the new language advocacy! ;)

Many thanks to our hosts Amiado.

Frequently Asked Questions about JavaScript and PHP

Why is JavaScript considered to have a poor design?

JavaScript is often criticized for its design due to several reasons. Firstly, it has a weak typing system which can lead to unexpected results. For instance, adding a number and a string can result in a string, which can be confusing for developers. Secondly, JavaScript’s global variables can lead to naming conflicts and unexpected behavior, especially in large codebases. Lastly, JavaScript’s prototypal inheritance is different from the classical inheritance model used in many other languages, which can be confusing for developers coming from a classical OOP background.

Why do some developers prefer PHP over JavaScript?

PHP is a server-side scripting language, which means it runs on the server and not on the user’s browser. This makes PHP more secure than JavaScript for certain tasks, such as accessing databases. PHP also has a simpler syntax compared to JavaScript, making it easier to learn for beginners. Furthermore, PHP has a large and active community, which means there are plenty of resources and libraries available for developers.

What are the main criticisms of PHP?

PHP has been criticized for its inconsistent naming conventions and function parameters, which can make the language difficult to learn and use. PHP also lacks modern programming features, such as namespaces and modules, which are present in many other languages. Furthermore, PHP’s error handling is considered to be less robust than other languages, which can make debugging more difficult.

Why is JavaScript considered to be a difficult language to learn?

JavaScript is considered difficult to learn due to its unique features and design choices. For instance, JavaScript’s prototypal inheritance is different from the classical inheritance model used in many other languages, which can be confusing for beginners. JavaScript also has a number of quirks and edge cases, such as hoisting and the ‘this’ keyword, which can lead to unexpected behavior.

What are the advantages of using JavaScript?

Despite its criticisms, JavaScript has several advantages. It is the only language that runs natively in the browser, making it essential for web development. JavaScript also has a large and active community, which means there are plenty of resources and libraries available for developers. Furthermore, JavaScript is highly flexible and can be used for a wide range of tasks, from front-end development to server-side programming with Node.js.

Can PHP and JavaScript be used together?

Yes, PHP and JavaScript can be used together in a web application. PHP is typically used for server-side scripting, such as processing form data and accessing databases, while JavaScript is used for client-side scripting, such as validating form inputs and creating interactive user interfaces.

Is JavaScript more popular than PHP?

According to various surveys and statistics, JavaScript is currently more popular than PHP. This is likely due to the rise of front-end frameworks like React and Angular, as well as the popularity of Node.js for server-side programming. However, PHP is still widely used and remains a popular choice for server-side scripting.

What are some alternatives to JavaScript and PHP?

There are many alternatives to JavaScript and PHP, depending on your needs. For client-side scripting, you could consider using TypeScript, which is a statically typed superset of JavaScript. For server-side scripting, you could consider using Python or Ruby, which are both powerful and easy-to-learn languages.

Why is JavaScript considered to be a “messy” language?

JavaScript is often considered to be a “messy” language due to its flexibility and lack of strict rules. For instance, JavaScript allows developers to create variables without declaring their type, which can lead to unexpected behavior. JavaScript also has a number of quirks and edge cases, such as hoisting and the ‘this’ keyword, which can make the language difficult to understand and use.

Is PHP dying out?

While PHP is not as popular as it once was, it is far from dying out. PHP is still widely used for server-side scripting, and it powers a large portion of the web, including popular platforms like WordPress. Furthermore, PHP is continually being updated and improved, with new features and performance improvements being added regularly.

Harry FuecksHarry Fuecks
View Author

Harry Fuecks is the Engineering Project Lead at Tamedia and formerly the Head of Engineering at Squirro. He is a data-driven facilitator, leader, coach and specializes in line management, hiring software engineers, analytics, mobile, and marketing. Harry also enjoys writing and you can read his articles on SitePoint and Medium.

Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form