DEV Community

Discussion on: Choosing a programming language for bloody Beginners

alldanielscott profile image
Daniel Scott

I'm curious as to why PHP is your preferred choice for web applications. I've used it a lot, and I gravitate towards it whenever I'm developing on a LAMP stack or building on a CMS like Wordpress or Drupal, since it's well supported and well understood, but - frankly - it's an awful language full of bizarre behaviours that cause huge amounts of frustration.

I see that all the cool kids are starting to jump on the node.js bandwagon. Drupal is dying (and rightly so). Wordpress is thriving, but there are noises being made about whether it'll some-day be possible to move away from PHP (not anytime soon I suspect).

Personally, I've always thought server-side JavaScript made an awful lot of sense (learn one language and you can code on both sides of the browser). Plus, other than the whole having-to-deal-with-floating-point-numbers-everywhere dilemma, JavaScript is really quite a lovely language.

Netscape used to push server-side JS decades ago (but hardly anyone used their web server), and Microsoft had their own "JScript" implementation back in the classic ASP days but tended to push VBScript far more heavily because ASP developers tended to be VBA developers who'd been tasked with "building a website".

Node.js seems to be the "third-time lucky" for server-side JS and I'd be inclined to take a good-hard look myself.

Currently, if I'm building something bespoke, I'll tend to gravitate towards ASP.Net MVC - because it's lovely. This seems to be creeping into the open source space now that Micro$oft are doing some good work with the whole ASP.Net Core thing. Working in C# (a high-level compiled language) is sooooo much more productive for me than horrible PHP. All the dumb mistakes you might make get caught early in the coding process, leaving far fewer issues to track down and fix at runtime. I've had some very choice monosyllabic words for PHP (and it's designers) leading up to project deadlines before (while tracking down bugs that never should have been able to happen).

I tend to use PHPStorm when I write PHP, and it tries its best to work like an IDE for a compiled language, but all the idiotic things that PHP does (and encourages developers and designers of PHP frameworks to do) tend to hobble its efforts. True, server-side JS will share a few of those issues, but at least the language wasn't designed by the brrrrp who designed PHP.

hepisec profile image
hepisec Author

I agree that PHP has its flaws, but if you work with a framework like Symfony, you get an awesome toolset to quickly develop enterprise grade web apps. What I noticed from my students is that they need to understand the difference between server side and client side code. When they switch languages from PHP for server side to JS for client side, this difference becomes more clear.

In my own case, I also use PHP because it fits in our company environment.