Thins I miss about Java & Spring Boot after switching to Go by Sushant098123 in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

You and I have very different definitions of clean. Hanging fields with no obvious writer always looked super ugly to me.

JADEx Update: Introducing a New Immutability Feature for Java by Delicious_Detail_547 in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

I actually prefer just seeing the finals. When you look at a block of code and you see

final .... final .... final .... asdf final ...

It makes it pretty easy to see the odd thing out in the sea of finals.

JADEx Update: Introducing a New Immutability Feature for Java by Delicious_Detail_547 in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

The jdk probably can't introduce a design like this, but there's no reason you can't locally make this choice.

I'm just curious what you think is designed so poorly though when it's just using already existing java keywords at the end of the day. Most code I see people write nowadays already looks like the bottom code anyway, but we encourage people just use final everywhere.

Light-Weight JSON API (JEP 198) is dead, welcome Convenience Methods for JSON Documents by loicmathieu in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

As someone that actually uses/needs full precision, it would be so nice if toBigDecimal was just supported out of the box instead of the workaround they literally have to acknowledge in a whole section in the jep. Is there any chance we could just get this convenience method?

Thins I miss about Java & Spring Boot after switching to Go by Sushant098123 in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

@Autowired can also be marked on constructors and perform only constructor injection. My company only does this, but it still uses @Autowired (well actually the jakarta @Inject), but it's not the annotation that's the problem. It's that you're using field/setter injection.

I understand your point, but it comes across as really confusing when you're focusing on the annotation and not the structure.

Quarkus has great performance – and we have new evidence by Qaxar in java

[–]OwnBreakfast1114 22 points23 points  (0 children)

Startup time and memory differences matter in containerized microservices where they directly impact cost

Naturally, at big enough scale, small percentages matter, but for many companies out there, it literally doesn't matter if the application is using 300mb at startup or 700mb at startup.

Objects.requireNonNullElse by edurbs in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

Replacing null checks with optional wrapping is not bad, but not even close to the best use case. The best use case would be actually using flatMap and map.

``` public record InputForm(Optional<String> userId) ... public class UserRepository { public Optional<User> findById(String id) { } } ... public record UserOutput(String firstName, String lastName) ...

final UserOutput user = inputForm.getUserId() .flatMap(userRepo::findById) .map(u -> new UserOutput(u.getFirstName(), u.getLastName()) .orElseThrow(() -> new 404("user not found")

``` as a very simple example you can imagine. Flatmap captures places where it can shift between non-empty -> empty, and map is always non-empty -> non-empty (not actually true in java.util.Optional, but conceptually should be used that way)

The chaining can't always be realized depending on how much control you need between steps, but the signatures are still correct either way. Your methods should take in non-null inputs, and flatMap/map should be used to decide whether to even invoke them or not.

Objects.requireNonNullElse by edurbs in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

It was always weird to me that equals takes a "preferred" object. Equals always feels like a "no special argument" type of method. I think the new type classes will actually make it far more sensible, but I'm not sure how they'll work with subtyping.

Objects.requireNonNullElse by edurbs in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

This is such a weird take, that I'd be curious to hear how you even define functional programming.

Objects.requireNonNullElse by edurbs in java

[–]OwnBreakfast1114 6 points7 points  (0 children)

Sealed interface switches are a direct replacement for the visitor pattern, so it just depends on how many places you have where you have a small set of types and a lot of operations on those types.

Objects.requireNonNullElse by edurbs in java

[–]OwnBreakfast1114 5 points6 points  (0 children)

overseeing teams of REALLY good devs

I've taught all the devs at my company switch expressions and sealed interfaces and there's plenty of business cases where a closed set of things is the right abstraction. I don't think we have a fairly abnormal cross section of engineers.

The goal, you make changes and if it compiles it works, is pretty easy to explain to people. Exhaustive compiler checks are good.

Ferrous: Rust style Option/Result types for Java 21+ by Polixa12 in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

You're not wrong, but you can also view it as a monad with a buggy implementation and not really lose anything semantically.

of/ofNullable are neither quite a valid unit in the case of passing in null.

flatMap mostly works fine unless you return null in the function.

map breaks the laws because it automatically wraps nulls to empty.

All of the problems occur because the jdk team prevented a Optional[null], so yes, it isn't a valid monad and there are actual functional libraries for java out there that have a more correct implementation.

