ActionScript 3.0 Design Patterns: Object Oriented Programming Techniques (Paperback)

William Sanders, Chandima Cumaranatunge

  • 出版商: O'Reilly
  • 出版日期: 2007-08-07
  • 定價: $1,480
  • 售價: 5.0$740
  • 語言: 英文
  • 頁數: 530
  • 裝訂: Paperback
  • ISBN: 0596528469
  • ISBN-13: 9780596528461
  • 相關分類: ActionScript & FLASHDesign Pattern
  • 立即出貨 (庫存 < 3)




Now that ActionScript is reengineered from top to bottom as a true object-oriented programming (OOP) language, reusable design patterns are an ideal way to solve common problems in Flash and Flex applications. If you're an experienced Flash or Flex developer ready to tackle sophisticated programming techniques with ActionScript 3.0, this hands-on introduction to design patterns is the book you need.

ActionScript 3.0 Design Patterns takes you step by step through the process, first by explaining how design patterns provide a clear road map for structuring code that actually makes OOP languages easier to learn and use. You then learn about various types of design patterns and construct small abstract examples before trying your hand at building full-fledged working applications outlined in the book. Topics in ActionScript 3.0 Design Patterns include:
  • Key features of ActionScript 3.0 and why it became an OOP language
  • OOP characteristics, such as classes, abstraction, inheritance, and polymorphism
  • The benefits of using design patterns
  • Creational patterns, including Factory and Singleton patterns
  • Structural patterns, including Decorator, Adapter, and Composite patterns
  • Behavioral patterns, including Command, Observer, Strategy, and State patterns
  • Multiple design patterns, including Model-View-Controller and Symmetric Proxy designs
During the course of the book, you'll work with examples of increasing complexity, such as an e-business application with service options that users can select, an interface for selecting a class of products and individual products in each class, an action game application, a video record and playback application, and many more. Whether you're coming to Flash and Flex from Java or C++, or have experience with ActionScript 2.0, ActionScript 3.0 Design Patterns will have you constructing truly elegant solutions for your Flash and Flex applications in no time.

Table of Contents


Part I. Constant Change

1. Object-Oriented Programming, Design Patterns, and ActionScript 3.0

     The Pleasure of Doing Something Well

     OOP Basics





     Principles of Design Pattern Development

     Program to Interfaces over Implementations

     Favor Composition

     Maintenance and Extensibility Planning

     Your Application Plan: It Ain't You Babe

Part II. Creational Patterns

2. Factory Method Pattern

     What Is the Factory Method Pattern?

     Abstract Classes in ActionScript 3.0

     Minimalist Example

     Hiding the Product Classes

     Example: Print Shop

     Extended Example: Color Printing

     Key OOP Concepts Used in the Factory Method Pattern

     Example: Sprite Factory

     Example: Vertical Shooter Game


3. Singleton Pattern

     What Is the Singleton Pattern?

     Key OOP Concepts Used with the Singleton Pattern

     Minimalist Abstract Singleton

     When to Use the Singleton Pattern


Part III. Structural Patterns

4. Decorator Pattern

     What Is the Decorator Pattern?

     Key OOP Concepts Used with the Decorator Pattern

     Minimalist Abstract Decorator

     Applying a Simple Decorator Pattern in Flash: Paper Doll

     Decorating with Deadly Sins and Heavenly Virtues

     Dynamic Selection of Concrete Components and Decorations: A Hybrid Car Dealership


5. Adapter Pattern

     What Is the Adapter Pattern?

     Object and Class Adapters

     Key OOP Concepts in the Adapter Pattern

     Example: Car Steering Adapter

     Extended Example: Steering the Car Using a Mouse

     Example: List Display Adapter

     Extended Example: Displaying the O'Reilly New Books List


6. Composite Pattern

     What Is the Composite Pattern?

     Minimalist Example of a Composite Pattern

     Key OOP Concepts in the Composite Pattern

     Example: Music Playlists

     Example: Animating Composite Objects Using Inverse Kinematics

     Using Flash's Built-in Composite Structure: the Display List


Part IV. Behavioral Patterns

