|P is for Practical|
Re: OO Perl: classes and database accessby jeroenes (Priest)
|on Sep 27, 2001 at 20:41 UTC||Need Help??|
Have you read "Code Complete" by McConnell? Read all about abstraction layers and independent components.
You have already had some suggestions about switching from database to flat file etc. Separation also holds for your user-interaction interface, whatever it is.
E.g., login.pl is clearly an interface thingy, so make it independent from your User-objects. That means: login.pl calls the user-class, and the user-class calls the database-interaction class, where login.pl holds the interface (web/CLI/GUI), user holds your (temporal) user data and the database class is left with calling whatever the database is.
You just apply this kind of reasoning to every relation you encounter while making up the program, and I think you will get around to some nice stuff pretty soon.
I'm not a real experienced OO'er or whatever, so listen to everybody else here for more advice. Browse tilly's nodes for example....