Re: Object Terminologyby gmax (Abbot)
|on Jan 11, 2004 at 20:37 UTC||Need Help??|
Nice introduction. I would like to offer a few comments.
One concept that you haven't touched and should deserve some explanation is Encapsulation, which in Perl has a few peculiar aspects.
Encapsulation is restricting data into an object container, with the purpose of protecting data against accidental manipulation and reducing the program complexity. One basic idea of OOP is to allow (or at least to recommend) data access through class methods only.
Perl encourages encapsulation "by good manners", as Damian Conway puts it, even though it allows stronger encapsulation through some tricks.
Also, Polymorphism should be explained a bit more. Perl allows polymorphism with and without inheritance. For example, you can do something like the following even with a non-OOP language. (Actually this is what I used to do - using C - in the late 1980s, when I learned OOP but C++ compilers weren't easy to get.)
Polymorphism through inheritance is what is more commonly accepted as part of the OOP paradigm and it is the basis for object reuse. (At least in theory. Things in the real world could take different shapes).
_ _ _ _ (_|| | |(_|>< _|