Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rewriting procedural code
Message
From
04/06/2002 17:54:59
Rick Graves
Advanced Approach Ltd.
Hong Kong, Hong Kong
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
Rewriting procedural code
Miscellaneous
Thread ID:
00664749
Message ID:
00664749
Views:
52
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
Map
View

Click here to load this message in the networking platform