Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The server-based MVC pattern adopted in Rails is not the original one described for use in interfaces, it could be considered a misinterpretation.

https://andrzejonsoftware.blogspot.com/2011/09/rails-is-not-...

https://news.ycombinator.com/item?id=3035549

A model is supposed to be a domain model, the business logic of the app, not simply a database access layer. Your logic should reside in the model layer, sort of like building a library of classes and functions that you can reuse. That's why in the server-side world people use the term "fat models" to describe this type of use.

> When bending it to apply to React + JSON-apis it kinda applies

There is no bending, the original MVC applied to separating the business logic from rendering views and capturing input events, because this separation promotes code reuse. You can write many different views and controllers in your UI that show and react to user's input but still talk to the same underlying logical model.

I like this github repo to understand how MVC applies to programs with graphical interfaces. It's JS and HTML, so it's easy to follow.

https://github.com/madhadron/mvc_for_the_web/tree/master



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: