News for hackers. Stuff that matters.
Re:I finally escaped Node by haolez on Wednesday March 24, 2021 @08:53AM (#26566513)
How do you feel about the impact on developer productivity after migrating to Java + Spring Boot? I haven't used Java in a long while and every time that I try to come back to it, I get driven away by the difficulty and complexity to do simple things (thinking of annotations, dependency injection, complicated design patterns). It feels like an effort of one hour of Node or Python programming (or even Go) would take 10x more in Java.
Re:I finally escaped Node by cygned on Wednesday March 24, 2021 @09:00AM (#26566596)
Great question. I was very concerned about that, too. I strongly recommend learning Domain Driven Design before diving into Spring, you will recognize a lot of patterns and it then makes sense how things work. Even things like having an interface + an implementation for basically everything becomes apparent. I had a lot of bad experience with Spring and Jakarta EE in the past, but I can assure you Spring Boot does a fantastic job here.

Point being, it is an enterprise setup and in enterprise applications you favor maintainability and friends over speed of development. So implementing a feature takes more files and more time, in a DDD setup you can estimate something like 1 controller method, use case + interface, >=2 DTOs, potentially a domain model if not present plus a repository + interface if not present.

So yes, it is more overhead and you have a slow down in productivity. I have no proof, but I am 95% sure that the time you save upfront in a more flexible environment like node is being paid back significantly worse when it comes to maintenance.

Edit: you can of course use Spring Boot without enterprise/DDD and hence make it simpler. It's actually pretty minimal.

Re:I finally escaped Node by brainwipe on Wednesday March 24, 2021 @09:38AM (#26567011)
+1 for DDD in any strong-type-first language like Java or C#. Even if you land in a system that was designed horizontal-layer "at speed", you can retrofit good language, aggregate boundaries and migrate to a world away from spaghetti. Speaking as someone who usually works on code bases 10+ years old.

Great comment, and the root comment too.

Re:I finally escaped Node by haolez on Wednesday March 24, 2021 @06:00PM (#26573538)
Thanks for the thoughtful answer. Do you have any recommendation of a good book to solidify my DDD understanding? I've read one in the past (can't remember the name) and that one felt like IT consulting bullshit :)
Re:I finally escaped Node by cygned on Thursday March 25, 2021 @01:06AM (#26576775)
Read in order:

1. Anatomy of Domain-Driven Design, S. Millett

2. Domain Driven Design quickly, InnoQ

3. Implementing Domain Driven Design, V. Vernon

Re:I finally escaped Node by kypro on Wednesday March 24, 2021 @11:03AM (#26568118)
This is why choosing the right language for the job is so important.

I know PHP has a bad reputation, but I personally think it offers an excellent middle ground for web projects. It has some great frameworks which have been used at scale while not having all the complexity and rigidness of Java.

As a dev that's used Java, PHP and Node in the past I perfer working on PHP and Node projects because I feel far more productive and less constrained, but I can certainly appreciate why a larger corporate project might choose Java.

Arguing about the perfect language seems pointless without some idea of the requirements.

Re:I finally escaped Node by FlyingSnake on Wednesday March 24, 2021 @09:32AM (#26566942)
> How do you feel about the impact on developer productivity after migrating to Java + Spring Boot.

I can answer that as we just strangler-pattern'd a legacy nodeJS app to Golang. Abstracting away from Node and JS paradigm is bit harder, but the blame totally lies on the callback ridden code we end up with Node. It also forced us to think about our DataStructures, abstractions and module structure. The efforts took comparatively the same time as it took the original team to write the Node app. Also I wouldn't put Golang and Python in the same league as Node.

> effort of one hour of Node or Python programming (or even Go) would take 10x more in Java

Modern Java (and Kotlin) is surprisingly powerful and the days of AbstractFactoryBeanFacadeInterface are behind it.

Re:I finally escaped Node by haolez on Wednesday March 24, 2021 @06:01PM (#26573561)
I've got to say that I'm more tempted to start something with Java + Lombok than Kotlin. Somehow it feels like I'll have an easier time with the tooling, but I'm probably exaggerating.
Re:I finally escaped Node by jimbokun on Wednesday March 24, 2021 @11:48AM (#26568742)
I maintain a Java Spring Boot service full time, and when something stops working or doesn't do what you expect, it can be a total nightmare to debug. There is so much misdirection, it can be incredibly difficult to figure out which code will be executed, in which order.

I try to make things as explicit as possible, which can help in testing and debugging.

Re:I finally escaped Node by IceDane on Thursday March 25, 2021 @07:00AM (#26578658)
Java and Spring is a nightmare and I can't believe someone can actually look at that stack and not see it as a complete joke.
Re:I finally escaped Node by jfengel on Wednesday March 24, 2021 @04:09PM (#26572276)
Inversion of control means you have no control.
Re:I finally escaped Node by sorokod on Wednesday March 24, 2021 @03:32PM (#26571899)
Spring makes simple things easy and difficult things impossible. Spring Boot was created to mitigate some of the mess Spring is, specifically that mere mortals can not assemble version compatible libraries that comprise Spring so spring Boot does it for them.
Re:I finally escaped Node by watwut on Wednesday March 24, 2021 @10:35AM (#26567755)
> I get driven away by the difficulty and complexity to do simple things (thinking of annotations, dependency injection, complicated design patterns). It feels like an effort of one hour of Node or Python programming (or even Go) would take 10x more in Java.

You are comparing stuff that is super helpful on large project with how to be quick in 1 hour by one person. If I have 1 hour long project in java, I wont use complicated design patterns. If I dont need Spring Boot or dependency injection, I wont use them. I am not sure what you mean by complicated annotations tho.

In Java, if all what you want is a method that processes some data, you wont use any of that and will just do a class or something like that. So if python have better methods to achieve whatever you want to achieve out of the box, it will be somewhat faster. But it will have zero to do with annotations.

Re:I finally escaped Node by haolez on Wednesday March 24, 2021 @05:56PM (#26573500)
I agree that the way I've made my statement can be ambiguous. What I meant was when using Node/Python/Go for projects of similar complexity. Maybe not millions of lines of code, but a web app with some order processing, database access and specific business logic. It feels harder in every way when using Java + Spring Boot, but my question was sincere: I'm pretty sure that this combo is a successful platform and I want to understand why.

Finally, by excessive use of annotations, I think I'm talking about ORMs. I remember checking a Hibernate-based project in the past and some methods had more lines of annotations than actual code. I'm not sure this is bad, but it kind of creates a new dimension of code for me to wonder about.

Re:I finally escaped Node by watwut on Thursday March 25, 2021 @09:19AM (#26579894)
Imo, if you know what all of that means and what to do, it is fast and easy. If you are new to it all, it can be frustrating.
Re:I finally escaped Node by alexhutcheson on Wednesday March 24, 2021 @06:06PM (#26573605)
What would you use to write a quick RPC server or JSON endpoint in Java, if not Spring Boot?