18 ms·
In general case you would be right -- Spring does complicate things by hiding some of the actual references. But reality is that most projects use very simple
by lmilcin 5y ago
In general case you would be right -- Spring does complicate things by hiding some of the actual references.
But reality is that most projects use very simple dependency injection rules. Most use just singleton beans and occasionally profiles for different environments (mostly to access external components like databases or APIs) and that is practically the extent of the problem.
Spring is flexible on paper. In reality (and very fortunately for me), most projects follow the examples and conventions you can find on the Internet. Which makes pretty much every Spring application look like any other Spring app, even if they don't have to.
By giving defined, recognisable structure to the application, Spring actually makes part of work easier. When I see controllers, repositories, services, etc., I usually know what I can expect.
Problems start when you find a project written by "smart" developers. These people are smart enough to write very complex structures and "customise" their Spring experience, but not smart enough to figure out they should separate app development from satisfying their intellectual curiosity.
- marginalia_nu 5y agoI feel the reason most Spring applications look similar is because the Developers have been copy-pasting from the same Baeldung-articles. Copy-paste driven development is something you get a lot of when you are working with frameworks. Since the framework is itself inscrutable, it's nearly impossible to properly understand. So developers copy.
- lmilcin 5y agoI wouldn't say that is necessarily fault of Spring (though scope creep might be an important contributor). I think the basic causes are: 1) Because most developers almost never need more than what you can find on Baeldung/Stack*. And even if they need, they need it for very small pieces of the application and the rest is just boilerplate. 2) Because you are penalised for customising the structure of your Spring application. You do that and you expose yourself to various complicated problems. 3) Because, frankly, Java is a bad programming language from the point of view of building abstractions. I would personally prefer to program applications in Common Lisp or even Clojure (or any other Lisp for that matter) if only for some reason these projects did not typically end in unmaintainable mess even well before Java projects do. It is truly tragic that Lisp and strong typing are fundamentally incompatible with each other. There are different types of unmaintainable mess -- mess caused by copying and pasting stuff typically committed by novice developers who don't know any better tends to be infinitely easier to clean up than mess caused by "advanced" developers running amok with macros, continuations, generators and async callbacks. 4) Because developers are not taught how to structure their code. Nowadays getting something working is all that matters. And this is usually best accomplished by copying/pasting code blocks Lego-style from a dozen different tutorials. How anybody is going to learn to structure their large codebase if they never learned to structure a smaller one? People who advance faster are the ones that are more efficient at copying pasting, not the ones that are better at writing better code.
- mwint 5y agoWhy are Lisp and typing incompatible with eachother? Sounds like an interesting problem.
- deleted 5y ago[deleted]