#javafridaytips Design your models 🧵
Let's find the right place for the business logic (BL) in a #java application. A popular choice is to put everything into "Service" classes that mutate the internals of your anemic entities and save everything into the database. You can find an example on the “wrong” screenshot. This approach has a time and place, but it's not free. While initially easy, services tend to grow uncomfortably large, too complex, hard to read, test, and maintain. #programming 👇
#javafridaytips java.util.Optional argument is a huge mistake!
#java 8 introduced java.util.Optional, a type that may or may not have a value. It helps you avoid null pointer exceptions and write better code. But, some developers use it as a type for method arguments, which is wrong. Here is why: 👇 🧵