Skip to content

Instantly share code, notes, and snippets.

@AdamBien
Last active December 3, 2023 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdamBien/24c8c38937cfa43c25676076c231896c to your computer and use it in GitHub Desktop.
Save AdamBien/24c8c38937cfa43c25676076c231896c to your computer and use it in GitHub Desktop.
117thAirhacksQ&A.md

Ask questions and see you at December, 3rd (Sunday this time, collides with: https://www.meetup.com/airhacks/events/297554282/) 8 pm CET: youtube.com/c/bienadam

Also checkout recent episode:

116th airhacks.tv

Please keep the questions as short and as concise as only possible. Feel free to ask several, shorter questions. I will also cover some questions in my "shorts" youtube.com/@bienadam/shorts between the shows.

Upcoming airhacks.tv events are also going to be announced at meetup.com/airhacks

New: the airhacks.tv discord server: discord.gg/airhacks

@AdamBien
Copy link
Author

See you at Sunday online, or Monday in Vienna: https://www.meetup.com/airhacks/events/297554282/

@Omar122
Copy link

Omar122 commented Nov 24, 2023

Do you think that your courses java ee bootstrap and effective Java EE still holds up today ? Are planning to.make new ones or update some of it?

@steveklewis
Copy link

I love your idea of Java monoliths on Lambda. What do you find is the most challenging part of architecting for the lowest cost? i.e. Is it the compute, or the data access patterns, etc?

@fercomunello
Copy link

fercomunello commented Nov 28, 2023

Hello Adam! :-)

I saw some of your web components tips and I really liked them for client-side applications. However, we know that some applications will need to be more web-friendly, so I ask if you have heard of hypermedia systems?

The fundamental idea is to server-side render hypertext pages and enhance them without SPA frameworks, achieved by extending the HTML capabilities with HTMX. Also, we could avoid full page reloads on a traditional multi-page-application using our favorite server-side language which is Java! :-)

why should you only be able to replace the entire screen?
why should only <a> be able to make HTTP requests?
why should only GET and POST methods be [available] on <form>?
-- motivations from htmx.org

@fercomunello
Copy link

Moreover, did you have heard of JTE (Java Template Engine)? https://jte.gg
Here's a powerful web stack? HTMX + JTE or even JSP.

  • JTE almost looks like JSPs since it supports pre-compilation so it's not a general interpreted template engine like the others;
  • It is agnostic of Java stack because we integrate JTE as a view for Jakarta MVC, Vert.x and also Quarkus (i'm working on an extension to have +1 alternative to Qute) for instance;
  • It can be live reloaded for development environment keeping pre-compilation only for production;
  • Higher rendering performance (and with ~ few CPU usage) even for web pages with a lot of content.

I will like to see JTE becoming a Jakarta EE or MP spec. as an alternative for JSP and Jakarta Faces! :-)

jte-intellij

@grimly
Copy link

grimly commented Nov 28, 2023

Hello Adam,

I follow your podcast and your first question to all your attendees is "What was your first computer ?". But I never recall you answering your own question so here it is :

What was your first computer ?

@AdamBien
Copy link
Author

"can i ask you to tell me a little more about your experience with the lambda snapshot option, i have seen your videos, i mean project experience. I made a snapstart lambda that takes 1 record from postgres, and I have quite large numbers of both initialization and invocation (1+ sec for each of them), I added quarkus-preload-classes.txt but I wouldn't say that it helped much"

(from https://discord.gg/airhacks 👉 https://discord.com/channels/1042522430876438549/1042522430876438552/1179142759198765066)

@scrmtrey91
Copy link

Hi Adam.

Application:
Frontend is Vaadin 23 with CDI, JavaEE 8 backend + jax-rs web services (without spring boot) - multi module maven project
The service (interface) for getting data and bussines logic is injected (injected from BL jar module) directly into UI classes or views. The scope is @Local for service and @stateless for control.
User log in and get JWT. We can pack information about locale into JWT no problem.

As of now we set default locale in JVM. So getting translations from frontend, backend and JPA validation was not a problem because of locale.getDefault accesible everywhere in the code.

But now the requirment has changed to per user locale.

User can choose its own locale in the UI settings. Translation for the UI components like button caption etc its not a problem.

We also have *.properties (resource bundle) for translation strings by key..

Structure:

  • BL module jar
  • Data module jar
  • Localization module jar (properties files and get translation helpers)
  • UI vaadin module war

Problem #1:
How to get locale from UI user to backend (in fancy way, maybe with context or somehow) ? Also how to get translation for enums (static methods etc...) ?

We can do as new parameter to each method but that would be a lot of work for every method call in the application (not that small app).

Problem #2:
How to get JPA validation based on user locale ? On the frontend we use binder (bean validation directly from jpa entities) from vaadin most of the time for forms and such.

Problem #2:
External usage of web services (with JWT), we can pack information about locale into JWT no problem. But then the #1 and #2 problems occurs again.

I hope i provided enough information. If not maybe in next one with additional information.

Thanks for your answer. Keep up the goor work.

@AdamBien
Copy link
Author

AdamBien commented Dec 3, 2023

Discussion:

Resource interface -> Resource Impl -> Service Interface -> Service -> Repository Interface -> Repository Impl - 6 layers of abstractions and half of them is useless. I hate this pattern
I am glad that in microservice world less and less projects are using this approach

[from https://discord.gg/airhacks
/ https://discord.com/channels/1042522430876438549/1042522430876438552/1180139279180116068]

...and https://www.adam-bien.com/roller/abien/entry/service_s_new_serviceimpl_why

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment