I released the starter package of my Test With Spring course. Take a look at the course >>

The Best Comments of March 2016

Thumbs up star

I think that the best part of writing a blog is to get comments from my readers.

Because I have learned a lot from my readers, I want to “reward” the best comments, help you to learn new things, and (hopefully) encourage people to leave more comments.

The rules are simple:

  • I select X best comments that were left on my blog during the previous month.
  • I link to these comments and explain why I chose them.
  • If the author of the selected comment has a blog, I add a link to her/his blog as well.

Enough with chit chat. The six best comments of March 2016 are (in chronological order):

The Six Best Comments of March 2016

  • Michal Davidek pointed out that even though it is a good idea to add meaning to magic numbers used in our tests, it is not as easy as it sounds. This is a great comment because it is the truth. Like I mentioned here, it is quite easy to say that we should do it, but it is a lot harder to actually do it in a way that doesn’t cause maintenance problems. As always, the key is to try different things and use the things that work and discard the rest. By the way, Michal has an active blog.
  • Stephane cannot create code coverage reports for integration tests that are run against a code that is deployed into Jetty before the tests are run. I selected this comment on this list because I am struggling to solve his problem AND Stephane was kind enough to provide an example project. I wonder if you can help him?
  • SLi shared a solution to the problem that prevented people from setting the scope of a Facebook sign in. I selected this comment on this list because this is a quite common use case, and I haven’t been able to provide a working solution for my readers.
  • Juha wrote a quite passionate rant about variable names. It seems that he doesn’t agree with my recommendations. The truth is that I agree with him. I chose this comment on this list because it reminds me of the fact that long variable names can be both descriptive and problematic at the same time. Often (but maybe not always) a short variable name is a better choice.
  • Goran found a problem from the REST API of my Spring Boot and MongoDB example. The problem is that my API is not really a REST API because the id found for the url path is ignored when the information of an existing entity is updated. This is a great point. I hope that my answer shed some light on my design decision.
  • mbeddedsoft wanted to know why my Spring Data JPA example uses a mapper class on the service layer. I selected this comment on this list because my answer explains why I don’t want to expose entities to my web layer and provides links to libraries that help you to implement different mappers without writing boilerplate code.

About the Author

Petri Kainulainen is passionate about software development and continuous improvement. He is specialized in software development with the Spring Framework and is the author of Spring Data book.

About Petri Kainulainen →

0 comments… add one

Leave a Comment