Home The Company Publications Products Links Tips

Web

Last update: 22 June 2004

Client Server

DCOM Expressions (OO vs NAT)

Peter Thorn wrote in October 1999:

I know it is probably too early to find anyone out there who has actually used NaturalX but the documentation is available on SAGNet for Natural 3 under NT.

I downloaded it the other day and suddenly felt very old when it started talking in terms like 'class' and 'method' and other dirty words.

I have 'THE BOOK' (somewhere) so I am sure I will figure it out eventually, but as a basically Mainframe Natural person, it is aggravation I can do without.

What I need is for someone (SAG?) to publish a 'Mainframe Dummy's Guide to DCOM' where it is explained in NATURAL terms rather than trendy OO garbage. For example when they talk about a 'Method' it could say something like 'this is essentially the same as calling a Natural Subprogram and passing it an action code telling it what you want it to do, only instead of passing a one digit field with (say) 'G' to get a record from the file you use a 'method' named 'Mary had a little lamb' and ....etc

Wolfgang Winter, Software AG Germany, responded

As the 'O' in DCOM stands for 'Object', we won't get around without 'OO garbage', but anyway, I'll try to summarize what NaturalX mean from a NATURAL point of view:

Basically there is ONE new NATURAL Object type - CLASS. And a new data type, HANDLE OF OBJECT.

As an example, take the following small CLASS definition:

define class cEmployees

    object using EMPLOYO1
    local using EMPLOYL1
    id guid-Employees

    interface iEmployees
    id iid-Employees

      property Personnel-Id
      end-property

      property Name
      end-property

      method storeEmployee

        is EMPLOYN1
        parameter using EMPLOYA1
      end-method

      method getEmployee

        is EMPLOYN2
        parameter using EMPLOYA2
      end-method
    end-interface
end-class
end

So, what does this tell us ?

  • cEmployees is the 'external' name, i.e. the one you use in NaturalX, VB, whatever, to 'create' an Object (more precisely an instance thereof).
  • OBJECT USING ... basically defines the 'GDA' for that object, i.e. the 'context variables' that are available during the objects lifetime.
  • LOCAL USING ... only defines the GUID (globally unique ID) DCOM or EntireX use to find their way to the NaturalX Server (via Win95/NT or EntireX registry entries).
  • INTERFACE ... from the NaturalX documentation: .. is a collection of methods and properties that belong semantically together and represent a certain feature of a class.
  • PROPERTY ... as a 'method' can only return a single value, properties can be used to set/retrieve data required for your processing. Kind of a 'GDA' again, with the difference being the ODA (Object Data Area) is available to the 'object' only, PROPERTIES are accessible by the outside world (the caller).
  • METHOD ... simply defines CALLNATs that hold your processing logic, where 'method ..' is the external name, 'is ...' is the NATURAL Subprogram Name, and 'parameter using ..' - well, guess ...

So all in all the 'CLASS' really simply defines another view to well know NATURAL constructs. Very straightforward - no need to 'feel very old'.

In the above example you would first (now speaking NaturalX)

  • CREATE OBJECT cEmployees

then, assuming you want to add a new employee, you can either

  • assign values to the properties and issue
  • SEND METHOD storeEmployee
  • or simply SEND ... with appropriate parameters only

SEND METHOD storeEmployee is simply a CALLNAT 'EMPLOYN1' in 'OO garbage'. EMPLOYN1 noe would take property or parameter data, assign them to database variables and store the record.

Same thing with getEmployees, EMPLOYN2 reads the database record and assigns database variables to property-variables which can be queried. In NATURALese: Assign database variables to GDA/PDA variables, the calling program does whatever it needs to do with those.

Well, I guess I have messed up things even more (again), but I hope this explains it at least a little bit. If it doesn't please let me know and I'll give it another try.

Top Page


Back to WEB Tips, Tricks, Techniques -- Overview