Author: Karsten Silz
Apr 18, 2021   |  updated Oct 6, 2021 15 min read

Permalink: https://betterprojectsfaster.com/learn/talks-jaxlondon-2021-how-to-build-front-ends/

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

JAX London logo

Table Of Contents

Talk

Conference

JAX London is a hybrid conference that brings together cutting edge software engineers and enterprise-level professionals innovating in the fields of JAVA, microservices, continuous delivery and DevOps. I’m excited to give a session there on “How Should Java Developers Build Front-Ends for Web, Mobile & Desktop Today?" during October 4–7, 2021. I will look at various frameworks from a Java developer’s perspective and suggest which one to use in three common scenarios.

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

Abstract

Users access applications on PCs and mobile devices today. There are two obvious ways to build front-ends for these devices: Web applications and native applications. Cross-platform UI toolkits combine advantages from both approaches. Examples are Google’s Flutter, JavaFX, Facebook’s React Native, and Microsoft’s Xamarin. Important web application frameworks are Google’s Angular, JSF, Facebook’s React, Thymeleaf, Vaadin, and Vue.js.

I will look at all these toolkits from the perspective of a Java developer and suggest which one to use in three common scenarios: New web application, new native iOS & Android apps, and what to do on the desktop when we have a web application. Based on my experiences using Google’s Flutter for native mobile apps in my SaaS start-up, I will highlight what’s good about Flutter and what’s not.

Why Should You Listen To Me?

I’m neither affiliated with the projects I’m discussing nor selling books or training courses. I share industry analysis and my project experiences to give you options for your next project. I use 12 criteria for my evaluation. You may use my criteria or pick your own or weigh my criteria differently than I do. But you need to apply your criteria in your own environment and make your own choices.

Summary

Here is my advice for “Building New Application”: If you’ve worked with any of the “Big Three” frameworks, then keep using them. Otherwise, evaluated React, Angular, and Vue.js in that order.

Building a Web App From Scratch
Building a Web App From Scratch

Here is my advice on “Building New Native iOS & Android Apps”: If you’ve used Flutter or React Native before, then keep using them. Otherwise, evaluate Flutter and React Native in that order.

Building Native iOS and Android Apps
Building Native iOS and Android Apps

And this is my advice on “Got Web Application - What Now on Desktop?": Keep your web application. If yo’re ok with Flutter’s constraints, then evaluate Flutter for Desktop.

What to Do on Desktop When You Have a Web Application
What to Do on Desktop When You Have a Web Application

Rate My Talk

This will be posted shortly before the event.

If you’ve seen my talk, then please rate it!

This is the feedback I got on my talk. Please note that you can view the second page with the arrow button in the bottom left.


Slides

Here are the slides as PDF. They are 2.5 MB:

You can also get the slides in their original Keynote format. “Keynote” is Apple’s presentation application. Why would you do that? My slides have less text than the PDF version, so you can see what I cut. I also animated the slides, so they are more pleasant to watch. Or maybe you want to peek under the hood to see how I achieved specific effects. These slides are 14.7 MB in size.

Videos

Talk

The link to the video will probably be available here after the talk. It may be behind a paywall.

Flutter Hot Reload

Flutter Hot Reload makes code changes go live in the device/simulator immediately. It’s the main reason why working with Flutter can be such fun! I mentioned it in the talk. Here is a video demonstrating it.



Mobile App Prototype with Flutter

Although it’s a bit old, this is still a decent example of what a native Flutter app can look like. I’m not ready to share the app I’m working on - sorry!

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


Progressive Web Application Prototype

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






Looking For Project in February 2022!

And now for some shameless self-promotion: I’m looking to join a project in February 2022, in Milton Keynes, London, or remote. I’ll work as a contractor or fixed-term employee but don’t take permanent positions. Interested? Then check out my resume & work samples!


This week in "How to Build Java Applications Today":
Oracle's Ron Pressler thinks most Java developers or their bosses don't care about money, Spring 6 supports Java modules, Adoptium OpenJDK Java 17, Micronaut 3.0, and Spring Boot 2.5.5 & 2.4.11.

Sign up to my newsletter




Additional Talk Information

Java Developer Wish List for Front-Ends

Declarative Front-Ends
Apple’s SwiftUI

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
@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 is 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 looks like in Flutter:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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 is Google’s Android implementation of declarative front-ends. So Google has 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 in this tutorial to look like the SwiftUI sample above:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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 is part of .NET 6 and was recently delayed from November 2021 to Q2/2022. And if “Maui” rings a bell for you - it’s the second-largest island of Hawaii.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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 looks like in Facebook’s React for web applications. I adapted it from this Stackblitz sample. You see some HTML code in there because I don’t use components to keep things simple. If I did, it would look as declarative as the other examples:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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 - it shows how unpopular JSF, Vaadin and Thymeleaf are today:

Google Search Trends for All Web Frameworks
Google Search Trends for All Web Frameworks

Here is the link for the chart above with Angular, JSF, React, Vaadin and Vue.js in Google Trends. Thymeleaf is not on the list because Google only allows 5 search terms. Here’s a version of that link with Thymeleaf instead of Vaadin.

These are the Stack Overflow Trends for all frameworks. As you can see, JSF, Vaadin and Thymeleaf aren’t popular anymore:

Stack Overflow Questions for All Web Frameworks
Stack Overflow Questions for All Web Frameworks

