Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Procedural Versus Object-Oriented Programming Procedural Versus Object-Oriented Programming Much discussion has been made over the pros and cons of procedural and object-oriented programming, and many who are new to ActionScript 3.0 have been led to believe that using OOP is the only way to program in ActionScript 3.0. This is not the case. Object-oriented programming is very powerful, and you’ll probably want to use it when you’re more comfortable with the language. However, it’s just one possible way to write ActionScript. We’ll introduce OOP slowly throughout the book, and we’ll try to encourage you to learn OOP by presenting some exercises that. | Procedural Versus Object-Oriented Programming Procedural Versus Object-Oriented Programming Much discussion has been made over the pros and cons of procedural and object-oriented programming and many who are new to ActionScript 3.0 have been led to believe that using OOP is the only way to program in ActionScript 3.0. This is not the case. Object-oriented programming is very powerful and you ll probably want to use it when you re more comfortable with the language. However it s just one possible way to write ActionScript. We ll introduce OOP slowly throughout the book and we ll try to encourage you to learn OOP by presenting some exercises that use its methodologies. We d like to reassure you however that OOP isn t required to program the Flash Platform or to use this book. To put this into an ActionScript perspective consider a little background on the language s evolution. ActionScript started as a sequential programming language meaning that scripting was limited to a linear sequence of instructions telling Flash what to do in a step-by-step manner. This approach to scripting was not very flexible and did not promote reuse. As the language evolved it became a procedural programming language. Like sequential programming procedural programming relied on a step-by-step set of instructions but introduced a more structured modular approach to scripting. Procedures otherwise known as functions or sometimes subroutines could be executed again and again as needed from different parts of a project without copying and pasting copies of the code into the ongoing sequence of instructions. This modularity promoted reuse and made the code easier to edit and more efficient. Scripters in search of an even greater degree of modularity and reuse gravitated toward object-oriented programming. OOP languages create programs that are a collection of objects. Objects are individual instances of classes collections of code that are self-contained and do not materially alter or disrupt