Skip to content

JAX London 2021: "How Should Java Developers Build Front-Ends for Web, Mobile & Desktop Today?"

Published on · Updated on · 13 min read
JAX London logo

Share

Logistics

Conference

JAX London was a hybrid conference that brought together leading software engineers and enterprise-level professionals working on Java, microservices, continuous delivery, and DevOps. It ran October 4-7, 2021. I gave a session there on “How Should Java Developers Build Front-Ends for Web, Mobile & Desktop Today?”. I looked at various frameworks from a Java developer’s perspective and suggested which one to use in three common scenarios.

Talk

My talk was on Wednesday, October 6, 2021, from 12:15-13:00 BST.

Abstract

Users accessed applications on PCs and mobile devices at the time. There were two obvious ways to build front-ends for these devices: web applications and native applications. Cross-platform UI toolkits combined advantages from both approaches — examples were Google’s Flutter, JavaFX, Facebook’s React Native, and Microsoft’s Xamarin. Important web application frameworks were Google’s Angular, JSF, Facebook’s React, Thymeleaf, Vaadin, and Vue.js.

I looked at all these toolkits from the perspective of a Java developer and recommended which one to use in three common scenarios: a new web application, new native iOS & Android apps, and what to do on the desktop when you already had a web application. Based on my experiences using Google’s Flutter for native mobile apps in my SaaS start-up, I highlighted what was good about Flutter and what wasn’t.

Why Should You Listen To Me?

I wasn’t affiliated with the projects I discussed, and I didn’t sell books or training courses. I shared industry analysis and my own project experiences to give you options for your next project. I used 12 criteria for my evaluation. You can use my criteria, pick your own, or weigh them differently than I did. But you need to apply your criteria in your own environment and make your own choice.

Summary

Here was my advice for “Building a New Web Application”: If you’d worked with any of the “Big Three” frameworks, you should keep using them. Otherwise, I recommended evaluating React, Angular, and Vue.js in that order.

Here was my advice on “Building New Native iOS & Android Apps”: If you’d used Flutter or React Native before, you should keep using them. Otherwise, I recommended evaluating Flutter and React Native in that order.

And here was my advice on “Got a Web Application - What Now on Desktop?”: Keep your web application. If you were fine with Flutter’s constraints, you should evaluate Flutter for Desktop.

Historical note (as of February 2022): After the talk, attendees could rate it live and leave feedback via Mentimeter. That poll is no longer reachable today.

Slides

The slides were available as a PDF (2.5 MB); the PDF version is available for download here.

Download slides (PDF)

Historical note (as of February 2022): Back then, the slides were also available in their original Keynote format (14.7 MB) — with less text, but animated and with a look behind the curtain of individual effects; that file is no longer available today.

Video

No video of this talk is known.

Flutter Hot Reload

Flutter Hot Reload made code changes go live in the device/simulator immediately. It was the main reason why working with Flutter could be such fun! I mentioned it in the talk — here’s a video demonstrating it.

Watch the video (YouTube)

Mobile App Prototype with Flutter

Even though it was a bit older by then, this was still a good example of what a native Flutter app could look like. I wasn’t ready to show the app I was working on at the time.

In the summer of 2019, I built native iOS/Android apps with Flutter to validate a business problem. It took about six weeks and was my first Flutter project. I used Google’s cloud service Firebase for login, NoSQL database, and file storage. I built the back-end myself with Java, JHipster, Spring Boot, and Angular.

Watch the video (YouTube)

Progressive Web Application Prototype

At the end of 2019, I built a progressive web app (PWA) to speed up app development. A PWA used the “Service Worker” in a browser to install on a device and cache data. That took about four weeks and was my first PWA. I used Google Workbox for this but developed my own offline storage solution in the browser. I built the back-end with Java, JHipster, Spring Boot, and Angular.

Watch the video (YouTube)

Historical note (as of February 2022): At the time, I was looking for a new project starting in October 2022, in Milton Keynes, London, or remote.

Additional Talk Information

Java Developer Wish List for Front-Ends

Declarative Front-Ends

These five frameworks showed different approaches to declarative front-ends:

Apple’s SwiftUI

SwiftUI was Apple’s take on declarative front-ends. Here’s the counter example from the talk, with slightly changed formatting:

@State var count: Int = 0