7. Command Pattern

     What Is the Command Pattern?

     Minimalist Example of a Command Pattern

     Key OOP Concepts in the Command Pattern

     Minimalist Example: Macro Commands

     Example: Number Manipulator

     Extended Example: Sharing Command Objects

     Extended Example: Implementing Undo

     Example: Podcast Radio

     Extended Example: Dynamic Command Object Assignment


8. Observer Pattern

     What Is the Observer Pattern?

     Key OOP Concepts Used with the Observer Pattern

     Minimalist Abstract Observer

     Example: Adding States and Identifying Users

     Dynamically Changing States

     Example: Working with Different Data Displays


9. Template Method Pattern

     What Is the Template Method Pattern?

     Key OOP Concepts Used with the Template Method

     Minimalist Example: Abstract Template Method

     Employing Flexibility in the Template Method

     Selecting and Playing Sound and Video

     Hooking It Up


10. State Pattern

     Design Pattern to Create a State Machine

     Key OOP Concepts Used with the State Pattern

     Minimalist Abstract State Pattern

     Video Player Concrete State Application

     Expanding the State Design: Adding States

     Adding More States and Streaming Capabilities


11. Strategy Pattern

     What Is the Strategy Pattern?

     Key OOP Concepts Used with the Strategy Pattern

     Minimalist Abstract State Pattern

     Adding More Concrete Strategies and Concrete Contexts

     Working with String Strategies


Part V. Multiple Patterns

12. Model-View-Controller Pattern

     What Is the Model-View-Controller (MVC) Pattern?

     Communication Between the MVC Elements

     Embedded Patterns in the MVC

     Minimalist Example of an MVC Pattern

     Key OOP Concepts in the MVC Pattern

     Example: Weather Maps

     Extended Example: Infrared Weather Maps

     Example: Cars

     Custom Views

     Adding a Chase Car


13. Symmetric Proxy Pattern

     Simultaneous Game Moves and Outcomes

     The Symmetric Proxy Pattern

     Key OOP Concepts Used with the Symmetric Proxy

     The Player Interface

     The Referee

     Information Shared Over the Internet

     Player-Proxy Classes

     Classes and Document Files Support





ActionScript 3.0 Design Patterns 是一本針對Flash和Flex應用程式的設計模式的實踐導引。現在,ActionScript已經從頂層到底層重新設計為真正的物件導向編程(OOP)語言,可重複使用的設計模式是解決Flash和Flex應用程式中常見問題的理想方法。如果你是一位有經驗的Flash或Flex開發人員,準備使用ActionScript 3.0來解決複雜的編程技巧,這本實踐導引就是你需要的書籍。

ActionScript 3.0 Design Patterns 逐步引導你了解設計模式的過程,首先解釋設計模式如何提供清晰的代碼結構路線圖,使OOP語言更容易學習和使用。然後,你將學習各種類型的設計模式,並構建小型抽象示例,然後嘗試根據書中概述的完整應用程式來構建完整的工作應用程式。ActionScript 3.0 Design Patterns 的主題包括:

- ActionScript 3.0的主要特點以及它成為OOP語言的原因
- 類、抽象、繼承和多態等OOP特性
- 使用設計模式的好處
- 創建型模式,包括工廠和單例模式
- 結構型模式,包括裝飾器、適配器和組合模式
- 行為型模式,包括命令、觀察者、策略和狀態模式
- 多種設計模式,包括模型-視圖-控制器和對稱代理設計

在本書的過程中,你將使用越來越複雜的示例,例如一個具有用戶可以選擇的服務選項的電子商務應用程式,一個用於選擇產品類別和每個類別中的個別產品的界面,一個動作遊戲應用程式,一個視頻錄製和播放應用程式等等。無論你是從Java或C++轉到Flash和Flex,還是有ActionScript 2.0的經驗,ActionScript 3.0 Design Patterns 將幫助你在短時間內為你的Flash和Flex應用程式構建出真正優雅的解決方案。


- 前言
- 第一部分. 不斷變化
- 1. 面向對象編程、設計模式和ActionScript 3.0

- 第二部分. 創建型模式
- 2. 工廠方法模式