OOP or Not OOP

There are at least two different approaches to programming in ActionScript 1.0: object-oriented programming and procedural programming. Both have their strengths and weaknesses. You could add a third group of programmers as well: those who program procedurally and use OOP concepts in their applications. This section will show some ways of doing things with Flash Remoting using these approaches.

Procedural Programming

Procedural programming, also known as top-down programming, uses techniques that have been around since the beginning of computer programming. With procedural programming, you write code from beginning to end and call functions when they’re needed. Assembly language is an example of procedural programming. There is nothing inherently wrong with procedural programming, yet it has fallen out of favor with the advent of OOP.

Task-oriented

Procedural programming focuses on the tasks. Using an example of the Products database from the earlier chapters, a procedural program asks the question “what has to be done?” and then proceeds to do it. For example, the code might follow like this (in pseudocode):

1. Initialize movie
2. Call remote methods to populate UI
3. Display results
4. Wait for user input
5. If "add" is clicked, show the addProduct screen
6. If "search" is clicked, call the remote method searchProducts( )

Each section of the program (addProduct, searchProducts( ), etc.) would contain more code that executes sequentially, with conditional logic to ...

Get Flash Remoting: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.