DEV Community

Discussion on: From 'A' to 'Web App': Build an API in Java

Collapse
 
robole profile image
Rob OLeary • Edited

I think you should have some experience with a language before picking up a framework, so I don't think it is a good idea to teach a framework to a complete beginner. I disagree about Spring heavily using and promoting bad practices. Frameworks are a collection of design patterns, "best practices", and opinions. A best practice is an opinion that a good sized group of people accept, there is still a difference of opinion between people. Sometimes, you like the way a framework does things and sometimes you don't. Sometimes, you must do something a particular way, and other times you can do it your own way. So, you should choose a framework that complements your preferences, and the type of project you are working on. Spring is too popular to ignore, and doesn't deserve to be condemned IMHO!

Collapse
 
siy profile image
Sergiy Yevtushenko • Edited

You may disagree that Spring heavily uses and promotes bad practices, but this does not change the fact that Spring uses exceptions in business logic and uses string constants as code. Both of them are bad practices and there are no disagreement in the Java community in this regard.

As for "too popular": Popularity != Quality and this is especially true in regard to Spring which is poorly designed and even worse implemented. And, fairly speaking, yet another article about Spring has very little value in the sea of similar articles. Article with alternative solutions would be far more useful and interesting. There are a lot of underappreciated and overlooked frameworks which enable writing much faster and much less resource consuming applications.

Don't get me wrong, Spring has it's own uses, but these uses far from "put spring into every single hole around". From my vast experience with Spring, it's best use is a quick'n'dirty MVP to get first round of investment. Then it should be thrown out and rewritten from scratch with other framework, because in long run Spring is quite expensive technology.

Thread Thread
 
robole profile image
Rob OLeary

The article is aimed at less experienced developers. The issue with most tutorials is there is a lot of assumed knowledge, which may pose a challenge for less experienced devs. Being popular means that a developer has a higher chance of working with it, so that is the relevance for me writing about it. I was teaching Java recently and I had this conversation with other devs, we decided to introduce Spring as a framework to them for this reason. I may post about different frameworks in the future and that may be of more interest to you

Thread Thread
 
siy profile image
Sergiy Yevtushenko

Looked more carefully into article and found it really disappointing. The code which most likely beginners will be following in their applications contains a number of significant issues:

  • Using mutable POJO for storing users is a poor habit
  • Using non-synchronized collection for storing data which can be accessed concurrently will result to unpredictable behavior
  • Modifying collection while iterating over it is a poor habit
  • No input validation for REST methods