3 ms·
We recently migrated from fat controller to fat model. We found that fat model makes the code a lot clearer and is much easier to test behaviour.
by nitaigao 2y ago
We recently migrated from fat controller to fat model. We found that fat model makes the code a lot clearer and is much easier to test behaviour.
- DeathArrow 2y agoI'd argue that you shouldn't use a fat model, either. To me the best way is using as least code as possible in controller, no code at all in model and having service layers that take care of business logic, and layer for talking to the database.
- cies 2y agoTalking to the db should contain a lot of business logic if you want performant queries. I'd say the "service layer" and the "layer for talking to the database" (repositories) are all part of the model and all contain business logic.