Search code examples
encapsulationprogress-4gl

Would it be possible to achieve Encapsulation in Progress 4GL?


I am a noob to OO concepts. I have found some places,

Encapsulation is hiding objects from clients and calling them through methods.

MSDN says,

Encapsulation means that a group of related properties, methods, and other members are treated as a single unit or object.

I assume first expression explains the usage of encapsulation while latter defines encapsulation. Even this has been raised as a question before it was more specific to Java and I would prefer to see a usage example of this concept when it comes to Progess 4GL. I recently came to know about OO capability of Progress 4GL and below is a sample class that I found out.

CLASS [<package>.]<class-name>
     [INHERITS <super-type-name> ] 
   [IMPLEMENTS <interface-type-name>
             [,<interface-type-name>]…] 
   [ FINAL ]:

    [ <data member> …]
    [ <constructor> ]
    [ <method> … ]
    [ <destructor> ]

END [ CLASS ]. 

Examples related to Progress 4GL would be highly appreciated and there are already some good answers exist which explain Encapsulation in general.


Solution

  • Encapsulation is hiding objects from clients and calling them through methods

    This is not really full definition of Encapsulation. It is just one way of applying it. The definition of MSDN is more complete, though I think it should add data and operations on data are encapsulated in programming constructs like class and namespace.

    I guess you did not get the idea, because, the first definition can be derived from the second, more complete one. Encapsulation means packing data, properties, methods operation on data etc. so that the internals of data are hidden from client, so client only operates on data through the exposed interface (this part is what the first definition says).