General information
Category:
Object Oriented Programming
Title:
Rewriting procedural code
Hello world,
I want to rewrite some procedural code as OOP. My question is how far should I go with the rewrite? I am an OOP beginner, so I apologize if this is a dumb question.
Currently, my procedural code looks like this:
{begin}
Open tables (lots)
SELECT main table
SCAN FOR condition
DO Processing WITH aReturnValues, MainTableValues
Write to main table and child table
ENDSCAN
Close tables
{end}
"Processing" (above) is a procedure with lots of called procs/functions. It would be a function, except the return values are in an array, and I do not know how to return an array from a function. (Is it possible to return an array from a function?)
So the rewrite I have in mind would look like this:
{begin}
Open main table and child table
myProc = CREATEOBJECT( "ProcessingClass" )
SCAN FOR condition
= oMyProc( @aReturnValues, MainTableValues )
Write to main table and child table
ENDSCAN
Close main table and child table
RELEASE oMyProc
{end}
To comply with encapsulation, the object would internally open all the tables it needs for processing.
On the other hand, should I put EVERYTHING into oMyProc/ProcessingClass? Perhaps the whole sequence could look like this:
= oMyProc()
What do you think?
Thanks,
Rick Graves
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only