Our typical projects @ Onion Creative are product development for startups, or creative / digital marketing campaigns. These projects typically are more demanding in creativity and feature design, yet having more constraints over budget than most development projects. We need to be very cost conscious when we develop the products for our clients.
Synchronous vs Asynchronous Nature
One of the key benefit of NodeJS is its non-blocking feature. One execution does not need to wait for the previous one to finish for it to start, thanks to the clever, asynchronous nature of most of the callbacks in Javascript. However, from our experience handling these asynchronous callbacks may end up costing more time to make sure codes are executed in the right order. In many occasions we needed to implement a lot of extra synchronous callbacks, or Promise, to make sure of that. The asynchronous nature of most Javascript callbacks may end up getting in the way and require more time to implement. You can probably see how ironic that may sound.
Laravel being one of the best MVC framework, the synchronous, controller based architecture allow developers to bootstrap their product much quicker, safer with clearer separation of concern in its code structure. The synchronous nature naturally removes a large chunk of technical debt right from the start, keeping the cost and risks low and allow all teams to focus on building a great product for the users.
PHP is common on most (if not all) platforms
Needless to say, Apache + PHP is pretty much preinstalled on every Linux distro. NodeJS however requires a whole array of additional components such as NPM, ExpressJS etc. That can be a problem for shared hosting environment, which we sometimes are required to use for smaller projects per client requests.
Apache2 and PHP is a much older, more popular, and well tested environment for serving content
NodeJS is based on the renowned V8 Javascript engine, which is originally developed by the Chromium project for Chrome and Chromium browsers in 2009. Providing an efficient runtime environment for Javascript to run on popular web hosting capable OS’ such as Mac, Linux and Windows. However it is still relatively new, some may consider it unstable as a scalable solution for large applications.
Laravel is built on top of PHP. It is originally develop primarily for serving web content back in the 1990’s, powering over 70% of all the websites in the world as of today. It is a result of a lot of hardwork from the community, and also a miracle for such a technology to endure all those years of community testing and critics and yet remain serving 80% of the websites in the world.
NodeJS is single-threaded runtime environment
Don’t get me wrong, NodeJS has this extremely powerful event-driven event loop model that can support far more concurrent processes that Apache and PHP ever will, however it also comes with a risk where if the thread crash the entire NodeJS stack may crash with it.
PHP adopts a multi-threaded model where each requests instantiate a new thread. It’s a much more limited and “expensive” way of handling processes, however that ensures that if any thread crashes, other threads will remain unaffected, which results with a stabler and higher fault-tolerance server. We will cover more on how Laravel/PHP actually benefit our clients in the upcoming post.