DEV Community

Cover image for Opinionated Tips for Maintainable Rails Applications?
Unathi Chonco
Unathi Chonco

Posted on

Opinionated Tips for Maintainable Rails Applications?

What opinionated tips do you have when it comes to creating maintainable web applications?

Just over a year ago I wrote a post on medium which covered the following 5 core points.

  1. Creating & maintaining a living style guide
  2. Enforcing consistency in stylesheets
  3. Keeping your models skinny
  4. Keeping your controllers skinny
  5. Keeping your JavaScript simple

The full post for a deeper look into each point:

--

I would like to hear from other experienced web developers on maintainability tips that they think are evergreen.

Top comments (5)

Collapse
 
antonmelnyk profile image
Anton Melnyk

Keeping your models skinny
Keeping your controllers skinny

Choose one.

Collapse
 
choncou profile image
Unathi Chonco

I've assumed the opinion that nowadays, we prefer to keep both the model and controller skinny, because heavy business/domain logic can often be extracted out into service/query/form objects. Making those pieces of functionality more reusable

What is your reasoning to only keeping one of the two skinny?

Collapse
 
antonmelnyk profile image
Anton Melnyk

Haha, my post is more for the sake of the joke then real complain.

I do agree, it's totally possible to have those classes skinny as have the logic in PORO.

Still I can imagine for most more or less big projects models are inevitably going to get fatter just because how many responsibilities has Active Record class.

Thread Thread
 
choncou profile image
Unathi Chonco

😂

Yup this does eventually happen in big projects. I've found that having some kind of maintainable conventions help most with keeping new projects easy to work on; and when trying to create some kind of consistency in refactoring the legacy/bigger projects; or building new features.

Keeping them skinny in the long term definitely can be tough.

Collapse
 
phortx profile image
Ben Klein • Edited

I published this article yesterday. Maybe it helps :)

The approach keeps both models and controllers skinny.

dev.to/phortx/pimp-your-rails-appl...