ckportfolio.com - Beyond PHP and MySQL: Emerging Paradigms

Beyond PHP and MySQL: Emerging Paradigms

Current Challenges

As new opportunities in the web industry emerge, it is common for mature technologies such as PHP and MySQL (and previously Java and Microsoft's ASP.NET) to adapt more slowly than newer counterparts to the emerging trends.

Python has become the de facto standard language in exploring machine learning and artificial intelligence research, as general-purpose libraries such as TensorFlow favor the language due to its advantages in handling scientific and technical computing needs. JavaScript, beyond its front-end origins, is quickly invading the backend domain in order to become a platform and replace conventional server technologies, coupled with never-before-seen features designed for real-time and reactive experiences. Google is building its own suite of programming languages (including Dart and Go) to streamline the internal development pipeline and compete in the market.

While exciting, many of these opportunities seem distant and inaccessible to those only familiar with web-first technologies including HTML, CSS, and jQuery. Thankfully, there are numerous innovation that one can immediately take advantage of without committing a considerable amount of resources to learning a new language.

Real-Time Communication with WebSocket and WebRTC

As traditional office applications flock to the cloud environment, other seemingly-impossible-on-the-web tools are making their way to the web as well. Online chatrooms no longer force plugin installations, and Skype and Hangout no longer exclusively require separate desktop applications as they can simply open their web browsers and join the conversation. It seems that the web recently has become a lot more capable with little to no third-party plugin dependence. WebSocket and WebRTC are at the forefront of making the web more real-time, and they do so by allowing two or more computers efficiently communicate using the web browser connection.

Conventional web technologies only allow for a short window of time in transferring a message from one place to another in a single direction, and while perfectly suited for loading websites, can be cumbersome and slow for real-time needs such as online chatting. This core weakness was previously masqueraded with automatic at-interval data refreshes and long-polling (forcing the connection to stay open for a finite amount of time), but they proved to be less reliable. WebSocket solves this problem by allowing two or more parties to communicate text on a specific server that remains open and fully bidirectional, while WebRTC allows two parties to communicate directly to exchange larger amounts of data more quickly. Most importantly, these implementations are created with JavaScript and other core technologies in mind, allowing developers to quickly experiment and adapt as required.

Browser Automation with Puppeteer

As web applications become more complex and resutantly time-consuming to troubleshoot, automation is no longer a foreign concept to web developers, but the learning curve remains steep. A team of developers may work together to write a suite of complex unit tests using Jenkins to see throw "programmatic curve balls" at the application and ensure that it does not break under various circumstances; similarly in case of websites, many developers rely on Selenium to "automate" browsers and view how the website functions across different platforms. Involving disparate products and different levels of abstraction as a result, this can be a frustrating experience.

Google's Puppeteer is one of the first steps in eliminating such complexity. Google Chrome and Mozilla Firefox are not only available as graphical solutions, but as "headless browsers": a text-only browser that can be programmed to perform specific tasks. By allowing the developers to directly program web browser behaviour with JavaScript, one can build a "bot" that posts to Instagram and other social media platforms, or have a browser take screenshots of the same website in various sizes to test its responsiveness. By removing the need to use a proprietary solution that serves as a heavy layer on top of existing browsers, Puppeteer makes browser automation much more approachable and efficient.

JavaScript as a Backend Language with Node.js

In addition to serving the various specialized needs, JavaScript has become a significant player in the backend market. No longer confined in the front-end domain, JavaScript is now being used to replace existing server solutions, and it is easy to see the appeal: using this approach, JavaScript can be the only programming language used for all aspects of the application, allowing the developers to use JavaScript to handle front-end animations as well as database queries in the backend.

Node.js is a platform that allows for such a revolution. Designed as a lightweight interpreter that takes JavaScript code to perform backend tasks, Node.js also enjoys the benefit of concurrent processing: while many other backend platforms dedicate high overheads in processing power for each visitor, Node.js rejects this notion and forces a smaller number of "internal workers" to work harder and smarter with lower overheads. Armed with the advantages in streamlined development process, concurrency mechanism, and bleeding-edge innovations that favour JavaScript, Node.js continues to threaten the market shares that PHP, MySQL, and other conventional platforms fought hard to build.

Unwavering Dominance

Node.js may certainly be an appealing starting point for new web applications and startups, but the LAMP (Linux, Apache, MySQL, and PHP) stack continues to enjoy market dominance and improve its own components to compete against newer technologies. According to W3Techs, PHP and Apache continued to absorb users from Microsoft and Oracle products, with their popularity peaking in the mid 2010s with the 80% market share.

Since the emergence of Node.js and other "host-your-application-without-server" services from as Google Cloud, developers have more options than ever --- but the market share yet seems unmoved: many attribute this to the ample supply of PHP experts, the popularity amongst open-source developers, and the PHP community's reception to recent web trends. PHP has traditionally been a target of criticism for inconsistent release cycles and slower performance compared to newer backend technologies, but things certainly took a turn with the introduction of PHP7: the language boasts much more consistent releases and performance equal to or better than Node.js and other competitors, and continues to evolve with concurrency optimization, WebSocket support, and more. In any case, the web ecosystem contniues to thrive with healthy competition between languages and ideas.

Fin