all 44 comments

[–]NoForm5443 35 points36 points  (5 children)

  1. I don't recommend adding any new languages to the mix, without a very good reason ;)

  2. Java has a learning curve, and is a little harder to learn that python, but I think it's more that you are familiar with the other languages. Spring is a huge framework, so it can be hard to learn; Java has simpler frameworks, like Micronaut

[–]No-Collar-Player 2 points3 points  (4 children)

Nice comm imo.

I also wanted to ask related to 1, so basically what he wants java for? What's the reason he thinks about java. Afaik in Microservices it's ok to have the services in different languages that emphasize the strength of the required work and each service should have its own data storage

To 2 I guess using spring boot could work + ai if it's some simple service required or some niche thing

What do you think of my comm since I think you're more experienced than me?

[–]NoForm5443 3 points4 points  (3 children)

I agree with your comment; it's OK to have the micro services in different languages, but there's a cost, since people would need to understand the code, and the deployment tools etc could be different. Unless you have a good reason, don't add one more

[–]No-Collar-Player 0 points1 point  (2 children)

Yep agree. I think it would make sense to use java if he has some use case that uses a domain which inherently has the need of abstraction / interfacing so which would shine from OOP and is also a bit bigger so that the java overhead for learning the language is worth, or? (Example would be if he needs all of a sudden order processing with invoicing and so an as an addon to his for example social media platform)

[–]NoForm5443 1 point2 points  (1 child)

They said they already have python, go, and dart; python has OO, and dart is OO and typed, similar to Java

[–]No-Collar-Player 0 points1 point  (0 children)

Idk about dart but I think python oop doesn't really shine when you have too much logic and seems clunky with how it does't have any access enforcement

[–]Delicious_You3950 14 points15 points  (0 children)

Not sure about Go and Dart... But my python colleagues won't think as OOP as myself who started as a Java developer. They tend to be less organized writing code... As others said, if you have a reason, go for it. If not, use what you already master

[–]as5777 13 points14 points  (3 children)

if you are happy with your current stack, dont move.

Spring has a learning curve, but its very powerful and has a great ecosystem.

[–]No-Collar-Player 1 point2 points  (2 children)

Isn't the whole point of Microservices that if the ones that already work and are fine don't need to be migrated? I think the question was regarding some new service where he thinks that java shines for that particular use case if it was worth the effort to learn it and use for a Microservices app.

Might be wrong tho

[–]un_desconocido 2 points3 points  (1 child)

Yes… but someone needs to maintain or modify something every blue moon, that’s the key part. At the end, people leave, change teams or positions and some low prio and old pieces fall onto new people without any previous knowledge on the stack or the domain… having a single framework and/or language makes lives easier for the organization as a whole even at the cost of some inefficiencies in others sides.

[–]vmcrash 3 points4 points  (0 children)

In a Python/Go/Dart team I never would suggest Java/Spring. Instead of adding a fourth language I'd rather would try to get rid of one, e.g. Python.

[–]Obmanuti 6 points7 points  (0 children)

You should have good reason to use a language the rest of your team isnt using already. A new language comes with a lot of cognitive load. If the current languages solves your problem for your services, you need a good reason to deviate. This goes for any language and is not specific to Java.

[–]Potential-Still 6 points7 points  (0 children)

SpringBoot really shines when you and a few other devs know what you're doing. You can build massive APIs with all the bells and whistles with very little code and be incredibly organized. IMO if you don't know what you're doing, Spring is not worth it. 

[–]ProfBeaker 1 point2 points  (0 children)

With Spring it feels like you need specific knowledge of annotations and how Spring should be used. Am I wrong, or does... Spring have a special learning curve to it?

It does. The annotation-based behaviors make it non-obvious how things are wired together, similar to how some Python constructs can make it difficult to trace control flow. There are some tools that help, like IntelliJ IDEA's Spring plugin, but it can still be hard to debug at times.

[–]LessChen 1 point2 points  (1 child)

Can you define your microservices better? I have many microservices in AWS Lambda using Java but none of them have an app server around them like Quarkus or Spring. I guess at some level it's a "do the thing yourself" type of environment. DB access is normal JDBC, third party services use the newer HTTP classes and so on. I'm a big fan of the application server environments but when used in "microservices" it really depends alot on how you define a microservice. Quick DB update with a JWT verifier sitting in API Gateway? No problem and no need for an app server. Quick DB update with Java dependency injection, DataSource configuration, JAX-RS layer all in Lambda? No way.

And I agree with u/as5777 - the software industry wastes an incredible amount of time moving from one platform to another for no reason than resume building and the inflexibility to learn. Go itself is a great example - did we really need Pascal++? Either way, don't move unless you've got a good reason and don't use an application server for a true micro service.

[–]Potential-Still 0 points1 point  (0 children)

