Skip to content

Instantly share code, notes, and snippets.

@AdamBien
Created October 11, 2025 16:09
Show Gist options
  • Select an option

  • Save AdamBien/c15cc2ca8533d980525a0fb790105b4a to your computer and use it in GitHub Desktop.

Select an option

Save AdamBien/c15cc2ca8533d980525a0fb790105b4a to your computer and use it in GitHub Desktop.
140thAirhacksQ&A.md
@haydenjones
Copy link

haydenjones commented Oct 14, 2025

Hi Adam,

When working with user input, I hate whitespace. (hate, HATE, HATE)

I often find myself writing a POJO like:

public record UserForm(String firstName, String lastName, String location) {
	static String trim(Object o) {
		return (o == null) ? "" : o.toString().strip();
	}

	public UserForm(String firstName, String lastName, String location) {
		this.firstName = trim(firstName);
		this.lastName = trim(lastName);
		this.location = trim(location);
	}
}

Do you think this is a reasonable approach?

Should I instead look into using jakarta.validation?

Thanks,
new UserForm("Hayden", "Jones", "Toronto, Canada");

@AdamBien
Copy link
Author

AdamBien commented Nov 3, 2025

@AdamBien
Copy link
Author

AdamBien commented Nov 3, 2025

Time Machine (Topics from 8 years ago):

40th airhacks.tv: http://adambien.blog/roller/abien/entry/jaspic_lambdas_react_tx_jsf from 3rd July 2017:

"JASPIC for securing Java EE 7 applications, Thoughts on lambdas and more functional Java, Thoughts on AWS lambdas, The size of ReactJs -- and possible optimisations, Thoughts on custom servlet login module, How to handle transactions in Thin WARs, Primefaces as "one stop" solution, REST as communication "protocol" between Thin WARs, WebSockets vs. Long Polling, JSONObject as DTO and inheritance issues, Microservices and Jenkins, Opinions on Docker Swarm, Threads and EJBs, Is MVC dying (everywhere), Programmatically deploy and undeploy Java EE applications"

@muchiri08
Copy link

In the bce pattern, where do you place the global exception handling code? eg if I have booking and payment packages and I need to handle exception thrown in a central place(maybe switch(ex) return to user what happened), where will all these be?

This one is about entities and dtos. The usual talk I have heard is entity classes should not be used to transfer data we should use dtos. Eg if we are having an entity User, in the create user resource we should use like UserRequest dto, then map to user afterwards. Is this cargo cult or are there any valid reasons as to why most people say this? I have seen this in spring boot alot.

@haydenjones
Copy link

In your BCE design, in the Example: User Management, you have...

boundary - REST endpoints, Custom Elements, Lambda function handlers

Can you give an example of a Lambda Function Handlers? (Are we talking about AWS here?)

Can you also define what counts as a Custom Element? Are we talking about objects that are part of the business domain but don't fit within the Entity package? For example, if we are having a BCE for buying a plane ticket, would the data in a search form to find a flight be an example of a Custom Element?

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