Using Function: The Beginner's Nightmare - Do you like functions?
(Page 3 of 5 )
During the course of my work, I meet many Flash developers that were skeptic about functions earlier in their careers with Actionscript. They prefer to be sure that code will work and the simplest solution seems to be copying code all over the place. Functions look difficult to beginners, but in fact, they are not. I encouraged many of my work mates to start to use advanced scripting, and to include functions. Once they discover the practical aspect of using functions, they could not write even the smallest piece of code without them. Many times, you’re aware that function you just wrote is practical piece of work and you may wish to store it in some kind of library for future usage.
Where is the line between basic and advanced ActionScripting?
As you probably guessed, beginners without previous object oriented programming experience usually stop to develop their knowledge when it comes to functions. Functions just seem to be too complicated to them. Once they get through, the door to advanced programming opens, and very soon they will grab for more and more features. Using functions is where users start to think of themselves as advanced users and get on with serious work. How this fact reflects to your professional ambitions?
If you allow yourself to get scared by the function declaration, you are probably not professional Flash Web developer material. There is a moment when your experience pushes you for more complex solutions and when you become aware that your current knowledge is not enough to accomplish it. You may achieve great things with just basic Flash statements, but when you want to upgrade or maintain your code you will eventually find out that you are not familiar with that mess any more and that you are creating more and more bugs. This is the breaking point. If you decide to rewrite the code in a more professional manner -- considering good coding practice -- you are probably on the right path to become advanced Actionscript programmer. Yes, the first option to consider is using functions to simplify, centralize and modularize your code. After that, your learning curve will increase rapidly.
Next: More on reusability: practical example >>
More Flash Articles
More By Aleksandar Horvat