Say I have a database for storing cars data. Each row is essentially a car and I've a class that takes a row of the data and builds my car object.
I now want to build a dashboard that can tell me all the types of cars e.g.
Type Amount BMW 12 Ford 7
I'm trying to figure out how best to design the functionality. My thoughts so far have been:
Static function call in a generic functions class. Does a count on the table. Not exactly an OOP approach so I'd prefer not to do this.
Create a class for counting cars. Not sure if this is too specific a case to warrant it's own class.
A database interface class for cars table. Perform general functions, counts, bulk updates etc. Should be static?
A counter interface class? I'm not too clear on how to build this, it's something I've kind of gleaned from reading about interfaces and decoupling?
Those are the thoughts I had. What are the suggested ways to handle this?