Preface
Code at the Speed of Thought
Too often in the development of a large application, the developer must stop and think about where to find some class he needs, where some new class should go, and how to wire them up in such a way that gets data from wherever it lives to a display so the user can interact with it or vice-versa.
Regardless of the high level complexities in your application, you will never truly be doing anything more involved at the lower levels than moving data from point A to point B and occasionally doing some calculations on it. You should not have to keep inventing ways to do it; instead, your energy should be focused on the requirements of your current use case.
PureMVC is a simple framework that helps reduce the amount of time spent thinking about these low level issues by providing solutions for organizing your code and an expression of the well known Model-View-Controller concept based on several time proven design patterns.
Not only can it help a lone developer get her work done faster, but a team that is all on the same page about where things go and how they talk to each other within the application can move fluidly as they implement use cases in parallel. This is actually possible without creating the spaghetti code that often occurs during the heat of development. And since PureMVC is a mature, feature-frozen framework, legacy code written this way becomes much easier to maintain since the organization and implementation principles remain as valid as when the code was originally written.
The Purpose of This Book
As the author of the framework, I have had the good fortune to remain engaged more or less constantly from the time it came out, applying it to one challenging project after another. I have also had the pleasure of talking with a great many other developers around the world who have shared gems of wisdom or worked through their problems with me. I want to try and convey the most important bits, of course, but in a holistic manner and within the context of a non-trivial application.
There is a wealth of discussion about the details of development on the PureMVC website as well as documentation, demos, and utilities. There are plenty of community blog posts about building small demo apps, but up until now, nothing has taken a developer through the process of building a non-trivial PureMVC application, giving a sense of how all the pieces need to fit together and in what order to approach building them. From rough conceptualization of an application to the finished product and all the steps in between, you will gain the insight to know which responsibilities need to be handled by framework actors and, just as importantly, which do not.
Note
Engineering an application that exposes every problem you might
run into is impossible, but still we will touch on all the moving parts
of the framework. The code for the application (StoryArchitect
) we will begin building in the
book is packaged within com.futurescale.sa
package. Where it is
necessary to demonstrate something in code that is not present in the
application that is the focus of the book, the text preceding the code
will set forth a hypothetical situation, and the example code will be
packaged within com.mycompany.myapp
package.
Who Should Read This Book
ActionScript developers who are interested in, or are already working with, PureMVC will gain usable insights, although Adobe Flex and AIR developers will be best served, as the example application is written with AIR.
You should already have some experience with Adobe’s ActionScript, Flex, and AIR, Object Oriented Programming (classes, interfaces, inheritance), and your IDE of choice. To fully understand the Value Objects and View Components of the application we will build, you should know at least a little about ActionScript’s implicit accessors (getters/setters), XML handling, Flash’s event bubbling, and Flex data binding.
Also, while this book speaks directly to an ActionScript/Flex/AIR audience, developers who are using or learning any of the PureMVC ports to other programming languages could certainly use this book as a basis for understanding the framework classes and how they should be used. The Flex and AIR specific sections are when we build View Components, talk to the filesystem or services, and handle XML. But the PureMVC framework roles, responsibilities, and collaborations are universal to all ports, and clarifying them is the real focus of this book. The platform and language are incidental.
Acknowledgements
At O’Reilly, I’d like to thank Dan Fauxsmith, Sarah Hake, Mike Hendrickson, Rachel James, Sarah Kim, Sarah Schneider, Karen Shaner, Mary Treseler, and Melanie Yarbrough, for excelling in their roles and making this book possible. For a developer who has been well-guided by O’Reilly books for years, it is an honor to be published by the best of the best!
PureMVC Contributors
The PureMVC project could never have made it without the community. It would be impossible to list them all here, but I would like to give a heartfelt personal thanks to the following folks who have lent a hand in one way or another:
Ahmed Nuaman, Ali Mills, Andy Adamczak, Andy Bulka, Anthony Quinault, Brendan Lee, Brian Knorr, Bruce Phillips, Chandima Cumaranatunge, Chris Pyle, Dan Pedersen, Daniel Garay, Daniel Swid, Daniele Ugoletti, Dave Keen, David Deraedt, David Foley, David Knape, Denis Sheremetov, Denis Volokh, Dmitry Kochetov, Don Stinchfield, Dragos Dascalita, Duncan Hall, Eric La Rocca, Frederic Saunier, Frederic Sullet, Gary Paluk, Greg Jastrab, Hasan Otuome, Jake Dempsey, James Knight, Jari Kemppinen, Jason MacDonald, Javier Julio, Jens Krause, Jhonghee Park, Jim Bachalo, Jim Robson, Jody Hall, Joshua Gottdenker, Justin Wilaby, Luke Bayes, Marcel Overdijk, Marco Secchi, Mark Bathie, Mark Geller, Matt Brailsford, Matthieu Mauny, Michael Oddis, Michael Ramirez, Milos Zikic, Nate Rock, Nathan Levesque, Neil Manuell, Nick Collins, Nicola Bortignon, Omar Gonzalez, Ondina D. F., Paddy Keane, Patrick Lemiuex, Pedr Browne, Philip Sexton, Phuong Tang, Richard Germuska, Roman Pavlenko, Rostislav Siryk, Samuel Asher Rivello, Sasa Tarbuk, Sean Carnell, Simon Bailey, Stefan Richter, Steve Hueners, Thomas Schuessler, Tim Will, Toby de Havilland, Tony DeFusco, Yee Peng Chia, Zhang Ze Yuan, Zhong Xiao Chuan, and Zjnue Brzavi.
Enneagram Personality System
Details of the Enneagram Personality System mentioned briefly in this book are Copyright 2011 The Enneagram Institute, Used With Permission
Conventions Used in This Book
The following typographical conventions are used in this book:
- Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values determined by context.
Tip
This icon signifies a tip, suggestion, or general note.
Caution
This icon indicates a warning or caution.
Using Code Examples
This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “ActionScript Developer’s Guide to PureMVC by Cliff Hall (O’Reilly). Copyright 2012 Futurescale, Inc., 978-1-449-31456-9.”
If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at permissions@oreilly.com.
Safari® Books Online
Note
Safari Books Online is an on-demand digital library that lets you easily search over 7,500 technology and creative reference books and videos to find the answers you need quickly.
With a subscription, you can read any page and watch any video from our library online. Read books on your cell phone and mobile devices. Access new titles before they are available for print, and get exclusive access to manuscripts in development and post feedback for the authors. Copy and paste code samples, organize your favorites, download chapters, bookmark key sections, create notes, print out pages, and benefit from tons of other time-saving features.
O’Reilly Media has uploaded this book to the Safari Books Online service. To have full digital access to this book and others on similar topics from O’Reilly and other publishers, sign up for free at http://my.safaribooksonline.com.
How to Contact Us
Please address comments and questions concerning this book to the publisher:
O’Reilly Media, Inc. |
1005 Gravenstein Highway North |
Sebastopol, CA 95472 |
800-998-9938 (in the United States or Canada) |
707-829-0515 (international or local) |
707-829-0104 (fax) |
We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at:
http://www.oreilly.com/catalog/9781449314569 |
To comment or ask technical questions about this book, send email to:
bookquestions@oreilly.com |
For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Get ActionScript Developer's Guide to PureMVC 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.