This is the link for the chart above: Angular, JSF, React, Thymeleaf, Vaadin and Vue.js.

Udemy only reports course students if they are beyond a certain threshold. Neither JSF, Vaadin nor Thymeleaf exceed it:

Udemy Students for All Web Frameworks
Udemy Students for All Web Frameworks

Here are 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 makes clear that there are too few jobs for JSF, Vaadin and Thymeleaf:

Mentions in Indeed Job Ads for All Web Frameworks
Mentions in Indeed Job Ads for All Web Frameworks

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

Here are 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 is counted both as a result for React and Vue.
  • Searching for React also shows results for React Native. I subtracted the number of React Native from the React results.
  • The word “react” often appears in job advertisements. In countries where I didn’t have the translations for the various forms of “developer” (such as China or Russia), I manually adjusted down the number of jobs found down.
  • Flutter Entertainment is the world’s largest online betting company. Although I’m looking for developer posititions, this may inflate 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 deflate the number of jobs found for Vue a bit.

You can find the detailed search results with links here:

Ranking

I ranked React fastest for two reasons:

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

New Native iOS & Android Apps

Popularity

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

Here are the Google Trends - it shows how unpopular JavaFX and Xamarin are today:

Google Search Trends for All Cross-Platform Frameworks
Google Search Trends for All Cross-Platform Frameworks

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

These are the Stack Overflow Trends for all frameworks. As you can see, JavaFX and Xamarin aren’t popular anymore:

Stack Overflow Questions for All Cross-Platform Frameworks
Stack Overflow Questions for All Cross-Platform Frameworks

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

Udemy reports that relatively few people learn about JavaFX and Xamarin:

Udemy Students for All Cross-Platform Frameworks
Udemy Students for All Cross-Platform Frameworks

Here are the search queries for the Udemy course data:

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

Mentions in Indeed Job Ads for All Cross-Platform Frameworks
Mentions in Indeed Job Ads for All Cross-Platform Frameworks

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

Flutter is at a special disadvantage on Indeed. Often, you find the following in job ads there: “Experience with a cross-platform framework like Xamarin or React Native required”. Now Flutter is a cross-platform framework, and it’s the new kid on the block. But if you just have “Flutter” in your resume, you still may not get the job:

  • First of all, most big companies today use Applicant Tracking Systems (ATS). These systems scan your resume automatically for keywords. So if “Flutter” isn’t an approved keyword, you’re out.
  • The next stage is the agency or HR department. They typically have no clue about programming. And how could they? They hire people in all sorts of professions. So if they don’t know about “Flutter”, you’re out again. It’s not all sunshine and roses, you know!
  • Hopefully, the developers at the end of the process do know Flutter.

These are the same search results as above:

React Native Vs. Flutter
  • React Native always uses a JavaScript VM to run our applications. Flutter uses a Dart VM during development and compiled native code when deployed. That’s faster.
  • React Native manages the native iOS/Android UI elements through a JavaScript bridge. That’s slower than Dart: Dart uses the Google open-source Skia Graphics library. Chrome and Firefox, Chrome OS, and Android also use Skia. But this also means Flutter only paints pixels: It has 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 at 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. I’m not sure if this is just a test by Toyota or if they already decided to go ahead with Flutter for production.
  • In May 2021, Google announced that more than 1 in 8 new apps in their Play Store use Flutter, for a total of 200k apps at that point.
  • Google’s Fuchsia OS uses Flutter and rolled out to some Google Nest Hub devices.
Responsive Design

Flutter gives us little help on responsive design: Find out the screen width and change your UI. Wonderful! So no grid, like in Bootstrap or the more powerful, but also more complicated HTML version. Anyway, I went with flutter_bootstrap for now.

Notable Flutter Plugins

Getting Started

React & JavaScript

This will be posted shortly before the event. The React website is a good starting point. React uses JavaScript to create web applications.

Learning JavaScript
Learning TypeScript

TypeScript mixes “some Java into JavaScript”, such as types. Hence the name! You have to use TypeScript if you use Angular. And you can use it with React.

You can take a peek in the “TypeScript for Java/C# Programmers” article. If you like it, then the TypeScript handbook is your friend, also in Epub and PDF.

Learning React

Flutter & Dart

This will be posted shortly before the event. The Flutter website is an excellent place to get familiar with Flutter. Flutter uses the Dart programming language to create natively-compiled applications for mobile, web & desktop. Both Flutter and Dart can use plugins that have a great portal.

Learning Dart

You start with the Dart language tour. Java developers take the “Intro to Dart for Java Developers” next. Then you have options:

Installing Flutter

Here are the instructions, straight from the Flutter website:

Learning Flutter

Here’s a selection of Flutter tutorials and courses:

Part 6 of 11 in the Conference Talks series.
« W-JAX Munich 2021: "Pick Technologies & Tools Faster with JHipster" | JJUG CCC 2021 Spring: "How Should Java Developers Build Front-Ends for Web, Mobile & Desktop Today?" » | Start: Java Forum Stuttgart 2019: "When Using the Application Generator Jhipster Is Worth It - and When Not"

This week in "How to Build Java Applications Today":
Oracle's Ron Pressler thinks most Java developers or their bosses don't care about money, Spring 6 supports Java modules, Adoptium OpenJDK Java 17, Micronaut 3.0, and Spring Boot 2.5.5 & 2.4.11.

Sign up to my newsletter


comments powered by Disqus