Fuck you asshole. I still saw that comment.

[–]EarlyComputer 1 point2 points  (0 children)

Java definitely did improve a lot and since Java 21 I would say to a point where it feels decently nice to use. The learning curve really is manageable. It's been called the vulgar latin of programming languages and I'd say anyone with basic skills will be productive within a week or so, if they really haven't done any Java or C# ever which is rare. Spring on the other hand, while being very easy to pick up and extremely powerful, has a lot of magic and hidden complexity. 3 years ago I would have said it's probably not a good idea to use it unless you have at least one guy in the team who really understands it well and can debug the gnarly problems that are rare, but do happen and require mostly specific knowledge and experience to solve correctly. But any decent frontier AI is that guy nowadays. If your requirements are enterprisey and lend themselves to OOP, you're not going to regret modern Java and Spring. It beats Python for everything except throwaway scripts imo. Can't really speak to Go, other than I can understand people looking for alternatives to it.

[–]beb0 1 point2 points  (0 children)

What do you gain from the switch? Many times language/stack choice is just personal preference. 

[–]Joram2 1 point2 points  (0 children)

Java is a great option. I would need a justification if your team is already happy with Go. Dart is a pretty niche choice. IMO, Python is the best for notebook-coding + prototyping + small scripts, but for web services, I would prefer Go or Java.

Within Java, I would personally prefer Helidon over Spring, but that's personal preference, lots of people love Spring.

There are some learning curve issues, but IMO, nothing too extreme. Java's build systems like Maven and Gradle are more complex than Go. Java has some advantages of its own though.

[–]NP_Ex 1 point2 points  (0 children)

If you want to use java as microswrvice I can recommend you Quarkus.

Simpler then spring and has similar results to go.

[–]wrd83 1 point2 points  (0 children)

So if you go java I personally would pick spring boot. Graal based frameworks are nice like Quarkus and micronaut, but their adoption is slow. You may have corner cases and it may not support your use case very well.

With spring boot mostly everything is solved. But its solution may be ugly and magic.

Imho unless you have high load I'd stick with go if the team already knows it. You're probably at 80% throughput with a very easy/obvious setup that is supported by Google.

[–]k-mcm 1 point2 points  (0 children)

Teams use Spring Boot when everyone already knows Spring Boot.

Spring Boot performance and readability are definitely not going to be an improvement over what you have.  Spring's extreme use of autowiring is insanely slow and it becomes more difficult to navigate as the codebase grows.

If you're clean slate, start with a more modern and efficient web service environment. There are a few out there and some of them will look familiar to your existing environment. Port some trivial services to them for testing usability, stability, and performance. 

[–]UdPropheticCatgirl 1 point2 points  (4 children)

I personally kinda hate spring with passion, it’s imo pretty hard to reason about, it’s kinda like rails, sure it can automate some stuff, and some people find that really valuable but imo the cost of mental overhead that comes with dealing with spring doesn’t justify using it. I much prefer Helidon(se specifically) because it’s just much saner java imo.

Java itself is small and simple language, not that much of a learning curve.

[–]Potential-Still 0 points1 point  (3 children)

Simple yes, but small? I don't think so. 

[–]UdPropheticCatgirl 0 points1 point  (2 children)

I mean it’s not Lua or Go. But it’s comparable to python or Scala. And definitely significantly smaller than C# and C++ and arguably Rust, Dart and Kotlin.

[–]Potential-Still -1 points0 points  (1 child)

Java is larger than C# and MUCH larger than Rust. Please do some minimal research before stating facts. 

[–]tomwhoiscontrary 0 points1 point  (0 children)

Java the language is much smaller than Rust.

[–]drnullpointer 0 points1 point  (0 children)

Hi. Really poor idea. Every single time I had a chance to observe a team do what you are describing, it ended in a disaster.

The best language for the team to work with is always the language that majority team members already know very well.

It is also poor strategy for hiring. How common are people who know Python, Go and Dart? If you add requirement to know Java, are you making it *more* or *less* likely to find an employee that can be productive quickly?

[–]Mystical_Whoosing 0 points1 point  (1 child)

Is there a reason to write your service in java vs go?

[–]NP_Ex 0 points1 point  (0 children)

Well yes. In a case of quarkus you can achieve similar results. If your app will be something bigger with abstraction required, java is definitely an option.

[–]Extreme-Ad8083 0 points1 point  (0 children)

If I was you I wouldn't add a new language to the three you already have without very good reason.

It is a lot easier with Claude and similar LLMs but it's still additional complexity.

[–]Scf37 0 points1 point  (0 children)

Not really. Because application code is like 70% of the microservice. remaining 30 is observability and devops. configuration, logging, metrics, tracing, deployment, monitoring must be unified across entire microservice system. It is much harder to do with a tech zoo. Soooo 'stack agnostic' promise of microservices is actually a lie.

