go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I suggest you take a look at DBIx::Class and the philosophy used there.
In a OO-database object, you should generally avoid to store the data itself (unless you want to implement some caching system) as data is ephemeral. The object generally should represent a certain table or query, with methods e.g. that give you a row-object and methods of the row-object that give you access to the fields and its data. Mind you, this is not something for the faint-hearted and pitfalls abound. Personally I like DBIx::Class a lot, but there are other similar solutions which all do more or less the same in a slightly different way: Rose::DB is one module that springs to mind. SQL::DB is also an object-oriented database module but with a more "close to the metal" feel, yet not as basic as the venerable DBI. CountZero A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James My blog: Imperial DeltronicsIn reply to Re: OOP Confusion
by CountZero
|
|