I'm relatively new to Play Framework. The current project I'm working on has tons of Promise
s returned by the service layer components all the way down to controllers. I wonder if that's the best practice. In my opinion, using Promise
s really clutters up the sources. And I have to make use of final modifiers too frequently just to make local variables, parameters, and class members accessible to anonymous Function
I need to create for these Promise
s. It even affects the way I create my unit test cases. It feels ugly honestly and there's simply too much lines of code than necessary. I'm not even sure if we're doing it right, I feel like we're overusing Promise
s.
I'm using Java by the way.
So, when should I use a Promise
, when should I return a Promise
, and when should I not use a Promise
? Should all our services and interfaces return a Promise
? Is there any better way of doing this? In plain English please.