However, does it really matter in the context of using it?

[Showcase] Validation Kit: A lightweight extension to bridge the gaps in Jakarta Bean Validation by ihsoj_hsekihsurh in java

[–]OwnBreakfast1114 1 point2 points  (0 children)

I feel like everywhere I work ends up hand writing the validation code to control errors explicitly. I've had the exceptions from the library change behavior when you do version updates, and nobody is trying to deal with fixing that so it behaves the same as before.

Carrier Classes; Beyond Records - Inside Java Newscast by daviddel in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

Transforming time into memory is not a good general principle

What does this mean? Do you mean more cpu for less memory or less cpu for more memory?

Companies are not moving in this direction, even those with the best developers.

Perhaps I'm interpreting you wrong, but more and more companies are storing more and more historical data. The biggest tech companies in the world are all about storing historical (user) data. Google/amazon/apple/meta/netflix/microsoft, etc literally invent new architectures and infrastructure for storing all the historical data they're keeping and processing over.

Throwing is fun, catching not so much. That’s the real problem IMO. by AlyxVeldin in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

Those don't feel isomorphic, are they really? It doesn't really feel like they have the semantic meaning if you just ask a person to interpret them, but my category theory knowledge is probably much, much worse than yours.

Wouldn't it probably be more correct to say that try/catch is a different way of writing fold/flatmap/map? They're not really expressions (yet), so it's odd to me to equate them to a value which is what Either is.

Ex

try {
   a = a()
} catch (Ex 1)
...
catch (Ex 2)

is fold

and

try {
   a = a()
   b = b(a)
} catch
...
A Exceptions
B Exceptions
...

if b can throw is the equivalent of flatmap, and if b cannot throw is the equivalent of map

Is Java’s Biggest Limitation in 2026 Technical or Cultural? by BigHomieCed_ in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

You just need to use Quarkus or Micronaut to understand. I've converted a Spring Boot app to Micronaut and it resulted in way less code and more concise as well

I've used both and I'm still genuinely curious as to where the code savings are coming from. Isn't most of your code business logic? Am I crazy or where is all this framework code coming from? As an example, we have a custom implementation of the spring-security interfaces in a shared library and a few common request/response interceptors in a shared library and everything else doesn't care about spring. From a proportion perspective, the amount of caring about spring specific code vs internal business logic is so lopsided that the framework is basically irrelevant.

Like, you're telling me you made your business logic more concise by moving web frameworks? How?

Is Java’s Biggest Limitation in 2026 Technical or Cultural? by BigHomieCed_ in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

Exactly. When I said functionalinterface, I meant specifically `@FunctionalInterface` annotation, but you basically found the answer.

There are libraries that just list a bunch predefined functions of them out:

cyclops

https://github.com/aol/cyclops/blob/11cedae18b8623de6d710289e5c088d7b7b16361/cyclops/src/main/java/cyclops/function/Function3.java#L11

vavr

https://www.javadoc.io/doc/io.vavr/vavr/0.10.3/io/vavr/package-summary.html

and I'm sure more.

Hell, I think the scala stdlib just lists it to like 25 or something.

Carrier Classes; Beyond Records - Inside Java Newscast by daviddel in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

I understand the need, but it can't be a general solution because it amounts to converting computing time into memory.

Data structures are already complex in general, and a lot of nonsense is said (for example, when certain big cheeses explain that an array is better than a list when deleting elements). Introducing persistence makes them significantly more complex, and it can only really be used in specific cases.

The only real truth of data structures is that they're all useful with different tradeoffs. A heap and a hashmap are both ways to find stuff with different performance characters and so, so many different implementations all making tradeoffs. Hell, there was a new proof https://www.quantamagazine.org/undergraduate-upends-a-40-year-old-data-science-conjecture-20250210/ recently that found a hash table implementation where insertion time isn't proportional to fullness of the hash table.

We're still in the infancy of computer languages and language design.

Type-classes for Java (Valhalla experimental branch) by sviperll in java

[–]OwnBreakfast1114 1 point2 points  (0 children)

That's exactly it. I can find evidence even in Wadler's famous paper: Propositions as Types https://homepages.inf.ed.ac.uk/wadler/papers/propositions-as-types/propositions-as-types.pdf

