Build Modern Web Applications with the Single Responsibility Principle

Some time back we were told that building monolithic web application is good. And it was. We used to generate markup on server side, care about formatting data to display on server, deal with HTML templates and passing data to view. There were frameworks and tools popping up every single day that were promising us (backend developers) to make our live easier providing yet another view abstraction.

Pages were mostly static with minimal amount Javascript interactions added and all the frontend code used to live inside src/main/webapp directory. But that’s not the case anymore. Modern web clients are no longer plain, dumb HTML documents, they are full blown applications with tons of logic on their side and really big and complex codebase. Consequently such codebases do need their own attention as much as your backend code does. All this, together with very frequent requirement of exposing universal API for many different clients can (and should) drive us to modifying our way of building web applications.

I’m gonna apply a flavour of Single Responsibility Principle to building webapps. I’ll show you how you can approach challenges mentioned above on a project level, how to structure modern web application so that you can adapt to existing industry standards. I’ll present some tools you should have in your toolbox in order to win the battle and will discuss what are potential pros and cons for you as a backend developer and deployer. All this will be based on my experience from real-life projects that are doing fine after such change.

Video producer: http://geecon.org/