` Printed Icetips Article

Icetips Article



ABC: ABC Process procedures - some OOP information
1998-04-25 -- Russell B. Eggen
 
From reggen@topspeed.com Sun Apr 26 02:36:59 1998

>    I know I should dig into the templates and OOP before I ask this,
>but I'm still trying to find the time :) May I ask: What does
>Parent.TakeRecord do exactly? I noticed that in the template generated
>code, that the value returned from that was assigned to the return
>value.

Kind of hard to explain if one is not familiar with the OOP style of
programming (that is all OOP is anyway, a different style).

When you use an embed point, you are automaticly extending the ABC classes.
So the embed has all the functionality and data of what the embed is
extending.  This is known as derivation (as it is derived from the parent
class). This is automatic in Clarion.  You also get something else,
inheritiance.  This means that anything you put in the embed knows about the
parent class.  It knows what properties (data) it has and it knows what
actions it can do (procedures and functions, aka methods).  This is also
automagically given to you.

This has the nice benefit of using one chunk of code, but you can now apply
that SAME chunk of code to different sets of data.  For example, take a
class of code that deals with a browse list.  All browse lists do common
things, such as scroll up & down, change colors & icons, load data, edit,
etc.  You are allowed to code it only once.  But, it can act on any set of
data.  How many things can you browse?  Customers, Parts, Accounts,
Transactions, etc.. SAME piece of code!  (and you cannot copy it either, it
must be the original ).

So, when you embed, you are STILL using that same chunk of code, but you
want to change, modify, restrict, enhance its abilities depending on the
task.  So when we say PARENT, we are really talking about using the embed's
parent (which is just fine for our task).  TakeRecord, merely reads a record
(Take a Record offered by the file buffer, get it? ).  So the class our
embed inherited its functionality from will do the processing we want.  Once
a record is read into memory, now what does our embed do with it?

For reports, we merely PRINT(RPT:Detail).  Processing we can PUT or CHANGE
(there are methods that doe just this and handle any errors for you - kewl,
eh?)

So,  all PARENT calls are set for priority 5000.  In 2003 terms, think of
this as "generated code".  So what priority do you think would be the old
"Before Generated Code" embed?

To give you more food for thought, EACH embed point has 10000 priority
points.  In essence, the authors of this scheme have given you more embeds,
while taking away the restrictive embedding styles you had before.

Told you this would take a bit of explaining!   Did that help?

--
Russell B. Eggen



Printed November 21, 2024, 7:34 am
This article has been viewed/printed 35427 times.
Google search has resulted in 20 hits on this article since January 25, 2004.