News for hackers. Stuff that matters.
Re:Java 12 by tannhaeuser on Wednesday March 20, 2019 @04:43AM (#19440136)
nodejs isn't a replacement for fat backends for sure, but it's working really well for a frontend-facing light backend where frontend developers can add endpoints as the need arises, such as for autocomplete functionality, and where first-party support for asset pipeline tools is desired. The Spring experience isn't bad for newbies creating "REST" microservice spaghetti to have something to show at the end of their agile day, but it gets seriously in your way if you're a seasoned dev and have a solid understanding of what you want to achieve in terms of network-exposed interfaces and integration with other apps.
Re:Java 12 by ivan_gammel on Wednesday March 20, 2019 @01:04PM (#19444223)
I‘m seasoned dev with 20 years of Java programming experience, I see no problems using Spring and I don’t see why anyone with similar experience would have any. It’s sometimes not obvious, how some things work, but it’s open source and the code is quite good to analyze, extend or replace.
Re:Java 12 by jimbokun on Wednesday March 20, 2019 @01:33PM (#19444583)
"the code is quite good to analyze, extend or replace"

But how do you even know what code to read when so much of the program's logic is in annotations and other kinds of action at a distance?

Re:Java 12 by tannhaeuser on Wednesday March 20, 2019 @02:17PM (#19445139)
Exactly. For example, if you're (still) using Spring MVC, what gets called in your backend on a given action attribute in your JSP or Thymeleaf or whatever template, is expressed through your method signature and lots of annotations where the order of arguments matter eg. some magic attributes must come right after others. All you see in your debugger, though, is that your request hangs in some nested and chained handler and reflection monstrosity driven by annotations and who knows what. Took multiple developers a day or two to figure out, each on their own.

It's not that Spring is badly coded or something, I just don't need these surprises and the magical thinking surrounding newbie Spring Boot projects.

Re:Java 12 by ivan_gammel on Wednesday March 20, 2019 @03:09PM (#19445702)
Newbie can write bad code on any platform, but it‘s a short period of life of software developer - the problem of beginners is solved not by the tools they use, but through a reasonable composition of the team with sufficient number of experienced developers who can define the architecture and best practices.
Re:Java 12 by jimbokun on Wednesday March 20, 2019 @03:50PM (#19446134)
From what I can tell, the "bad" Spring code is the code following the recommended Best Practices, at least according to the tutorials that pop up in Google search results.
Re:Java 12 by ivan_gammel on Thursday March 21, 2019 @02:43AM (#19449685)
There’s one “must read” tutorial - documentation on official Spring website. There’s also github account with lots of examples. It’s better to ignore the trash that comes from search results, because either it’s trivial or obsolete.
Re:Java 12 by ptx on Wednesday March 20, 2019 @05:30PM (#19447156)
Another related surprising thing (as I'm currently learning Spring/Hibernate/etc.) is what happens when the Hibernate Validator library is missing at runtime:

Nothing.

All the carefully crafted validation annotations just don't do anything, no validation is performed, and there is no indication whatsoever of this.

Re:Java 12 by ivan_gammel on Thursday March 21, 2019 @02:37AM (#19449669)
It’s not a problem with annotations or Spring - could happen e.g. with SPI and anything that’s discovered in runtime. It’s about how you build your project and configure dependencies (separation of API and implementation in different JARs is typical for Java and implies certain way of thought about build and deployment).
Re:Java 12 by ivan_gammel on Wednesday March 20, 2019 @03:04PM (#19445650)
The source code of Spring itself. I know Spring internals - there’s no dark magic there and reference guide describes it well. DI is straightforward, MVC - not perfect, but generally easy, Security - well, it has design problems, but they are not related to annotations.
Re:Java 12 by jimbokun on Wednesday March 20, 2019 @03:48PM (#19446107)
"but they are not related to annotations"

I had a problem with security that I could only solve by adding an "Order" annotation to my class. Reading the code and stepping through it in the debugger did me absolutely no good.

Re:Java 12 by ivan_gammel on Thursday March 21, 2019 @02:47AM (#19449692)
So, annotation was a solution to a problem (how to define a sequence in which configuration is applied), not a cause, right?