News for hackers. Stuff that matters.
Re:The Modern Java Platform – 2021 Edition by sz4kerto on Wednesday March 17, 2021 @02:18AM (#26487233)
There's a very good reason why Spring is used so widely.

Complex enterprise apps are often complex because the use case and the environment is complex.

E.g.: - integration testing and unit testing is required - transparently pluggable backends for message queues so that locally you can use SQLite as your pub/sub storage but in production it's Google P/S - standardized health check endpoints for all your apps

... The list is infinite. You can make a decision for each point or you can agree with the team that you're using whatever Spring provides.

In a team with 100 devs, simplifying and unifying decisions is extremely important. And Spring _works_. I don't like it either, but it works.

The alternative is: solving all the problem that Spring solves with different tooling. And no, you can't avoid dependency injection in a 700 kLOC medical application, because you need to test the hell out of it.

Re:The Modern Java Platform – 2021 Edition by eecc on Wednesday March 17, 2021 @04:19AM (#26487894)
> Complex enterprise apps are often complex because the use case and the environment is complex.

Uh maybe... the real question is where does that complexity come from. Is it intrinsic to the problem or just bureaucratic slob? Given a framework so popular, what are the incentives to go uphill and challenge assumptions - with the likely risk of being fired - or just concede and ad your little contrived contribution to the problem?

Re:The Modern Java Platform – 2021 Edition by syjer on Wednesday March 17, 2021 @04:34AM (#26487994)
From my experience, enterprise apps are generally complex because they are a combination of:

- environment: integration of a large amount of services - and a good amount of them are legacy and idiosyncratic

- use case: enterprise app are at the intersection of real life and the virtual world: the rules are messy, illogical and have a baggage of 20/30+ years. Thus they cannot be changed at all. This is IMO the main difference between a "pure" greenfield startup kind of project and the enterprise one.

- add another layer of burocracy and complex environment to navigate

And with that you got the enterprise app world :).

In the end whatever framework is chosen, the most important property is the availability of common language/patterns.

Re:The Modern Java Platform – 2021 Edition by tatersolid on Thursday March 18, 2021 @07:49AM (#26501685)
> use case: enterprise app are at the intersection of real life and the virtual world: the rules are messy, illogical and have a baggage of 20/30+ years. Thus they cannot be changed at all.

This is in my experience exactly the problem. They can be changed and should be changed as it would save everyone boatloads of time and money. Engineers need to advocate these business process simplifications, and managers need to illustrate the ROI of making such simplifications.

One has to challenge nonsensical requirements: it’s a critical part of engineering.

Re:The Modern Java Platform – 2021 Edition by marcosdumay on Wednesday March 17, 2021 @10:56AM (#26492104)
Enterprise as in "sold to enterprises" or as in "created by enterprises"?

Both are complex, but for different reasons.

Software that is sold to enterprises is complex because they compete on number of features (in checklists), and there is no pressure for quality since the software users have little saying on what software gets brought.

Software that is created by enterprises for internal use is complex because the enterprises themselves are complex. They are full of rules, created by different people with very different goals, that add up with time, and the applications must deal with them.

Re:The Modern Java Platform – 2021 Edition by eecc on Wednesday March 17, 2021 @03:06PM (#26495517)
> Software that is created by enterprises for internal use is complex because the enterprises themselves are complex. They are full of rules, created by different people with very different goals, that add up with time, and the applications must deal with them.

Maybe it's just me and my scarce disposition for forgiveness, but after several years I tend to believe complexity emerges as a consequence of superficial understanding, diffuse aversion to analysis and outright pool analytical skills.

:/

Re:The Modern Java Platform – 2021 Edition by slt2021 on Friday March 19, 2021 @01:28PM (#26515987)
agree on poor analytical skills. top talent devs tend to work on front-office apps that generate $, and not the backoffice intranet type apps for internal employees and processes. i think it is a function of compension difference as well and dev self-selection
Re:The Modern Java Platform – 2021 Edition by lmm on Wednesday March 17, 2021 @02:56AM (#26487445)
Spring proper is (relatively) fine; you can make applications with it that are more-or-less maintainable. Spring Boot is very different. It's a write-only framework, and while businesses may have enthusiastically adopted it, it's new enough that they haven't (yet) had to pay the maintenance costs and realise how bad they are.
Re:The Modern Java Platform – 2021 Edition by krooj on Wednesday March 17, 2021 @03:35PM (#26495857)
I agree with this, having recently gone through the exercise of creating some "onboarding" apps for new grads using Spring 5 and XML, then again with annotations. All the underpinnings for a non-Boot application are still there and mainly sane.

Spring Boot absolutely yields write-once throw away, and you _must_ consider the source: Pivotal is a contracting shop, so it's in their interests to hook people into an ecosystem that they happen to be experts in. I'm surprised this fact is lost on most.

Re:The Modern Java Platform – 2021 Edition by simmerup on Wednesday March 17, 2021 @09:36AM (#26491001)
What do you mean by write-only framework?
Re:The Modern Java Platform – 2021 Edition by evilduck on Wednesday March 17, 2021 @11:23AM (#26492502)
Write-only in this context means that the cost of maintaining something vastly exceeds the cost of rewriting that something from scratch.

I don't know Spring and Spring Boot well enough to pass judgement, but this situation generally arises in software when you have a language or framework that's reasonably expressive, where the language has a lot of sigils or keywords and it has "shortcuts" that you have to grok before you can really understand codebases that use those shortcuts (like annotations or heavy/excessive use of design patterns). It leads to software solutions that are only well understood by the original authors due to their specific knowledge and problem solving approach and anyone who comes along later must have the exact same overlap of knowledge and skills otherwise they'll find it easier to start fresh. This includes the original authors if the time lapse has been long enough.

This often then leads to the next phase of miserable software jobs, the second-system effect.

Re:The Modern Java Platform – 2021 Edition by nwatson on Wednesday March 17, 2021 @11:10AM (#26492289)
WOF == you understand your software while you're writing/developing it but give it a rest for a Trump's "two weeks" and you'll have no clue what you did.
Re:The Modern Java Platform – 2021 Edition by Pet_Ant on Wednesday March 17, 2021 @02:11PM (#26494856)
Re:The Modern Java Platform – 2021 Edition by selfhoster11 on Wednesday March 17, 2021 @09:38AM (#26491028)
The "different tooling" you mention should be the Java language itself. Let's not kid ourselves, literally no one writes enterprise applications in Java without some kind of a framework, and lives to tell the tale/doesn't go crazy. Since Spring is a de-facto "official" framework to write Java apps in, we might as well clean it up for inclusion into the core Java language, with attention paid to transparency to tooling in IDEs.
Re:The Modern Java Platform – 2021 Edition by stevoski on Wednesday March 17, 2021 @02:23AM (#26487261)
> In a team with 100 devs, simplifying and unifying decisions is extremely important.

I agree with this.

Unfortunately, Spring is often chosen for projects with much smaller teams too. Just 1 to 5 devs on what is fundamentally just a CRUD app. Wrong tool for the job.

Re:The Modern Java Platform – 2021 Edition by oweiler on Wednesday March 17, 2021 @02:28AM (#26487290)
I disagree. I can spin up a CRUD service with Spring Boot in an hour including validation, health checks, db migrations, API documentation and what not.

It lets me move fast while taking care of the boring stuff.

Nothing to do with team size.

Re:The Modern Java Platform – 2021 Edition by qw on Wednesday March 17, 2021 @07:09AM (#26489378)
I have the same experience as you. I have used Spring Boot in different environments for 5-6 years (first complex global enterprise and later small startup). Spring Boot have been enabling me to be very productive. I haven't had any major issues that I can blame on the "magic" that Spring Boot provides.

I have read startup experiences with other frameworks where they write blog posts about all the issues they had to spend time to fix, that is trivial to solve using Spring. There is a slight learning curve in the beginning, but it is worth it in my opinion.

Re:The Modern Java Platform – 2021 Edition by eecc on Wednesday March 17, 2021 @04:27AM (#26487940)
That’s all fine and nice, except when the magik doesn’t work and you’re ctrl-clicking for hours trying to figure out what darn annotation is breaking the whole incantation.

Or you realize a that the tiny tiny small configuration change you need isn’t contemplated by the code supporting the auto-magik, so you start adding overrides which turn off the autoconf, and you have to manually configure the whole beast by yourself (discovering all the undocumented gotcha’s along the way.)

Re:The Modern Java Platform – 2021 Edition by soco on Wednesday March 17, 2021 @05:48AM (#26488734)
Luckily this doesn't happen all that often. Unfortunately this is gonna happen in every framework. Compromises is what you always get when reusing somebody else's framework/program/anything basically, because use cases are never 100% similar.
Re:The Modern Java Platform – 2021 Edition by lmm on Wednesday March 17, 2021 @10:06PM (#26499060)
A good framework lets you gracefully progress from 100% autoconfigured to 95% autoconfigured, 5% customized to 90% autoconfigured, and so on. It does this by working in a consistent way, where framework-provided defaults behave the same as custom implementations of the same thing, and you can use the same tools and techniques to understand what the framework is doing as you use to understand your own application.

None of that's true of Spring Boot. The autoconfigured stuff comes in in its own fashion that's hard to relate to your normal configurations, and it's encapsulated in such a way that as soon as you want to replace part of it you find you have to reimplement all of it.

Re:The Modern Java Platform – 2021 Edition by eecc on Wednesday March 17, 2021 @03:00PM (#26495438)
Well, as someone else on this thread wrote, it does happen all the times you're not preparing for a presentation or a blog.

If you're building something marginally different from the routine the curtain is drawn, and IMHO you're probably better off buying a shrink-wrapped ready-made SAAS.

Re:The Modern Java Platform – 2021 Edition by matwood on Wednesday March 17, 2021 @09:36AM (#26491011)
Same. Spring boot + jooq is a quick, simple way to spin up backend services. Like any tool though, one needs to know Spring boot.
Re:The Modern Java Platform – 2021 Edition by selfhoster11 on Wednesday March 17, 2021 @09:34AM (#26490979)
You know what should be taking care of all of these things? Java! For a language that bills itself as the "enterprise language #1", it's abysmal in supporting actual enterprise features like you listed above in a lightweight fashion. Instead, a whole third-party framework has to be tacked on just so you don't have to reinvent the wheel. Java doesn't even support dependency injection, something that I would consider an absolute minimum for even a small project.
Re:The Modern Java Platform – 2021 Edition by dmux on Wednesday March 17, 2021 @10:01AM (#26491356)
>Java doesn't even support dependency injection, something that I would consider an absolute minimum for even a small project.

For small projects, DI is easy done by passing things via the constructor. If multiple things need to get wired together, pull that wiring logic out into its own class or method (FooBuilder.buildDefault()). If things start to get tedious, that's a really good time to stop and reflect on the design choices. That stop-and-reflect opportunity if often lost when things can be simply AutoWired together.

Re:The Modern Java Platform – 2021 Edition by jacques_chester on Wednesday March 17, 2021 @11:27AM (#26492550)
Jakarta (née Java EE) has CDI, which bears a striking similarity to the Spring's dependency injection capability: http://cdi-spec.org/
Re:The Modern Java Platform – 2021 Edition by diroussel on Thursday March 18, 2021 @06:25PM (#26508179)
The real thing that is missing is a runtime annotation scanning API.

Spring does this my examining the class path, casting it to a urlclasspath, finding all the zip/jar files, unzipping them and then parsing the byte code.

Interestingly the set let spec added annotation scanning too. And now if your not careful you jar files get extracted three times. The JVM, the server conteainer and spring all repeating the same work.

No wonder people think java is slow to start up.

Re:The Modern Java Platform – 2021 Edition by cryptos on Wednesday March 17, 2021 @09:09PM (#26498749)
I don't think there is a need to blur the line between a standard library and frameworks. Maybe @Inject should have been in the JDK, but on the other hand it can be added to any project easily and is supported by several frameworks.

In general I think, it is wise to keep the standard library small, because innovations are easier to implement in libraries. Rust is a good example for this style.

Re:The Modern Java Platform – 2021 Edition by lmm on Wednesday March 17, 2021 @10:08PM (#26499072)
If Java had had first-class functions to start with, things like Spring would probably have never got off the ground. Up until Java 8 you couldn't even pass a reference to a constructor as an argument without defining a whole class to carry it around in.
Re:The Modern Java Platform – 2021 Edition by cryptos on Thursday March 18, 2021 @02:51AM (#26500218)
But first-class function is a completely different thing than dependency injection (DI). Supporting functional programming is a an aspect of the programming language itself, while DI is part of the infrastructure.

I agree with you, that Java should have had first-class function from day one. Ironically this was considered by the language designers, but they decided that it would be too exotic for the average Joe. OOP was a hype back then ...

Re:The Modern Java Platform – 2021 Edition by lmm on Thursday March 18, 2021 @04:57AM (#26500743)
DI is a design technique, you don't have to use a framework to implement it. Reflection-based frameworks became a popular way of doing it in Java because doing it in plain Java is cumbersome, and that's due to the limitations of Java as a language.
Re:The Modern Java Platform – 2021 Edition by cutler on Wednesday March 17, 2021 @04:03PM (#26496143)
I don't know about that. Dmitri Sotnikov, joint author of "Web Development With Clojure", worked on a similar app and didn't even need types or OOP let alone a monster like Spring.
Re:The Modern Java Platform – 2021 Edition by strictfp on Wednesday March 17, 2021 @02:28AM (#26487288)
Enterprise apps are complex because they don't focus on solving the business problem, they focus on the tools and frameworks.

Spring is not the cure, it's the disease.

Re:The Modern Java Platform – 2021 Edition by oblio on Wednesday March 17, 2021 @03:24AM (#26487603)
Enterprise apps are super complex, frequently a lot more complex than startup apps.

Someone basically comes with 1 thick tome worth of business knowledge plus 1 thick tome worth of legal restrictions and you're supposed to codify all of that, to the letter, in software. Some of the business logic can make you cry.

Software dev: "But that's not clean/elegant".

Business owner: "Reality doesn't care about elegant/clean, it cares that we build stuff our customers want and that won't get us sued, so we have to implement it to the T".

Re:The Modern Java Platform – 2021 Edition by strictfp on Wednesday March 17, 2021 @09:00AM (#26490487)
I'm sorry, having extensive experience writing enterprise apps I have to refute this. Almost all complexity I've ever seen was rooted in infrastructure, not the inherent complexities of said enterprise.

I would even go so far as to say that the enterprise logic was so straight-forward that most programmers spent their time inventing problems, which is how look at the enterprise market. They's a lot of "inner platforms", meta-problem solving and needlessly complex deployment environments.

Contrast this with my current industry, gaming. Here the problems are real, tangible and hard. Suddenly overcomplication is much less of a problem, because the extra cognitive load becomes too much when your core problem is already hard.

Re:The Modern Java Platform – 2021 Edition by foo_barrio on Wednesday March 17, 2021 @12:00PM (#26492991)
Just as a counterpoint, I've done a little bit of game programming and currently work on a tax reporting system (mostly). Both are full of random shit you have to know for no reason. The game random shit I've had to learn was often tied to very specific platforms at very specific times. The game stuff very often I had to delve into actual math + algos.

The tax reporting system I get bogged down and mired in the literal thousands of edge cases and exceptions due to the interactions of all of the laws, sometimes written maliciously by some political entity, or sometimes some local municipality goes against the federal laws leading to literally impossible scenarios. On top of that you have things like your company booking transactions one way that they shouldn't have and is now too much of a pain to change so it has to get reported differently at the reporting layer (which itself is a problem as to why this wasn't noticed initially). Very often the gov't specs themselves are contradictory.

Here is an example: stocks can sometimes pay debt interest did you know?! That doesn't come up in any of the fixed income documentation I had to read. But right there in some list of bonds the IRS publishes every year are non-bond things. wtf?! So do you fabricate some new type "debt interest paying thing" of which are mostly composed of bonds and once in a while stocks in your data model? Do you keep your data model clean and fabricate an internal bond to represent the debt part of the stock in these cases and link it to the actual stock? You will have to consult with your legal/tax department and realize if you were to misreport this income what would the resultant fines and loss of customer goodwill is (due to higher chance of them being audited, paying more tax etc)? Do you conclude that your internal team cannot keep up with the ever marching and changing tax law (FATCA anyone wtf?!) and outsource this to a tax reporting company? The scope of our tax reporting is nearly unlimited since the US government seeks to capture all of human endeavor. The results of getting this wrong are very real. People get audited and lose money and sue our company and can go under due to litigation costs. In games, if we fuck up, our company goes under and everyone loses their job but I didn't have to worry so much about potentially ruining the jobs of people outside of our company.

This is actual complexity your software will have to deal with no matter your language/platform.

In my, admittedly limited (never AAA), experience with games I always seemed to be bumping up against physics (time, memory, latency/speed of light) but with enterprise apps it's almost always bumping up against the sum total of human stupidity past and present.

Re:The Modern Java Platform – 2021 Edition by strictfp on Wednesday March 17, 2021 @03:23PM (#26495735)
I'm not refuting that businesses can be complex, but I am saying that most of the complexity I've seen hasn't been inherent to the business.
Re:The Modern Java Platform – 2021 Edition by foo_barrio on Wednesday March 17, 2021 @05:12PM (#26496841)
I understand, I should have been clearer. My experience has been the opposite. The companies I've worked for had actual complexity to tackle. I guess I got a little defensive because I've encountered "game programmers are gods, everyone else sucks" attitudes before from forums and fellow programmers and projected that onto your response. Sorry.
Re:The Modern Java Platform – 2021 Edition by strictfp on Wednesday March 17, 2021 @06:16PM (#26497464)
No worries. The gaming industry has its own set of problems for sure, so I'm not claiming it's inherently better in any way :)

I'm glad to hear if your major challenge in the enterprise was to solve actual problems and produce real value. My journey was mostly learning one over-complicated framework after another, and finally coming to the conclusion that it was mostly for nothing. I was the local Spring expert, but at the same it's biggest critic. The "code", or more accurately the configuration, gets very consise, but you risk ending up with only a handful of people in the building who know how to debug the app properly.

I started coding Java when Sun marketed it as a very pragmatic choice, focusing on "simply writing code". The influence of IBM and the whole JEE movement (including Spring) still looks at the problem of coding from the wrong angle IMO.

Creating a good development environment is not about creating a all-in-one runtime environment or methodology, nor about simplifying the problem space for developers by letting them write plugins to large servers.

It's about establishing a fast RAD cycle and offering a buffet of good libraries, to simplify the writing of code.

Java used to be the language which allowed you to "just program", nowadays the mainstream choices are golang or node. To me it's become very clear that Java is on the wrong track here.

There are an infinite number of distractions as a coder, including Microservices, responsive design, functional purity, patterns etc.

If you managed to duck most of these and end up in a place where you were producing value effectively, you were very lucky judging by my experience :)

Re:The Modern Java Platform – 2021 Edition by 2020aj on Wednesday March 17, 2021 @12:22PM (#26493309)
Extensive experience writing enterprise apps in many different industries? To me it sounds like you're trying to refute a generality with anecdotal experience. Have you ever worked for a heavily regulated industry like healthcare or insurance? The business logic is heavily tied to the regulations which vary by state/country and can be quite... cumbersome.
Re:The Modern Java Platform – 2021 Edition by strictfp on Wednesday March 17, 2021 @03:22PM (#26495723)
That is true. I don't really refute that there are instances of complex rulesets. I've worked in some regulated markets, but not healthcare or insurance.

That said, I stand by the point that most complexity I've seen has come from infrastructure. Because although the rulesets might be complex, the way they are encoded is usually the source of the problem IMO.

For example, if the rules of the business are encoded in such a way that unit testing them is straight-forward, it puts the business at the center.

But when every rule is testable only in a complex deployment, the complexity of the app is no longer tied to the complexity of the business.

And the latter has been more the rule than the exception in my experience.

Re:The Modern Java Platform – 2021 Edition by sz4kerto on Wednesday March 17, 2021 @03:00AM (#26487463)
This is absolutely not the case. Enterprise app developers (etc.) are not stupid. The domain and the business problem are often extremely complex and hard to understand.
Re:The Modern Java Platform – 2021 Edition by doctor_eval on Wednesday March 17, 2021 @04:58AM (#26488226)
My observation from my long career of writing enterprise apps is that frameworks are super complicated with many hidden variables, so when you apply them to a complicated business problem you end up with the square of the complications of both systems.

We ended up in framework hell. In response, we ditched all the frameworks we were using, went to pure JavaSE, and ended up with a (much!) faster, more reliable enterprise application that was far, far easier to maintain.

Re:The Modern Java Platform – 2021 Edition by foo_barrio on Wednesday March 17, 2021 @12:15PM (#26493204)
I had this experience with the so-called "app servers" at our company. We also have a daily batch processing system has tons of operational support, db+serivice monitoring, a very useful web UI, logging split out, authorization system etc. It's built around common Nix concepts like files, pids, pipes, etc. Thousands of these batch jobs are little JavaSE programs that launch, do their business, record their progress and report success or failure. Some are python programs and behave the same way.

Our JEE apps were deployed to these app servers with very little internal support or expertise that very often had devs having to physically log onto production hosts and figure what in the world was wrong, restarting the app server, grepping logs and in general having to learn about these app servers (and usually just shrugging their shoulders at what went wrong). The sum total of things you had to know to keep the JEE deployments up was as much as you had to know about Nix processes PLUS you still had to know all the Nix stuff, except none of the JEE infra was built out since the app servers were just these monstrous processes with hundreds of db connections and thousands of threads.

My team long ago ditched JEE style deployments and have our apps all managed with the batch processing system and have been none of the better for it. Some* of those apps use Spring/Boot but I we've been doing a decent job in the code reviews of just rejecting anything too auto-magikal. Other teams that have stuck with these massive app-servers have stagnated since the deployments are so frail, no one dares make large changes. This is mostly an institutional problem but still the end result was sticking to simpler JavaSE stuff has led to way more productivity.

Re:The Modern Java Platform – 2021 Edition by doctor_eval on Wednesday March 17, 2021 @03:09PM (#26495560)
Yeah your experience absolutely mirrors mine. Don’t even get me started on JPA; I’ve used exactly the same phrasing you did: when you use JPA, now you have to know SQL, JPA and JQL. It makes no sense!
Re:The Modern Java Platform – 2021 Edition by lmm on Wednesday March 17, 2021 @10:13PM (#26499095)
Heh, I found the opposite. JPA is one of the few parts of the ecosystem that actually work and deliver enough value to be worth it.
Re:The Modern Java Platform – 2021 Edition by tonyedgecombe on Wednesday March 17, 2021 @09:39AM (#26491032)
Enterprise app developers (etc.) are not stupid.

Enterprise developers aren't stupid but enterprise software is some of the worst software I have encountered in my career. When a development team has one captive customer you get the results you would expect.