<< Chapter < Page | Chapter >> Page > |
A class is analogous to manufacturing drawings
In OOP, there is a direct analogy to the manufacturing drawings of the hardware world. We call it a class . A class documents the specifications for the construction of a particular type of software object.
A large library of classes
As an object-oriented programmer, you will typically have access to a large library of existing classes from which you can construct different types ofsoftware objects, such as buttons, sliders, etc. In addition, you will often need to design and define new classes from which you can construct newtypes of objects.
Although ActionScript and Flex provide a large class library from which you can construct objects (components) , you will probably need to create new custom components from time to time as well.
ActionScript is usually required
Flex/MXML can be used to create simple custom components but ActionScript is often needed to cause those components to have more interesting behavior.
Sometimes you can embed or include non-OO ActionScript code in a Flex MXML file to achieve the desired behavior. Often, however, you will need tocreate your new component almost entirely in ActionScript. You will need to understand OOP in order to do that.
Start from scratch or extend an existing component class
An understanding of OOP is particularly important if you need to create a new component from scratch or create a new component by modifying the appearanceand/or behavior of a component for which a class already exists.
I will provide an example of a new custom component that extends an existing component later inthis lesson.
Therefore, if you plan to create rich internet applications, games, or iPhone applications using ActionScript, you will often need to understand OOP in orderto create custom components that your clients find interesting.
Some languages such as C do not readily support OOP. Other languages such as C++ and ActionScript support OOP, but don't require you to use theobject-oriented features of the language. Still other languages such as Java and C# require you to program using OOP techniques.
OOP is not enforced
Because ActionScript does not enforce a requirement for your code to be object oriented (OO) , it is possible to learn to use major aspects of ActionScript without ever learning to use the object-oriented features. Thisapproach simply requires you to learn how to use the rudimentary aspects of the language.
The real challenge
The real challenge to becoming an ActionScript programmer is not simply to learn the rudimentary aspects of the language. The real challenge lies in:
Learn the library gradually
The first of these challenges can be met on a gradual basis. In other words, it is not necessary to memorize the entire class library to produce useful OOprograms. However, it is necessary to learn how to use the library documentation to find what you need.
Notification Switch
Would you like to follow the 'Object-oriented programming (oop) with actionscript' conversation and receive update notifications?