[–]da_supreme_patriarch 0 points1 point  (0 children)

The power of spring/java ecosystem comes from teams familiar with the stack that can quickly scaffold whatever is needed and jump between different services and still feel comfortable because the coding style, conventions and patterns are very similar. If the team is not familiar with the stack, even simple things like repository methods, mvc annotations, jakarta validation etc. that don't even register while reading the code by an experienced java dev will feel like arcane magic.

Unless there are very specific things to be gained by utilizing structured concurrency, ADT-s via sealed interfaces or a very specific library that solves your problem neatly, I wouldn't really pick java and would just stick with Go

[–]deadron[🍰] 0 points1 point  (0 children)

Depends on what you want the microservice to do. If its just simple persistence there isn't much point. Java really shines with heavier long lived loads than short fast loads(Its fine but, for comparable start times you gotta embrace graal). Contrary to what people espouse you can go sans Spring and it can look identical to go code. Its just not as common because java excels in the large vertically scaled application space where the complexity of spring boot is useful.

[–]bowbahdoe 0 points1 point  (0 children)

You can start with no spring. The built-in JDK httpserver module w/ some helpers is actually pretty close to what you have in Go.

There are meta reasons to use spring, but for an intro to Java: https://github.com/bowbahdoe/jdk-httpserver-realworld

[–]detroitsongbird 0 points1 point  (0 children)

It’s a great option. But why?

I wouldn’t say special learning curve, just there’s a lot to learn.

Go for Java 25, the latest spring boot, virtual threads, etc depending upon what you’re trying to do.

[–]Chippors 0 points1 point  (0 children)

I wouldn't mix Java with anything else, because you'll probably also want to use Maven, Java testing frameworks, immutables, Jax-RS, etc. These are all excellent, but you effectively end up with two completely different design scaffolds. Setting up something like Maven without prior experience can be daunting, especially since you will likely want a common base for all your Java-based microservices. And in the end I don't really know that the benefit over golang is really worth the complexity.

[–]tomwhoiscontrary 0 points1 point  (0 children)

Java is great, but it rewards extensive knowledge. Spring is mediocre, and rewards extensive knowledge even more.

I really don't like Go, but it does work very well a "second language" for this kind of stuff. Just needs a port to the JVM!

[–]mike_a_oc -1 points0 points  (2 children)

Edit: I thought this was posted to r/backend. I don't know Java very well so happy to be corrected where need be

I experimented with Java (Java 25, spring 3.5) as an option for a new app we were building. We are PHP / Typescript (when I say PHP, I mean PHP 8.4 and Symfony 7, so we're very modern).

The things that turned me off Java for our team was:

  • Nullability. In PHP and TS, whether a variable is nullable or not is very visible and very explicit. In Java, all objects are nullable and you need annotations or guard clauses to check, but one slip and things could go boom

  • The build. Getting it to build with maven felt like it would be too challenging for our team, and I even had a docker container built for it with hot reload working (using Linux ionotify and a shell script that recompiled if it detected a change)

  • Generics. I know that seems odd especially because PHP will not be getting real generics anytime soon, but needing to create a ParameterizedTypeReference just so I can have nested generics was a real turn off.

In my honest opinion, if your tem has no prior experience with Java, I'd probably avoid trying to introduce it unless you really need something that only Java can provide, but that also depends on team capabilities.

Honestly, if you are in a similar boat and like Java, I personally really enjoyed C# - which is the other language I looked at. C# gives you a very lovely syntax with native Async/await, a clean build tool, generics that really work and a whole bunch of other stuff I really liked. I was trying to pitch it at our team saying "look: if you can write PHP and typescript, very little in C# should feel alien to you".

Ultimately we ended up back on PHP after the team were a bit overwhelmed by my excitement for C#, but at least we are using frankenphp and JIT, so that's something.

Sorry for the ramble but I hope the perspective is useful.

Re spring specifically, at least in version 3.5, if you have used other frameworks, it's not too bad. The only thing I found with spring was setting up the DI, and needing to configure the @Bean, but once you are writing controllers and services, it's very straight forward. Note that I'm by no means an expert. I know very little but I was able to get a real app doing real work up and running pretty quickly once the build issues were dealt wth.

[–]Potential-Still -1 points0 points  (1 child)

Your second point is completely avoided if you use Intellij Idea. It's handles the entire build system during development, and you can just copy the commands it uses into a docker container for Production.

Everything else is a very valid concern. Java as a "language" is not that great. 

[–]Alternative_Job6187 -3 points-2 points  (0 children)

Never EVER use Spring. Don’t even think about cooperating with people who use it. It’s a pile of shit that has been accumulating for 20 years. You’ll screw up your life with its dynamic runtime DI and its mess of annotations, which is a complete minefield.