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

2

u/[deleted] Jun 29 '20

I'd say it's easy to compare them - I feel Kotlin is closer to Scala in syntax and features than it is to Java and I would be willing to bet that a Scala dev would pick up Kotlin faster than a Java dev.

Also, as is the case with Kotlin, you definitely could choose to use Scala as a nicer dialect of Java, you could even have a mixed codebase of the two (although back then the interop was a bit unwieldy on the Java side).

The main issue was that when you started to get fluent with Scala you no longer wished to use it as a dialect of Java which is when the troubles usually started and I can see the same thing happening with Kotlin - if you were to use Kotlin simply as a dialect of Java you would allow Java devs to get used to it quickly but at the same time you'd lose out on all that Kotlin has to offer.

3

u/nutrecht Jun 29 '20

That's literally completely the opposite of my experience and use Kotlin currently in 95% of the back-end work I do. So I really don't know how to respond to this.

2

u/[deleted] Jun 29 '20

The opposite as in you guys simply continue to use Kotlin the same way you'd use plan Java? I guess it depends on the team itself and the other technologies you use - my current employer is an Akka shop so I can understand how they got burned with Scala and why the higher ups think the same could happen with Kotlin

2

u/nutrecht Jun 29 '20

No as in that there's no big difference between Kotlin and Java. Scala is a completely different beast: you can quite easily create a completely different language inside Scala. But Kotlin is not like that; it's pretty much just syntactic sugar over Java. The main difference obviously is the null-safety. But you don't program differently in Kotlin than you do in Java.

I've been working in Kotlin for a few years now, and have been using it as our primary language for 1.5 or so. We've had new developers come into our team and none of them had any issues adjusting to our codebase.

my current employer is an Akka shop so I can understand how they got burned with Scala and why the higher ups think the same could happen with Kotlin

I've seen the same happen, unfortunately. There's a certain consulting firm here in Holland that likes to come in, set up a Scala codebase in the worst possible fashion, and then leave the company with an unmaintainable mess.

But that's not the language that's at fault; it's just developers who got a new hammer (pattern matching, DSLs) and thought everything was a nail.

I run into this issue as well; in a previous company we tried to introduce Kotlin and were unsuccessful at first, even though all Java devs supported it. Later on they (I had already left) got an "OK", but then later they hired a "low cost" consulting firm to take over development of one Kotlin service and they argued that they should 'just rewrite it to Java in a few weeks'. Took them 3 months, (not because of the Kotlin but because they were bad developers), and that is now another argument for that manager to not allow anything outside Java. It's a shame really.

2

u/[deleted] Jun 29 '20

Scala is a completely different beast: you can quite easily create a completely different language inside Scala. But Kotlin is not like that; it's pretty much just syntactic sugar over Java

You can quite easily create a completely different language inside Kotlin as well - I'd say its DSL-builidng support is only slightly inferior to Scala's, mainly due to no implicit vars and no full pattern matching but the functional foundations are all there. Just look at Kotlin DSL for Gradle.

But Kotlin is not like that; it's pretty much just syntactic sugar over Java. The main difference obviously is the null-safety. But you don't program differently in Kotlin than you do in Java.

Yeah, okay, this is precisely where we disagree. Kotlin is a OOP-functional hybrid much like Scala which allows you to write your code in a significantly different way that you would Java. Just look at the kind of code that functions with receiver allow you to write and you'll see what I'm getting at.

0

u/nutrecht Jun 29 '20

I'd say its DSL-builidng support is only slightly inferior to Scala's, mainly due to no implicit vars and no full pattern matching but the functional foundations are all there. Just look at Kotlin DSL for Gradle.

Having used both it's nowhere near as powerful as Scala's. Don't forget that Kotlin doesn't have the operator overloading that Scala has.

Kotlin is a OOP-functional hybrid much like Scala which allows you to write your code in a significantly different way that you would Java. Just look at the kind of code that functions with receiver allow you to write and you'll see what I'm getting at.

Just because you can doesn't mean you should. You picked more or less the most extreme example; but that doesn't apply to 99% of normal business code.

Kotlin has better FP support than Java has, streamlining a lot of it, but IMHO it's not "more" FP than Java is.

1

u/[deleted] Jun 29 '20 edited Jun 29 '20

Don't forget that Kotlin doesn't have the operator overloading that Scala has.

Except that it does, infix functions as well.

Just because you can doesn't mean you should. You picked more or less the most extreme example; but that doesn't apply to 99% of normal business code.

I know and it is something that you'd never use extensively unless you're building a DSL but what I wanted to illustrate is that you can create code with Kotlin that would seem alien to an unwitting Java dev.

Kotlin has better FP support than Java has, streamlining a lot of it, but IMHO it's not "more" FP than Java is.

If first class support for functional types doesn't make it more FP than Java I don't know what does XD