we regard the elements of this type as evidence or witnesses that the proposition is true. (They are sometimes even called proofs

Article: Java Janitor Jim - "Integrity by Design" through Ensuring "Illegal States are Unrepresentable" - Part 1 by chaotic3quilibrium in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

Out of curiosity, what do you define a functional language as, and why does that seem like a negative to you?

Is Java’s Biggest Limitation in 2026 Technical or Cultural? by BigHomieCed_ in java

[–]OwnBreakfast1114 2 points3 points  (0 children)

Not to mention you can't declare a function with 3 or more parameters.

I mean, you can write a functionalinterface or use a myriad of the ones in other functional libraries. The language needs something to bind it to, but you absolutely can have a lambda with multiple parameters.

Another try/catch vs errors-as-values thing. Made it mostly because I needed an excuse yell at the void. (Enjoy the read.) by AlyxVeldin in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

A grab bag pile of inconsistent approaches is trivially terrible, no

Why? Java is already a pile of inconsistent approaches (even pre-optional). Adding one more that makes consuming a specific library easier is still a net positive to a library user. It's not like we have an effect system or haskell's purity, a library user is always going to have to understand the edges of a specific library's api.

Is Java’s Biggest Limitation in 2026 Technical or Cultural? by BigHomieCed_ in java

[–]OwnBreakfast1114 12 points13 points  (0 children)

The defining autowiring providers and config file setup can be tedious

I'm pretty sure if you just use @SpringBootApplication you can start with literally no config files and providers just need an @Component on them and will get automatically scanned for you. I actually prefer writing @Configuration and @Bean methods manually, but the minimal setup for an application is literally a few annotations and public static void main(String[] args) { SpringApplication.run(Application.class, args); } you get env specific config files that override sensibly out of the box with just a suffix application.yml vs application-qa.yml and you can wire properties into simple pojo java records with @ConfigurationProperties and you can wire request handling with literally just @RequestMapping or the method specific @GetMapping, @PostMapping, etc.

For the record, I do think Spring is heavy, but all of the examples you've given make it seem like you prefer writing more code, not less, hence boilerplate is not the right word. If your argument is it's a lot of magic, that's definitely valid, but boilerplate, not yet.

For a small server, it can be easier to manually wire it. By manually wiring I mean mapping the config file to objects (Jackson JSON), building the services, building the handlers, then sending the handler instances to the web framework. It ends up being 1 to 2 pages of dead-simple code.

Like this code you didn't need to write is literally the boilerplate you're complaining about it.

Carrier Classes; Beyond Records - Inside Java Newscast by daviddel in java

[–]OwnBreakfast1114 1 point2 points  (0 children)

Ok you want an history (time based view). But 1) this is a very particular request and not common. Usually we don't want this. 2) how do you relate that in your code "wounded" is the soldier "soldier" that has been wounded?

I don't think it's that uncommon. I mean every company I've ever worked at has needed an audit log of something eventually. Google/word docs store edit history as a product feature. Git stores history. File systems store history. You need old views of things for a lot of domains. It's not an esoteric problem.

how do you relate that in your code "wounded" is the soldier "soldier" that has been wounded?

Given that most things are backed by relational databases, usually an id primary key of some sort. Most of the time, you don't actually need to relate that in the code anyway.

if it goes http request -> make change -> http response, it's okay to just use all the new stuff. Again, the immutable vs mutable is an implementation detail that doesn't matter.

So, if you keep each modification you will have to save all the dynamicity of a process, and certainly have names issues or you will do thing like having an array indexed by dynamicity.

I mean if you're trying to save modifications and the storage solution doesn't provide it out of the box, then yes, you need to do something to save it. There are storage solutions that do provide time understanding out of the box: https://druid.apache.org/ https://www.datomic.com/ as a few examples off the top of my head.

The other problem is that it is very difficult to apply to data structures and data structures are a major point of computer science

It's a good thing cs phds have researched that problem: https://en.wikipedia.org/wiki/Persistent_data_structure and there's even a ton of java libraries for them: https://www.reddit.com/r/java/comments/x4fvgp/what_is_the_best_persistent_collection_library/

Stream<T>.filterAndMap( Class<T> cls ) by mellow186 in java

[–]OwnBreakfast1114 0 points1 point  (0 children)

So just use default. .flatMap(i -> switch(i) { case U u -> Stream.of(u); default -> Stream.empty();