As the name of this site implies, we’re big advocates of server-side technologies. But we also recognize that integrating client-side technologies into the web architecture can be advantageous as well. While we’re big advocates of server-side web frameworks like SpringMVC, Vaadin and JavaServer Faces, we know that there are also benefits to client-side rendering.
Even if your organization relies heavily on server-side technologies, consider these five benefits of client-side rendering and see if they would fit in your workplace:
1. Reduced server-side workload
Client-side rendering technologies like React and Angular use the processor on the client device to perform the bulk of the logic. That means processing power is offloaded from the server and transferred down to the client. As a result, the need for rack after rack of expensive server-side hardware goes away because the load is distributed across all the microprocessors embedded in the iPhones, Android devices and desktop computers where users view your site.
However, one potential drawback to client-side frameworks is that users with underpowered devices can experience lag as their devices struggle to render the page. However, as CPUs get cheaper and more powerful, this drawback has become less of a concern.
2. Improved separation of concerns
Software developers always try to comply with the Law of Demeter, but when a common server-side language is used for both client-side and server-side rendering, it’s very easy to take shortcuts to loosely couple the two technologies. It makes sense, because when all the Java code is deployed to the same server with the same set of backend-resources at the ready, it’s just too easy for a JSF developer to quickly make a database call to get the necessary information rather than wait for another development team to create a RESTful service that does the same thing.
One of the benefits of client-side rendering is that all calls back to the server must go through a RESTful interface. There’s no way to directly query a database or push a message to a server-side topic or queue. The architecture itself requires a developer to loosely couple the relationship between the server and the client.
3. Reduced server-side costs
Since client-side rendering frameworks simply push a collection of text-based files to the client, organizations only incur minimal costs for server-side hosting. In fact, the resources required for a web browser to run an Angular or React application can all be hosted on a low cost content delivery network, which is not only inexpensive, but also provides markedly reduced network latency times.
4. Easier code deployments
The deployment of EAR and WAR files to application servers like Tomcat and Jetty isn’t particularly onerous, but it isn’t exactly straightforward either. Maven builds, server restarts and stateful data synchronization are just some of the issues associated with the deployment of server-side rendering technologies.
5. Client-side rendering means a better client experience
It’s difficult for this site to declare client-side technology a clear and definitive winner over its server-side counterpart in capacity. However, there’s no debate from me that the single page interface (SPI) that manages state transitions and allows the user to navigate from page to page without a page refresh is a much better user experience than the one delivered through the use of a traditional Servlet and JSP based application.
The benefits of client-side rendering
In summary, the key benefits of client-side rendering technologies include:
- Reduced server-side workload
- Improved separation of concerns
- Reduced server-side costs
- Easier code deployments
- A better client experience
Even in a hypothetical future world in which every UI is implemented with a client-side rendering technology, the need for server-side processing never goes away. The heavy lifting of application development, be it security management, backend resource interactions and well-formed JSON and XML creation will always be the job of the server-side developer.
But when it comes to UI rendering, there are indeed client-side rendering benefits that just might justify a move away from a server-side Java web application frameworks like Struts or JSF.