Vaadin Reaches Version 21
Written by Nikos Vaggalis   
Thursday, 16 September 2021

The versatile full stack Java-based framework that is a competitor to Spring MVC, continues to innovate with its new release of v21. But first, what exactly is Vaadin?

vaadinlogo

Javascript for front-end development is not an all-or-nothing proposition any more; and not just Javascript. Developing for the web even at the most basic level requires knowledge in at least three Web standards; that of HTML, CSS and Javascript. I say "at least" since on top you can add things like WebSockets, Web Workers and the rest, with the stack continuing to grow.

The issue is more prevalent in an Enterprise setting where you've got a pool of Java dinosaurs, err developers, who are great at defining the business logic and building solid applications, but when it comes to the Web and the front-end they lose their sleep over. This is also depicted in Vaadin's adoption - of 4% according to Snyk's JVM Ecosystem Report 2021 and only 2% according to Jetbrain's State of Java report 2021.

But that 2 to 4% represents the 40% of the Fortune 500. Companies known to use Vaadin today include: Disney, Wells Fargo, Bank of America, GlaxoSmithKline, Raytheon, JP Morgan Chase, Volkswagen America, Rockwell Automation, National Public Radio (NPR) and many more.

As such, frameworks that hide this complexity and make use of a single language for writing both the back end and the front end have been on the rise. We've discovered .NET's side of the story in the article "Blazor WebAssembly Crash Course", where I found that

Blazor is a way to write web applications both on the server and client side with .NET and C# instead of using Javascript on the front-end.Code in Blazor compiles to WebAssembly, not Javascript.

The way it works is that a .Net runtime compiled to WebAssembly is downloaded into the user's browser which then runs the Blazor application in the same sandbox that JavaScript runs. And due to this magic of WASM, you can run high intensity apps, even C++ games, inside the browser!

Java's counterpart, if taking Blazor out of the equation, is Vaadin. Vaadin, the Finnish word for 'Reindeer', allows writing the presentation layer in Java too, forgoing all the Javascript drama.

Vaadin in its beginnings used GWT under the hood to compile the Java code to JavaScript. Not anymore.Since version 10 it compiles to Web Components and through its Client side JavaScript engine communicates the events taking place browser side to the server side which decides how to proceed, in for example modifying the DOM;that is Vaadin renders the application server side and this server side endeavor goes by the name of Vaadin Flow.Hold that thought for a moment because there's a reason for mentioning it.

vaadin1

In any case you just don't have to think about Server side or Client side; you just go on developing in your favorite Java like you used to do and let the framework handle both sides of the equation.

As said, Vaadin has just 4% adoption despite it's versatility. But then what is the alternative? Spring MVC, currently dominating the market, with a templating engine like Thymleaf + Jquery, Vue.js, etc. But going Spring MVC you'll have to master a steep learning curve that includes JavaScript. Vaadin in contrast offers out of the box customizable themes (collections of layouts for components) which can be switched without affecting the business logic:

  • Form input components, such as checkboxes, date and
    time pickers, text and password fields, and file uploads
    (with a progress bar).

  • Visualization & interaction components, such as dialogs
    and notification popups, data grids, tabs, icons, and more.

  • Layout components, including complete app layout
    templates with login, split and form layout options.

In addition Vaadin requires less configuration than a Spring MVC project to start with. However they are not mutually exclusive, they can also work together. Check "Using Vaadin with Spring MVC" for more. Of course, both go together with Spring Boot.

So is server side Flow the answer to all problems? Vaadin's latest versions have introduced yet another way of building the front-end, that of Fusion. In an attempt to lure developers that work say with Angular, Fusion allows to do your actual reactive UI logic in TypeScript while continuing writing the backend in Java.

There's a nice Frontend framework comparison between
Vaadin and React, Angular and Vue while there's also an overview of the differences between Flow and Fusion at Introducing Vaadin Flow and Fusion:

  • If you are a Java developer who relies on Flow, rest assured that you can continue as normal and ignore Fusion completely.

  • If you are a frontend developer just discovering Vaadin, Fusion is a great entry point to the platform.

  • If you work in a full-stack team and need the best of both worlds, you can use both options interchangeably right out of the box.

With all that background setting to provide the context out of the way, let's now concentrate on what release 21 brings:

  • Flow/Spring Security helpers
    As it says, helpers that reduce the boilerplate of implementing Spring security in your workflow.

  • Flow/RouteScope for Flow Spring integration
    With this feature, you can share beans inside a route between different UI subparts, so that you can use DI to inject the beans to the route classes and control when state is shared and when cleaned up.

  • Fusion/Java to Typescript code generation.
    A type that is nullable in Java has been made optional in TypeScript too so that its value can be undefined.

  • Flow/Vaadin Collaboration Engine, Real time collaboration in Vaadin apps
    Use the new PresenceManager API to show users who is working on what, in real time.

  • New features in various Vaadin Components, like Exporting chart as SVG image data or a new Grid event type.

  • The usual Bug fixes

The project's roadmap reveals that it is very much alive with a vibrant and supportive ecosystem around it. On that roadmap there's some interesting todos outstanding, but the one that merits attention is  Stateless Fusion. Vaadin Flow uses server side sessions heavily and Fusion does the same. This change would mean that Fusion would not create or store information into server sessions, allowing easier horizontal scaling of instances and high availability of services.

So given all the above it's up to you to decide whether setting Spring MVC aside, even for a brief moment, in order to give Vaadin a try is worth it. And to make that transition easier there's a brand new book out on Apress by Alejandro Duarte of the Vaadin team, Practical Vaadin: Developing Web Applications with Java

 

More Information

v21 on Github

Vaadin main

Related Articles

The Insider's Guide to the Java Web Developer Nanodegree - 2

Compile Spring Applications To Native Images With Spring Native

Blazor WebAssembly Crash Course

Spring GraphQL Milestone One

Kotlin Versus Java - A Developer's Rosetta Stone

Where's Java Going In 2020

Understand Gradle In Half An Hour 

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Call For Code 2024 Focuses On Generative AI
01/03/2024

This year's Call for Code challenge has been launched with a theme of the use of generative AI technology for solutions that aim to improve equitable access to resources and opportunities for historic [ ... ]



100 Episodes of 5mins of Postgres
08/03/2024

The popular PostgreSQL explainer series is celebrating its 100th release and beyond. Let's take a look at what it makes it so special.


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Thursday, 16 September 2021 )