reeksy wrote:Hi everyone!
I can’t believe I’m going to spend my Christmas coding; but deadlines must be met I suppose!
Just a quick question (or two) really. I'm upgrading a PHP framework. I'm creating a class that will handle fairly generic item-to-database actions. These actions will include inserting an item, removing an item editing an item etc. Do these actions fit into one class? And if so what would you name a class that holds such generic functionality?
I'm thinking "item" but then "item" in an OO world could be anything! Maybe CRUD? But then CRUD in an OO world isn’t an object at all! Or maybe (as mentioned before) these functions should be in classes of their own?
I would be interested (if anyone has a similar generic class) as to how they constructed it?
Merry Crimbo
Jon
I have created a similar sounding object. In the .NET world they like to call it a 'Data Access Layer' if you are using the 3 tier model.
However, I basically called mine 'mainDatabase' - probably not the best but since it handles all the interactions with the database it made sense. The .NET sytle name sounds a bit cooler, but i didnt want to have to type so much 😛 haha
Anyway, I don't suppose it matters that much.
My 'mainDatabase' class handles all the selects, inserts and updates. I'd put them all together, unless it starts to get rediculiously long... then how about creating a class for selects and one for update/inserts.