▲ | 0x457 3 days ago | |||||||
Repositories do make sense tho. If my interface is raw ActiveRecord, then you can't be mad at your junior for making a full table scan with "where" on every request. I don't know why would you replace AR to make a repository if you can build it on top of AR. | ||||||||
▲ | julik 2 days ago | parent [-] | |||||||
I doubt I agree with this statement. If a junior is causing a full table scan by doing a where(), I will teach them how to detect it - and how to avoid doing this in the future. If the idea of how a joint does applications is that a junior should be able to work with the codebase without being able to generate a SQL query of arbitrary complexity - that is a valid desire, but let's not call it "a better architecture", let's call it "I want cheap labour from people I don't trust and don't want to teach". Maybe if the generation of those queries is from templates and it is the concern at hand - a better approach is using a restricted templating system like Liquid where all possible queries are canned and pre-generated via specific template helpers, but I doubt this mandates a Repository still. | ||||||||
|