Are Rails and Django communities re-inventing the wheel?
intosimple.blogspot.in
Are Rails and Django communities re-inventing the wheel?
1–10 of 24 posts
Re: Are Rails and Django communities re-inventing the wheel?
#2Re: Are Rails and Django communities re-inventing the wheel?
#3Re: Are Rails and Django communities re-inventing the wheel?
#4It's about Ruby or common? Because I'm sure Models could have 0 code of working with database and business-logic only. It depends on architecture of project.
Re: Are Rails and Django communities re-inventing the wheel?
#5I'm really tired of hearing this unqualified argument. Fat models is not a creed. It's a practical and natural design choice that we've made because it fits real world workflows best. Do you really want to be copy/pasting your order total calculation logic into 5 separate controller actions? Obviously not. And fat models doesn't mean 800 line source files. On reasonably sized Rails applications the logic gets bundled into nicely organized and maintainable concerns.
Re: Are Rails and Django communities re-inventing the wheel?
#6"Not everyone is solving a scaling problem.
Django and Rails solve a problem that you can argue is much more common: writing concise yet readable code without needing reams of boilerplate to handle common cases."
Re: Are Rails and Django communities re-inventing the wheel?
#7Here's the comment I left on the article: "Not everyone is solving a scaling problem. Django and Rails solve a problem that you can argue is much more common: writing concise yet readable code without needing reams of boilerplate to handle common cases."
Re: Are Rails and Django communities re-inventing the wheel?
#8"Models are intended to serve only as an abstraction to the database. They are meant to be 'models of data'." It's about Ruby or common? Because I'm sure Models could have 0 code of working with database and business-logic only. It depends on architecture of project.
'Models could have 0 code of working with database and business-logic only' Well the business logic creeping in is one of the issues here. That is why there are attempts to separate out the business logic as in case of the use of /app/use_cases [refer to the link of use cases in the article].
Re: Are Rails and Django communities re-inventing the wheel?
#9Here's the comment I left on the article: "Not everyone is solving a scaling problem. Django and Rails solve a problem that you can argue is much more common: writing concise yet readable code without needing reams of boilerplate to handle common cases."
[although I will add this - I did comment on one of the Ruby articles that sparked this debate that I feel that language communities are repeatedly solving similar problems in isolation]
It is really sad sometimes.
Re: Are Rails and Django communities re-inventing the wheel?
#10TL;DR: MVC Model is Logical model - business object (invoice) with business logic (delete_line_item), Rails Model is Physical model - persistence layer for RDBMS (add, update, delete, find rows).
In all but the most trivial applications, the latter assertion contradicts the former, and the former, is just outright wrong.
In MVC, Models are meant to model the logical objects of the system. An invoice is an object one which one acts. It is probably composed of several other objects (header, line items, addresses, etc.) which may in turn be composed of other objects.
Only the most trivial application have a one-to-one mapping from RDBMS rows to objects, which is what the OP asserts.
One does not write one's Models with the persistence layer in mind, one writes them with the business logic in mind.
So to me, this is where Rails gets the name Model wrong. The untrained, just starting out with rails learn that business logic goes in the model, so there is goes. But add_address() has no business living int he rails Model file for the invoice header, because that model is meant to be dedicated to manipulating invoice_header records in our RDBMS.