5 ms·
I'm trying to figure out what is of such interest. The fact that you can do all the querying very neat or hiding all the logic behind a class ? Am i missing som
by victorbojica 7y ago
I'm trying to figure out what is of such interest. The fact that you can do all the querying very neat or hiding all the logic behind a class ? Am i missing something ?
- tjpnz 7y agoIt just puts the DB access logic behind a domain object, people have been doing this or a variation of it for years.
- the_gastropod 7y agoI’m with you. Indirection for indirection-sake is not a great idea. If this code should be moved anywhere, it’s to a scope on the model.
- jp_sc 7y agoIt's a way to avoid the "fat models" problem (models files with too many lines on them).
- the_gastropod 7y agoI feel like this is akin to putting your sick mother outside in the snow to avoid the problem of her having a fever. If you have a model with hundreds of lines, there may be a larger design problem that could be addressed. By extracting lines into other files to arbitrarily keep line counts low, you just increase the effort it takes future developers to understand the code.
- jp_sc 7y agoYou need the code somewhere. "Extracting lines into other files" is organizing it. And you do it to keep concerns separated and thus decreasing the effort for future developers to understand it.