📜 ⬆️ ⬇️

Why i hate spring

At the beginning of my career, I really fell in love with Spring . I've been waiting for him for so long. I used it in all my projects. In addition, I even managed to shove a bunch of stuff from Spring Integration there . I was kind of king of XML. I made an RPC layer based on JMS, protobufs and Kaazing for our entire department and the bank as a whole. I thought, “This is so configurable. Just a couple of XML files are really flexible. ” I was very pleased with myself.

But some of my colleagues were inclined to disagree. They had problems when they tried to tie everything the way they wanted; they did not know where what xml files they needed. There were problems with versions of Spring, how to make friends with them (I, moreover, went far with modularity: we had 5 or 6 different modules with different version numbers, and it was impossible to just take and figure out which one to use without asking me). These were alarm bells, but I did not notice them; I thought I needed more documentation or that those guys were just stupid. This situation is typical in itself: the pleas of users of one of the most unloved and difficult to use frameworks for help often break about “yes there is one file and some parameters, it’s not so hard”, while everyone else is trying to find a magic combination of files and parameters to make something work somehow.

I still work in the same organization, but now I am a user of my old framework. As a result of this feeding of my dog's food, I began to hate Sam (the author means himself - approx. Lane. ) 2009-2010 for several reasons, but mostly - for Spring. Spring is evil in good weather, but when it is included in the library or API used by other programmers, this is another level of evil: like the fruit of love of Hitler and the devil. Don't let Spring stick out of your API.

Spring sucks for a number of reasons, and I felt that they need to be listed, because google has no clear counter arguments.
')

The thing is, I'm sure: it is theoretically possible to use Spring successfully in an application. I have never seen anything like this before, and this is a problem. As for me, all the "buns" that he offers are quite possible without him. When we ask about Spring at the interview, the candidate usually answers: “With Spring, you have clean code, a division of responsibility, and it’s really good for testing.” In general, all those things I am a big fan of (especially testing), but in fact these are the results not of using Spring, but of good programming. Perhaps for Spring newbies, this is a good crutch for learning ideas such as dependency injection, mocking, and testing, but in fact they are orthogonal to Spring. If you use TDD, you will not have getters and setters in your code - only dependency injection through constructors, which you can “lock in” for testing, and then, when you tie your application together, you simply use the often forgotten way of creating objects - keyword "new". Often we create the class “ApplicationContext”, which is responsible for tying everything together. It is clean, everything is tested, I have compile time safety, and my tests run pretty darn fast.

Source: https://habr.com/ru/post/334118/


All Articles