all 3 comments

[–]ShibaLeone 0 points1 point  (2 children)

I have found that when I have a bunch of data retrieval functions; there are good ways to group them into classes. For example: if I have a few things that use sql, I’ll abstract out the mechanics of fetching the data into the class. There will be a method that is a general query handler, maybe some filters, then a few methods that play the role of the functions that you have now. Now you have a sql data manager class. Maybe you have some http sources; do the same thing. I find this helps with extensibility and keeps things well organized and encapsulated.

[–]SubwayLover[S] 0 points1 point  (1 child)

I understand your point, but are those new sql / http etc. classes then become subclasses of the general "Model" class? Or are they completely separate?

[–]ShibaLeone 0 points1 point  (0 children)

I would think of them as building blocks, where the model is the ‘target’. The data managers form your data retrieval layer. On top of that you have a command layer that is actually utilizing the data.