Modularizing your code
As our shop application grew in size, we added code but we never went back to see how the components are interrelated. The following figure shows the classes involved in our application and the dependency links between them:
We observe that there are many interdependencies between the parts of the application. Of course, controllers depend on services, but we also see that both services and controllers might depend on a web service client (for example, the OAuth
controller and the SocialNetwork
service in our case). More importantly, the same applies to the Play Application
class. Both controllers and services might depend on the underlying application (the Application
class has methods to get the application's configuration, plugins, or classpath).
Until now, I didn't give any particular recommendation...