var body: some
View {
  VStack(alignment: .center,
    content: {
      Text("Counter: \(count)").padding()
      Button(
        action: { self.count++ },
        label: { Text("Increment") }
      )
    }
  )
}

Google’s Flutter

Flutter was Google’s cross-platform implementation of declarative front-ends. It reached the stable version 1.0 for mobile in December 2018. Here’s what the SwiftUI counter sample looked like in Flutter:

int _counter = 0;

return Column(
  mainAxisAlignment: MainAxisAlignment.center,
  children: [
    Text( 'Counter: $_counter' ),
    TextButton(
      onPressed: () =>
        setState({
          _counter++
        }),
        child: Text( 'Increment' ),
    ),
  ],
);

Google’s Jetpack Compose

Jetpack Compose was Google’s Android implementation of declarative front-ends. So Google had two different horses in this race: Jetpack Compose and Flutter. Of course, it’s Google! 😒

Jetpack Compose went 1.0 on July 28, 2021.

I adopted the counter sample from this tutorial to look like the SwiftUI sample above:

val count = +state{0}

Column(Spacing(16.dp)) {
  Container() {
    Column() {
      Text(
        text = "Counter: ${count.value}",
        modifier = Spacing(8.dp)
      )
      Button(
        text = "Increase",
        onClick = {
          count.value++
        }
      )
    }
  }
}

Microsoft’s .NET Multi-platform App UI (MAUI)

.NET MAUI was part of .NET 6 and had recently been delayed from November 2021 to Q2/2022. And if “Maui” rang a bell for you — it’s the second-largest island of Hawaii.

Microsoft called its implementation of declarative front-ends “Model-View-Update” (MVU). Here’s what I thought the SwiftUI sample from above would look like in MVU. I adapted the sample from the announcement post:

readonly State<int> count = 0;

[Body]
View body() => new StackLayout {
  new Label( "Counter: {count}" ),
  new Button(
    () => $"Increment",
    () => count.Value ++
  )
};

Facebook’s React

And finally, here’s what the counter looked like in Facebook’s React for web applications. I adapted it from this Stackblitz sample. Some HTML code shows up because I didn’t use components, to keep things simple. If I had, it would have looked just as declarative as the other examples:

class App extends React.Component {
  state = {
    counter: 0
  }

  render() {
    return <div>
      <p>Counter: {this.state.counter}</p>
      <button onClick={
        () => this.setState({
            counter: this.state.counter + 1
          })
        }>Increase</button>
    </div>
  }
}

New Web Application

Popularity

I recorded all numbers on October 2 & 3, 2021.

Here are the Google Trends — they showed how unpopular JSF, Vaadin, and Thymeleaf were at the time:

Here’s the link for the chart above with Angular, JSF, React, Vaadin, and Vue.js on Google Trends. Thymeleaf wasn’t on the list because Google only allowed five search terms. Here’s a version of that link with Thymeleaf instead of Vaadin.

These were the Stack Overflow Trends for all frameworks. As you could see, JSF, Vaadin, and Thymeleaf weren’t popular anymore:

Here’s the link for the chart above: Angular, JSF, React, Thymeleaf, Vaadin, and Vue.js.

Udemy only reported course students if they were beyond a certain threshold. Neither JSF, Vaadin, nor Thymeleaf exceeded it:

Here were the search queries for the Udemy course data:

The Indeed job search across 63 countries, representing 92.4% of the worldwide GDP in 2020, also made clear that there were too few jobs for JSF, Vaadin, and Thymeleaf:

My Indeed search was a full-text search in both the header and the body for the technology name, such as “Flutter”. In most countries, the result also had to include at least one of multiple ways to say “developer”. The links are in the Excel file below.

Here were some of the adjustments & caveats I needed to make:

  • A job with the title React Developer could still have Vue in the body. Such a job advertisement was counted both as a result for React and Vue.
  • Searching for React also showed results for React Native. I subtracted the number of React Native results from the React results.
  • The word “react” often appeared in job advertisements. In countries where I didn’t have translations for the various forms of “developer” (such as China or Russia), I manually adjusted the number of jobs found down.
  • Flutter Entertainment is the world’s largest online betting company. Although I was looking for developer positions, this may have inflated the number of jobs found for Flutter a bit.
  • “Vue” has multiple meanings in French and Spanish. So in French-speaking countries, like France, Canada, Spain, Luxembourg, and Switzerland, I searched for “vue.js” instead. This may have deflated the number of jobs found for Vue a bit.

