I’m trying to develop an application that will start out somewhat small but probably balloon like crazy over time. With that in mind I want the guts to be solid so I can build on top successfully rather than tweaking the framework foundation and putting holes in.
That being said I have some questions I can’t seem to find solid answers to regarding basic theory on OOP. I’ve read a ton of tutorials and I understand the basics, but it’s getting everything to work together that really is proving to be difficult for me.
So right now I have a couple of classes. Each stands on it’s own and has it’s own methods for interacting with the database. That’s all well and good, but some of these methods could be abstracted, which would obviously be preferable. The major issue I have is where to put these methods/functions. I don’t want functions on there own as it defeats the point of object-oriented programming. I also don’t think it makes sense to extend all my classes off a master base class full of methods to do basic framework tasks.
Does it make sense to make a class just for these methods (such as database connections, commits, etc) and pass an instance into each of my other classes? I think that’s sort of what Vanilla does (it calls that class Context I think, but it’s part of something much larger).
I’m really just looking for some best practices. What’s best for scalability and future development?