Why Don’t You Use Java for Programming the Client-Side Web Apps on Web Browser?

I would like to know, what are the obstacles for you as Java developers not using Java as programming language for writing Web browser apps. Web browser apps are client-side and not server-side Web apps. For running Web browser apps you mostly don’t need a Web server, you just need HTML, CSS and JavaScript files.

I’m doing Web browser programming using Java with GWT / J2CL and surely it is not perfect because the Web browser APIs feel very JavaScript but I have following advantages:

  1. We use Java as the language
  2. We have the best ecosystem like libraries, frameworks, build system and IDEs.
  3. We know best design patterns to make our apps maintainable like Dependency Injection, Mock Testing and many other just take a look at: http://bit.ly/DesignPatternsJava
  4. … and if you use Java on the server-side with Spring Framework or JavaEE you have one language through the whole stack. So, you could reuse Validation APIs, Business Rules, Business Model, etc. from server to client.

In the mean time I have written following articles in this domain:

… and also I created a collection of GWT / J2CL information as Padlet: https://bit.ly/GWTIntroPadlet

I know that for “Hello World” or trivial Web browser apps I don’t need Java with transpiler. In this case I just write a simple JavaScript. But in our daily jobs we don’t write “Hello World” apps and the maintenance of those apps is very important, therefore we use language like Java for its strongly typed and the things I’ve shown you above. This is also the reason why we see TypeScript everywhere today. VueJS 3 is completely written in TypeScript.

Anders Hejlsberg creator of TypeScript said in an interview:

The interview was very interesting, definitely a must read: http://bit.ly/AndersHTypeScriptInterview

Also my question goes to the use of TypeScript. You also use a transpiler in TypeScript so actually it is just similar to Java with GWT / J2CL. Why would you use TypeScript as a Java developer?

I know that for JavaScript developers TypeScript is much “nearer” in comparison to Java. Here is the definition of TypeScript:

But for Java developers? I don’t think that TypeScript has advantages over Java. Therefore my conclusion is:

  • If you are coming from Java use Java on Web browser with GWT / J2CL transpiler.
  • If you are coming from JavaScript use TypeScript on Web browser.

One last point, maybe a lot of Java developers only work on server-side (backend) and not on client-side (Web browser), so there is no need to write something on Web browser?

Thanks a lot for your input!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store