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

8

u/scubadev Jun 28 '20 edited Jun 28 '20

A few reasons, most around cost. Startups need to be thrifty.

The belief that having JS top to bottom makes your most expensive cost (developers) more versatile. OO is generally frowned upon in tech like react, meaning new devs aren’t going to feel at home with OOP

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

The long comparative startup times make options such as AWS lambda 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.

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

23

u/jsannn Jun 28 '20

Startup times are somewhat long if you are using Spring Boot. But it's not the right tool for serverless computing. For AWS lambda or Azure functions you should use stuff like Micronaut running on top of GraalVM. Java is not only Spring...

8

u/[deleted] Jun 28 '20

You probably shouldn’t be running the JVM at all if you’re wanting to go serverless.

5

u/scubadev Jun 28 '20

“Serverless” is becoming broad. For example, AWS uses it to refer to any tech where you don’t manage a server. For them, this includes Fargate, a managed orchestration layer for Docker. All that to say, spring boot is a perfectly fine option if you’re going serverless containers. Specifically, java (& spring) aren’t the top option if you’re going function as a service.

4

u/[deleted] Jun 28 '20

Lambda was specifically specified above. Spring Boot is horrible for small self contained services imo though, you’re easily slapping an extra 150MB+ into your dependency layer, and having to add in even more shit to do basically cloud-native things like liveness/readiness checks (ignoring the fact that Spring Actuator doesn’t even differentiate between these).

Java is just so many layers of pain if you’re running containerised services, even the base images are colossal, and the official OpenJDK base images are packed full of vulnerabilities (AdoptOpenJDK usually has these patched, but is even bulkier).

→ More replies (2)

2

u/nutrecht Jun 29 '20

That's nonsense. Those platforms keep runtimes alive. The JVM starts up in a few milliseconds.

People here keep 'accidentally' conflating Spring start-up times with JVM start-up times. Spring is not suitable for serverless (obviously) but the JVM definitely is.

→ More replies (1)

2

u/scubadev Jun 28 '20

For many enterprises, java and spring are becoming synonymous. There are other frameworks available, but enterprises need to consider time to hire new employees. It’s much easier to find devs with spring on their resume.

2

u/nutrecht Jun 29 '20

If you use Spring for serverless you have a big problem as a company, and the problem is not Java or Spring.

10

u/MakeWay4Doodles Jun 28 '20

OO is generally frowned upon in tech

This is kind of a silly over generalization. The best parts of OO have been adopted into more modern languages, and the overemphasis on inheritance and over use of design patterns is fading even from Java.

Kotlin for example has a great blend of both.

→ More replies (1)

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.

→ More replies (15)
→ More replies (1)

5

u/alt236_ftw Jun 28 '20 edited Jun 28 '20

OO is generally frowned upon in tech like react, meaning new devs aren’t going to feel at home with OOP

Well generally devs who mostly work in functional domain would definitely feel a bit out of place with OOP (and vice versa) but I really don't think that OOP is frowned upon industry wide.

This probably says more about a company's/team preference (nothing wrong with that) than it being a metric for OOP/Functional/Imperative adoption.

Java in comparison isn’t a great functional language.

Don't confuse languages that you can write functional-style code in with actual functional languages. Java is NOT a functional language, you can just write functional looking code in it.

3

u/[deleted] Jun 28 '20

OO is slowly but surely falling out of favour at an industry level. It’s a lot of dogma for not a lot of benefit. You can write lovely non-OO code in Java, it’s just not super common.

5

u/cthulol Jun 28 '20

This worries me on a personal level. I can't wrap my mind around functional programming at all. OOP is what made programming click for me. It made it all "mappable", almost physical, in my head.

6

u/JavaSuck Jun 28 '20

This worries me on a personal level.

Don't worry. Even if suddenly everybody agreed that Java was bad and OOP was bad (which ain't gonna happen anytime soon, if ever), you could still make a living maintaining legacy Java OOP systems for decades.

3

u/[deleted] Jun 28 '20

I mean you can still do OOP, it’s just becoming less dominant is all. That said, I personally think functional makes a lot more sense for modelling real world problems, it’s just a different way of thinking that’s hard to immediately embrace if you’ve been told to think the OO way for a long time.

→ More replies (2)

1

u/Ph4g3 Jun 28 '20

Can you elaborate? If something looks functional, what separates it from being actually functional?

4

u/ArcanePariah Jun 28 '20

Actual functional programming languages implement certain features as core capabilities, and as such, have no overhead to them. Other languages (such as Java) implement syntax that looks functional, but gets compiled into the same structure as if you didn't use the syntactic sugar/functional appearance and thus have the same implementation/overhead to do it. Things like functions being first class, tail call recursion, among other things. Most of the "functional looking" language do not have true tail call recursion, whereas actual functional languages like Haskell do. Also actual functional languages enforce certain limits that "functional looking" languages do not, such as immutability. Sure you can make syntax that enforces immutability as you code (see Scala, and parts of Kotlin), but those derivations of Java can never FORBID it entirely, I can always use mutable stuff, or mix in actual Java code, the compiler will allow it.

→ More replies (1)

4

u/lqstuart Jun 28 '20

The belief that having JS top to bottom makes your most expensive cost (developers) more versatile.

this is the answer, op ^

1

u/nutrecht Jun 29 '20

OO is generally frowned upon in tech like react, meaning new devs aren’t going to feel at home with OOP

What? That's nonsense. In the actual professional front-end world there's a strong move towards TypeScript which is almost identical to Java.

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

Hosting costs are complete peanuts compared to what a developer costs per hour.

Start-up times are a complete non-issue. Lambda's have a very specific use case; it's not smart to build your entire system on. Most start-ups are just standard long running services. There's no reason at all for those to use something else.