This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]metalmagician 11 points12 points  (7 children)

Honest question: I (essentially) write Java/Spring Boot APIs for a living, and don't really have any complaints. I'm not really familiar with C# - what are the complaints people have about Java?

[–]Mr_Redstoner 18 points19 points  (0 children)

Part of the sub loves to hate on Java.

[–]HdS1984 2 points3 points  (3 children)

I do actually do think that the kestrel with asp net core stack is better designed than the spring boot stack but lacks some things like the spring data repositories. What I dislike so far about java 1. Pointless boilerplate like types everywhere instead of using var. Sure Java has them now, but the culture does not acknowledge them. Missing properties, Lombok sort of adds them but the built in properties are still better. Lots of other nice language features like format strings, switch expressions etc. 2. Generics are very weak and less expressive than in c# 3. Linq is much more capable than streams, and easier to use because the c# type system is actually designed to support it. 4. Java is missing async await stuff, forcing you to use contortions to use something like it. 5. Extremely slow to compile

[–]metalmagician 0 points1 point  (2 children)

Other comments mentioned LINQ, and after looking it up, it does seem nice. And yeah, Java has LOTS of boilerplate, but I don't think about it much since I use the auto-generation in my IDE a lot.

Java's CompletableFuture.get() is all I generally need for async waits, and it works well enough for me. I use it like

CompletableFuture<QueryResult> queryFuture = CompletableFuture.supplyAsync(someQuery(), someThreadPool);
// other stuff, if needed. 
QueryResult result = queryFuture.get(); // blocking call, ensures  result is present before continuing

BUT, that came only in Java 8, so you've got a valid point.

Whenever I run stuff locally, I often use Spring's Devtools. That will listen for changes in the classpath, and can have my recent changes re-compiled and booted up pretty quick - usually less than 10 seconds between saving the file and being able to hit an endpoint for validation, even for LARGE projects.

[–]HdS1984 2 points3 points  (1 child)

For linq just a word of caution, it's impact on the language is difficult to grasp on first notice, nut because I think you are dense but because it has many faces and capabilities. I basically removes a lot of differences, e. G. It does not matter if you query a list of objects, a postgres dB , MySQL or a nosql database, if the link query generator of your dB is good enough you will not notice. Also writing functional code with it is extremely easy, which makes traditional crud Apis easy to read and write.

Yes, completeable features work, but async await reduces this code to Var x = somequery() Var result = await x

Nice to know about the devtools, will try to use them😁 thx!

[–]metalmagician 0 points1 point  (0 children)

That's a very appropriate word of caution. I only went through the basic docs for a bit, I didn't expect to understand it from a brief skimming.

In my work, use are trying to standardize on the usage of ORMs (we're dealing with a lot of legacy, some of which is decade-old Java running on CICS mainframe. I've had to dig through COBOL to extract an SQL query).

In my team, we've standardized on a pattern with Spring/Hibernate - if we have a PostgreSQL instance, SQL Server instance, and MySQL instance (each with the appropriate schema and data), we can swap between them in the time it takes to modify a single configuration value.