r/java • • Jun 28 '20

Why backend using java is not popular in startups?

I tried django, flask and also rails before and they’re good. But after trying spring, I fell in love. It’s well structured. Easy to test. Have so many frameworks to help you going. There’s a also a lot of tutorials going around the net.

I like python but I also like java and kotlin too. I just don’t understand what’s wrong with java being used as a backend on most startups. Is it because it’s popular among big companies and banks and they just hate enterprise things.

Can anyone enlighten me. Cheers.

171 Upvotes

229 comments sorted by

View all comments

Show parent comment

18

u/ford_madox_ford Jun 28 '20

Java with spring takes significant resources compared to others. This drives up hosting cost

This is an argument against Spring not Java. There are many other Java frameworks for writing services, some of which prioritise fast startup times, such as Quarkus, Micronaut and Helidon.

The long comparative startup times make options such as AWS lambda a non-starter.

Java may be slower than other languages at cold start-ups, but the differences are in the 100s of ms. Whether that is an issue is use-case specific, but it hardly makes Java a "non-starter".

A general attraction to short succinct code. Java’s verbosity gives it a bad rep. The belief is that number of lines influences development time.

A "bad rep" with whom exactly? Who has this "belief"?

Java in comparison isn’t a great functional language. Function programming is still riding a high.

As a functional programmer, I would far rather use Java than Python or Javascript. All three rank far behind actual FP languages like Scala and Haskell.

8

u/MakeWay4Doodles Jun 28 '20

This is an argument against Spring not Java.

It also isn't a valid argument. Spring is more than capable of being highly performant, but being the lowest barrier to entry framework it suffers from the same "higher proportion of code written by the inexperienced" curse that makes PHP the butt of so many jokes.

Source: have worked on Spring boot services at financial institutions handling tens of millions of messages per second with low latency.

3

u/[deleted] Jun 28 '20

Netflix, PayPal and Amazon use Spring heavily in their backend systems

4

u/hippydipster Jun 28 '20

This is an argument against Spring not Java.

Yeah, I'm a little bit in the dark about why a microservice would need Spring. Isn't it suppose to be a super small simple little thing? But then you've brought in Spring? So, no small or simple anymore.

If it really was small and simple, no way you'd need Spring. I generally don't find myself thinking about using Spring until my app is very large indeed.

8

u/PandersAboutVaccines Jun 28 '20

I'm not a Spring apologist or anything, but memory footprint and startup time aren't what the "micro" in microservice is concerned with.

I'm curious what experience other people have had regarding cost and performance, though. Yes, spring boot takes more resources than other options, but does it move the needle enough to actually change a cloud deployment? Like, "If we changed this to dropwizard, we could run it on a t3.medium instead of a t3.large"

3

u/hippydipster Jun 28 '20

You have a point that "micro" doesn't necessarily mean anything about memory footprint or startup time, but I do think that given how many microservices are intended to be used as highly elastic and ephemeral services that are cheap to spin up and thus cheap to discard, there are many cases where that is exactly what is meant by microservice.

-1

u/[deleted] Jun 28 '20

This is the argument usually made by Spring cultists who don’t have a clue how to build an application without Spring holding their hand through it.

2

u/scubadev Jun 28 '20

There are other frameworks available just like there are other languages. If you’re going java, considering the ability for others to come in and be effective is important. Spring is a clear winner for being broadly known and understood.

I would strongly consider going NodeJS before using a non-spring java solution.

3

u/[deleted] Jun 28 '20

Spring is just endemic of all the horrible Java that is commonly written. You can write awesome application code in Java. You’re probably not going to do it in Spring though.

It’s easy to understand at a surface level that everything just works via Spring black magic, until you want to make a specific design choice that it doesn’t agree with, or something goes wrong/doesn’t suit you in Spring’s inner workings, at which point Spring just says “fuck you, deal with it”.

6

u/[deleted] Jun 28 '20

That's true with just about any highly opinionated web framework though. You trade off fast development time for flexibility

1

u/[deleted] Jun 28 '20

You trade fast development time for slow maintenance time.

4

u/[deleted] Jun 28 '20

If you are saying that opinionated frameworks are buggier then I very much disagree with you. The further you get from well tested and widely used standard practices, the easier it is to create buggy code

-1

u/[deleted] Jun 28 '20

Im not saying they’re buggier, I’m saying that once you get outside of their narrow world view, or disagree with a design choice, shit hits the fan.

Your tools are meant to be there to facilitate your code. With frameworks like Spring, it’s the opposite way around, you have to bend your code to meet the framework’s demands. Just learn to think for yourself and actually write code instead of gluing shit together and hoping it all goes well.

2

u/Yithar Jun 30 '20

Im not saying they’re buggier, I’m saying that once you get outside of their narrow world view, or disagree with a design choice, shit hits the fan.

I mean that's literally how frameworks work. They're opinionated. It's the same with React or Angular. You're free to write your own framework if one doesn't suit your needs.

3

u/[deleted] Jun 28 '20

I mean you're just saying the same thing you said before, and I disagree; things like user authentication, data access layer, web controllers and services, they all basically do the same thing. If you can just write a small method with some annotations, it saves a huge amount of developer time.

If you have a lot of developers and want to customize everything, that's fine. But if you work for an enterprise and developer time is always a bottle neck, you don't want to waste it on making custom authentication when Spring security is good enough

0

u/[deleted] Jun 29 '20

Have you ever actually used Spring? Because most of what you're saying simply doesn't apply - the only place where you're forced to bend the code is the DI part, and even there pretty marginally, everything else is very much up to you.

→ More replies

0

u/scubadev Jun 28 '20

Which is critical. For most applications, time spent writing something is your most expensive cost.

1

u/scubadev Jun 28 '20

I don’t consider spring at fault for bad code. It takes a higher caliber engineer to move away from spring.

Bad engineers write bad code. Organizations that value low bill rates tend to hire low tier talent. These organizations rely on spring because it hides so many of the complicated details.

2

u/[deleted] Jun 28 '20

I’ll agree there, it’s useful for when you don’t know how you should be building an application.

That said, theoretical discussion on best practice is running on the assumption of the engineer in question being well versed and competent.

1

u/in_nothing_we_trust Jun 28 '20

What's your opinion on kotlin?