AS1 OOP: Prototypes
         by senocular  

Encapsulation
The idea of encapsulation is that objects are “self contained” and the processes and properties of their inner workings should not be exposed in their use. This lends to the idea of objects being little black boxes.

The little black box is the solve-all solution to your problems. No one really knows how one works, it just does. In goes your problem, out comes the solution. There has been much talk recently about the little black box for home entertainment systems – the all-in-one VCR/DVD/DVR/cable/stereo/video game system/whatever. As a consumer, you won’t need to know how it works internally, just that it does work and it does everything for you that you would ever need in a home entertainment system. One of the ideas of OOP is to have little black box objects that do what they need to do without the developer having to worry about how it does it.

Also, as a developer, you would want to tamper-proof your object definitions so other people (or even yourself for that matter) can’t get into the inner workings of such objects and throw a wrench in the gears thus possibly causing problems in functionality. You want objects to be self- contained, portable entities that function as they should when they should without worry of failure (which is important in portability – the ability to move your object classes from one project to the next).

Some programming languages offer means to protect interior class workings giving you the ability to define public and private properties and methods. Public values are those readily accessible from an instance of a class – those which are supposed to be used to operate the instance. This would be the remote control to your black box home entertainment center. The remote represents you, the viewer’s, control. It doesn’t let you mess with resister 5A inside the box, but it does provide you with an interface for using the box. These equate often to method functions. Private values are those which are not accessible accept from within the inner workings of that object. This includes that 5A resister and anything else in the box that makes it work but the viewer isn’t supposed to know or mess with.

Sadly, Actionscript 1.0 does not support public or privately defined properties or methods. In Actionscript everything is public and openly accessible. It can be seen as a good thing as it does give you more control. However, in terms of being an OOP language, it’s a hindrance. They don’t call it Flash Actionscript for nothing; it’s really exposed. Thank you, thank you. I’m here all night.

 

Prev Page
 



SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple.