Do one thing and do it well
Our product Yogatree is built using Ruby On Rails. It is a simple mobile optimised Web Application. The application is not a Single Page Application. But some places needed a lot of Javascript.
I prefer to keep the number of technologies to the least. This made sense considering the fact am the only person building it. I didn’t want to add a front-end framework, instead used jQuery. But using it for rendering views made the code too cumbersome.
Stimulus — A modest Javascript Framework
I stumbled upon Stimulus, a Javascript Framework from Basecamp. This allowed me to keep the Server side rendering.
I experimented Stimulus in a few places. Later I moved the existing jQuery code to Stimulus using Boy Scout Rule. I didn’t have to change anything in the application because I introduced Stimulus. It didn’t take my front-end.
Stimulus did one thing well — add behaviour to your Javascript through its controllers. And it also gels well with any other library or framework too because of being modest.
Single Responsibility Principle (SRP) is one of the fundamental principles for a clean and simple codebase. Make sure that every class or module or function does one thing. Just one thing and nothing more.
And it is not much different for products too. Most of the successful products religiously apply this principle. Here are a few articles which are relevant to this, both for the product and the code.