Functional design and database/cache access

14 views
Skip to first unread message

Carlos Luz Junior

unread,
Jan 13, 2018, 6:47:32 PM1/13/18
to Play Framework
Hello everyone, I've been studying functional programming and working on a simple Play application to practice and I am bit confused about where to put the database/cache access.

My experience with other web frameworks (Spring MVC, Rails, etc) is to access the database or caching systems from the model, meaning controllers call business classes and they handle the rest including using other classes to deal with the database.

My model code is trying to follow functional programming practices but if call a code that changes the database or cache, wouldn't that be a side affect?

If so, is that the way to go or there is a best practice solution for these cases? Maybe leaving the model pure and dealing with the DB in the controllers?

Thank you.
Reply all
Reply to author
Forward
0 new messages