How to Select a Web Framework For Your Project (Java)
Internet technologies have made it possible for organisation to expand reducing time to market for new products and services. The internet has been great but the main advanced here is being pushed by the HTTP. Some might disagree but the majority of communication between web and mobile applications is over HTTP protocol. HTTP is not the only protocol for the internet but it is the main enabler. One way to consume the HTTP protocol is via a web browser. As a developer and architect, your options are limited when it comes to building an application for the browser. We will get into some of the limited choices later. We will take a look at the frameworks available from a Java language vantage point. This article does not discuss what framework is better than…. This choice is left to your team. There are many points to consider when selecting a web framework for your project but we will restrict ourselves to following few:
Where are your users?
It must be said that the most important aspect of a software project is to consider its users. How would they interact with the application? This blog article is focused on the web and will not go into discussion about standalone desktop applications.
The way the software is delivered to its end-users would have a major impact on deciding how to implement the software, at least on the user interface.
So what are our choices for the front-end?
For the application to delivered through a HTML5 compliant browser, we are stuck with one option. Remember a little earlier we have mentioned that there are limitations in developing for the web browser. Well, web browsers only natively understand the following languages: HTML, JavaScript and Cascading Style Sheets. The keyword is “natively”. You can write plugins, as you can see those are rapidly becoming a dying breed. Just to repeat once more so we do not get confused; web browsers only natively understand HTML JavaScript and CSS. Now let’s move on from that.
What a Java developer to do?
Well the answer is simple, learn HTML JavaScript and CSS! No, this is not entirely true. Agreed that learning the language of the web with supply limitless power J. Developers are busy trying to meet deadlines and therefore they do not have a luxury of gallivanting into new horizons. Assuming that all developers can write HTML5 code and deploy Bootstrap for CSS, we are only left with JavaScript.
Here are some choices:
- Depending on your level of expertise with JavaScript
AngularJS – This framework was written by Java developers working at Google on the GWT project. Due to impact on their productivity, they have decided to develop a pure JavaScript which implemented the Model View Controller (or Presentation or whatever else you want). This framework is very popular and gave birth to the likes of BackboneJS and ReactJS.
- If you are a Spring dev team, you will have to rethink your architecture as the AngularJS framework moves the controller to the client side. You can still plug it ins but you have to be ready to have more boilerplate code. Your team are moving your spring code to a REST based architecture then AngularJS will be a good framework, assuming that you are comfortable with writing JavaScript.
JQuery – this is JavaScript framework which is more of a utility tool then trying to change programmers habit. The power of JQuery means that you can embedded in project which requires some client-side execution. You could perfectly use in your Spring project. The framework is very mature and stable and it is the JavaScript engine in Oracle Java Server Faces (JSF) technology for client-side execution.
Vaadin (Google Web Toolkit –GWT) – this framework is a port from GWT previously developed by Google. When the team G team decided to move away from GWT, the good folks at Vaadin Ltd jumped in to the rescue. As a Java a developer, this framework has the smallest learning curve. Developers write their code in Java which is then cross-compiled to JavaScript for the browser. Vaadin does not fit into your Spring web application architecture, developers using Vaadin do not have to worry about writing a single JavaScript code and still have the power of both Java (a subset) and JavaScript in the browser.
Java Server Faces (JSF) – This a favourite with the Kiktronik’s dev team. Productivity is key when trying to introduce new services or products to the market in a short burst of time. Java developers would find that JSF has a shortest learning curve. JSF promotes MVC as a first-class citizen. It has enough components to create interactive web apps, and framework to create new components if required. Primefaces is a lightweight JSF component library which has many features such as client-side validation and AJAX among others. Primefaces is powered by JQuery as its JavaScript engine.
Apache Wicket – this a component based and does not promote the MVC pattern. Nonetheless Apache Wicket can be integrated with Spring MVC to turn into a full feature MVC framework. This should be appealing to Spring team. The development approached of Wicket is very similar to JSF. There are multiple post comparing them and some extent. The learning curve for using Wicket is quite low as everything is contained with Java code. The exception of Wicket namespaces in HTML, a web designer can work on the UI almost in isolation to back-end developer. Wicket uses JQuery as its JavaScript engine.
So how do we actually select which framework to go with?
There are three main factors to consider here: time, cost and resources. Thus, the program lead would have to ask himself the following questions:
- When is the project required to go live?
- Do we have the resources required to deliver the project with the chosen framework?
- How much would it cost to acquire those resources if required?
Answering the above questions would provide some clarity on what to do. Also, when choosing a framework, do check its maturity; how often is it updated and how big is the community supporting it. Do not let the hype cloud your judgement.
Conclusion
The article has discussed some of the most popular web framework for Java developers. Choosing a framework does not have to be a daunting task. If you are at an impasse with your choice, do a proof of concept to determine which one works for you. But make sure that you were able to answer all the questions about time, cost and resources. All frameworks claim to be the best but that’s just pointless hype. Remember when Ruby so hyped but Twitter and LinkedIn ended up ditching it later for Java? That must have had a cost impact. Not all companies can afford to shelve a project and restart from scratch. If your team does not have any JavaScript expertise, there is no point in forcing them to choose something like AngularJS as the chances of introducing bugs would be higher.
Published with permission from Kiktronik Limited. Armel is available for freelancing and consulting services.
Software Engineer ? Published author ? Developer Advocate (DevRel)
7 年Hi, great article! Thanks for sharing. Just a small clarification. Vaadin is not a "port from GWT". Vaadin Framework happens to use GWT the same as it uses other stuff from the Java ecosystem. In fact, it might be that future versions of the framework use another technology for rendering the client-side. Check this out for more info: https://vaadin.com/blog/-/blogs/framework-roadmap-connecting-the-dots Cheers!
Legacy Modernization Architect
7 年Good one!