You could find the detailed search results with links here:

Ranking

I ranked React fastest, for two reasons:

  • React had an experimental feature called Concurrent Mode. If it made it into production, it would improve data loading with multiple components on a page.
  • ReactDOMServer let us send HTML from the server to the browser before the React application was ready. The other frameworks may have had something similar.

New Native iOS & Android Apps

Popularity

I recorded all numbers on October 2 & 3, 2021.

Here are the Google Trends — they showed how unpopular JavaFX and Xamarin were at the time:

Here’s the link for the chart above with Flutter, JavaFX, React Native, and Xamarin on Google Trends.

These were the Stack Overflow Trends for all frameworks. As you could see, JavaFX and Xamarin weren’t popular anymore:

Here’s the link for the chart above with Flutter, JavaFX, React Native, and Xamarin.

Udemy reported that relatively few people learned about JavaFX and Xamarin:

Here were the search queries for the Udemy course data:

And finally, the Indeed job search showed that there were at least some jobs for JavaFX and Xamarin:

Please see the previous section for general information on the Indeed search.

Flutter was at a special disadvantage on Indeed. Often, you’d find the following in job ads there: “Experience with a cross-platform framework like Xamarin or React Native required”. Flutter was a cross-platform framework, but it was the new kid on the block. If you just had “Flutter” in your resume, you might still not get the job:

  • Most big companies used Applicant Tracking Systems (ATS). These systems scanned resumes automatically for keywords. If “Flutter” wasn’t an approved keyword, you were out.
  • The next stage was the agency or HR department. They typically had no clue about programming — how could they? They hired people for all sorts of professions. If they didn’t know about “Flutter”, you were out again. It wasn’t all sunshine and roses!
  • Hopefully, the developers at the end of the process did know Flutter.

The same search results were available here for download:

React Native Vs. Flutter

  • React Native always used a JavaScript VM to run our applications. Flutter used a Dart VM during development and compiled native code when deployed — that was faster.
  • React Native managed the native iOS/Android UI elements through a JavaScript bridge. That was slower than Dart: Dart used Google’s open-source Skia graphics library — Chrome, Firefox, Chrome OS, and Android also used Skia. But this also meant Flutter only painted pixels: it had to recreate all native iOS/Android UI elements in Flutter.

Will Google Kill Flutter?

  • In 2019, Flutter was the project with the third-highest number of contributors on GitHub (section “Top and trending projects”). It had 13k. Azure Docs had 14k, VSCode had 19k. I couldn’t find these numbers for 2020.
  • Toyota picked Flutter to power future car entertainment systems. Whether this was just a test by Toyota or whether they’d already decided to go ahead with Flutter for production remained unclear.
  • In May 2021, Google announced that more than 1 in 8 new apps in their Play Store used Flutter, for a total of 200k apps at that point.
  • Google’s Fuchsia OS used Flutter and rolled out to some Google Nest Hub devices.

Responsive Design

Flutter gave only little help with responsive design: You found out the screen width and adjusted your UI yourself. Wonderful! So there was no grid like in Bootstrap or the more powerful, but also more complicated, HTML version. For now, I went with flutter_bootstrap.

Notable Flutter Plugins

Getting Started

React & JavaScript

The React website was a good starting point. React used JavaScript to create web applications.

Learning JavaScript

Learning TypeScript

TypeScript mixed “some Java into JavaScript”, such as types — hence the name! You had to use TypeScript with Angular. And you could use it with React.

The “TypeScript for Java/C# Programmers” article offered a starting point. If you liked it, the TypeScript handbook was your friend, also available as Epub and PDF.

Learning React

Flutter & Dart

The Flutter website was an excellent place to get familiar with Flutter. Flutter used the Dart programming language to build natively compiled applications for mobile, web, and desktop. Both Flutter and Dart could use plugins from a great portal.

Learning Dart

You started with the Dart language tour. Java developers then took “Intro to Dart for Java Developers”. After that, you had options:

Installing Flutter

The installation instructions came straight from the Flutter website:

Learning Flutter

A selection of Flutter tutorials and courses: