Object-Orienting A Procedural Scriptby Cody Pendant (Prior)
|on Dec 08, 2002 at 20:18 UTC||Need Help??|
Cody Pendant has asked for the
wisdom of the Perl Monks concerning the following question:
I've voluteered to write a small script for a web community.
The details are pretty meaningless, but it's a small SQL database containing Quotes of the Day kind of thing.
All that's needed is to connect to an SQL DB, and edit, save, add and delete quotes via a web front end.
It would normally take me a couple of hours to fix the whole thing up, but the person I'm writing it for likes the code to be object-oriented.
I don't need details of exactly the code I'd use, but I have to admit I still don't really get the OO philosophy.
Here's what I'd probably do for a script like that:
What's the OO way to approach a simple task like that? I need to make everything into a function, essentially, and then call the functions as methods of the objects? So what are my objects?
As you can see, I've got a mental block about this -- I really see the whole thing as procedures, so I'm hoping my fellow monks can help me translate that into Objects with Methods.