SlideShare a Scribd company logo
1 of 53
Download to read offline
Hands-On Flash Platform
                             Development using




Thursday, April 29, 2010
About Me
         •      Steven Diomampo, 24

         •      Sr. Multimedia Developer @ JWT

         •      Flash Platform Enthusiast

         •      First community presentation

         •      Twitter: @diomampo

         •      Blog: www.Steven.Diomampo.com


Thursday, April 29, 2010
Before We Start

                   •       Any word in bold italics should be in the provided
                           handout under Keywords & Definitions

                   •       Don’t worry about reading the code snippets
                           contained in the slides, I will jump to the IDE for a
                           detailed view of it.

                   •       After each section I will pause for any questions, but
                           feel free to chime in at anytime.



Thursday, April 29, 2010
Agenda
                   •       Overview of Frameworks & MVC

                   •       Introduction to PureMVC
                           •   The Facade

                           •   Notifications

                           •   Model, Proxies & VO’s

                           •   View, Mediators & UI

                           •   Controller & Commands

                   •       Helpful Tips

                   •       Writing our first application

Thursday, April 29, 2010
Assumptions

                      • Basic OOP experience, preferably using
                           ActionScript 3
                      • Basic knowledge or want to learn about
                           Frameworks

                      • Basic knowledge or want to learn about
                           MVC



Thursday, April 29, 2010
Overview of Frameworks
                                  and MVC




Thursday, April 29, 2010
Framework Examples

          Cairngorm



                                         FlexUnit




Thursday, April 29, 2010
MVC-based Frameworks

          Cairngorm




Thursday, April 29, 2010
MVC is not a Framework

                      • MVC is an architecture (in Flash it is
                           considered a micro-architecture)
                      • A Framework is a general foundation for
                           which you can easily extend.
                      • Although many Frameworks are based
                           on MVC, Frameworks are not MVC



Thursday, April 29, 2010
General Benefits
                      •    Proven solutions

                      •    Speeds up development

                      •    Helps with collaborative code

                      •    Formalized approach to something

                      •    Community driven knowledge base




Thursday, April 29, 2010
MVC Frameworks are not the
                      answer to everything!!!

                   •       Additional overhead

                   •       Might be overkill for a small project, but the
                           principles of separation can still be applied

                   •       Your code does not magically become clean by using
                           a Framework




Thursday, April 29, 2010
Checklist

                      • What is the shelf life of the project?
                      • Will I ever make updates to it? (Feature
                           requests, bug fixes, etc.)
                      • Will anyone else ever work on this?
                      • Do I like to write documentation?

Thursday, April 29, 2010
Questions?



Thursday, April 29, 2010
Real world projects



Thursday, April 29, 2010
Concept     Build Application




          Requirements        Mockup




Thursday, April 29, 2010
Concept             Build Application


                   1       4




          Requirements                Mockup



                   2
                               3




Thursday, April 29, 2010
Concept     Build Application




          Requirements        Mockup




Thursday, April 29, 2010
Concept                 Build Application
                                    UE SBU
                                        T
       ER            F IX        EQ        G
C HA NG
         BU      UE ST
            G FQ
            RE
       ANGE    IX
    CH
                                              UE
                                          Mockup ST
          B
          Requirements
                   UG                   ER EQ
                           FIX   C HA NG


Thursday, April 29, 2010
Common Approaches



Thursday, April 29, 2010
The Spaghetti Approach




Thursday, April 29, 2010
Show the code...



Thursday, April 29, 2010
What’s wrong with that?
                      •    Does not adhere to the Single Responsibility
                           Principle

                      •    Code reusability is little to none

                      •    The code can become unmanageable




Thursday, April 29, 2010
The Roll Your Own Approach




Thursday, April 29, 2010
What’s wrong with that?


                      • Don’t reinvent the wheel
                      • Ongoing support is limited
                      • Heavier workload (Documentation and
                           Testing)
                      • But doesn’t it offer job security???

Thursday, April 29, 2010
An Alternative Approach...




Thursday, April 29, 2010
About

                      •    Created by Cliff Hall

                      •    Open source (Creative Commons 3.0 Attribution
                           US License)

                      •    Language agnostic (support for over 10
                           programming languages)

                      •    Two Versions Standard and MultiCore




Thursday, April 29, 2010
Goals

                      • The PureMVC framework has a very
                           narrow main goal: to help you separate
                           your application’s coding concerns into
                           three discrete tiers; Model,View and
                           Controller.




Thursday, April 29, 2010
Why I use it?

                      •    It’s free

                      •    Excellent documentation

                      •    Widely accepted and adopted

                      •    Team collaboration

                      •    Learning curve for a new language is reduced




Thursday, April 29, 2010
Thursday, April 29, 2010
Framework Actors




Thursday, April 29, 2010
Core Actors and the Facade




Thursday, April 29, 2010
Core Actors and the Facade




Thursday, April 29, 2010
The Developer’s Responsibility




Thursday, April 29, 2010
Reusability


                           • View Components and Value
                             Objects should not contain
                             any references to the
                             Framework.

                           • This offers the ability to reuse
                             these objects in other
                             projects.




Thursday, April 29, 2010
Communication
            •      Use Notifications to communicate among Actors (Publish/
                   Subscribe)

            •      Dispatch Events from a View Component

            •      Mediators send/recieve Notifications, and listen for Events to
                   be dispatch from a View Component

            •      Proxies send BUT CANNOT receive Notifications

            •      Commands send/receive Notifications




                           To publish a Notification, you will do this:
            sendNotification(notificationName:String, body:Object=null, type:String=null);




Thursday, April 29, 2010
Questions?



Thursday, April 29, 2010
Let’s get started...



Thursday, April 29, 2010
The Facade
     Overview                                                                Package Structure
           •       Singleton representative for the Model,View, and
                   Controller

           •       Gatekeeper to PureMVC that initializes the Framework

           •       Offers methods for registering, retrieving and removing
                   Actors

           •       Accessible by all Framework Actors
    Usage
         •       Create a single subclass of Facade, usually named ApplicationFacade.as which extends Facade and implements IFacade

         •       Create a getInstance() method to use this class as a Singleton

         •       Define your Notification names as static constants

         •       Override the initializeController() method and register your Commands

         •       Create a startup() method




Thursday, April 29, 2010
Show the code...



Thursday, April 29, 2010
Questions?



Thursday, April 29, 2010
Overview
                                                               Model Tier
           •         Model

                 •         Singleton that holds references to Proxies.

                 •         You will never interact directly with this

           •         Proxies

                 •         Data storage, retrieval and manipulation.

                 •         Exposes an API for other Actors to use.

                 •         Can send Notifications, but cannot receive

           •         Value Object

                 •         Dumb object that holds simple properties


     Package Structure


                                                                    Usage
                                                                        •   Create subclasses of Proxy (extend Proxy and implement IProxy)
                                                                            [Note: Do not extend flash.utils.Proxy]

                                                                        •   Create your own VO’s to be used throughout the application

                                                                        •   Register your Proxies using the registerProxy() method in the
                                                                            ApplicationFacade

                                                                        •   Set or load the data (VO’s, Array, etc.) for the Proxy
Thursday, April 29, 2010
Show the code...



Thursday, April 29, 2010
Questions?



Thursday, April 29, 2010
View Tier
                                                                      Overview
                                                                          •        View

                                                                               •      Singleton that holds references to Mediators

                                                                               •      You will never interact directly with this

                                                                          •        Mediators

                                                                               •      Send and receive Notifications

                                                                               •      Holds a reference to a Component which allows listeners to be
                                                                                      added, and methods to be called

                                                                          •        Components

                                                                               •      Should remain outside the scope of the Framework

                                                                               •      Provide a well-defined API for a Mediator to act upon


                                                                                                       Package Structure


                                                 Usage
 •        Create subclasses of Mediator (extend Mediator and implement IMediator)

 •        Pass in a reference to the Component you would like to Mediate and addEventListeners to
          it

 •        Override listNotificationInterests() to define which Notifications your Mediator will
          receive.

 •        Override handleNotification() to perform actions based on each Notification
Thursday, April 29, 2010
Show the code...



Thursday, April 29, 2010
Questions?



Thursday, April 29, 2010
Controller Tier
    Overview                                                                              Package Structure
     •        Controller

          •       Singleton that holds references to
                  Commands via Notification names.

          •       You will never interact directly
                  with this

     •        Commands

          •       Stateless classes to be triggered by
                  a Notification

          •       Handle business logic or complex
                  system actions

   Usage
      •       Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

      •       Override execute() within your Commands to perform logic, such as bootstrapping or manipulating a Proxy

      •       Register your Commands using the registerCommand() method within the Facade

      •       Trigger your Commands via a Notification



Thursday, April 29, 2010
Show the code...



Thursday, April 29, 2010
Questions?



Thursday, April 29, 2010
Quick Tips

                   • Generic object implementation, meaning lots
                           of type casting
                   • Does not rely on the native Flash event
                           system (ie: Notifications)
                   • Expect a bit of boilerplate code

Thursday, April 29, 2010
Now What???

                   • SimpleCommand VS. MacroCommand
                   • Modules
                   • Design Patterns
                   • Dynamic Mediators and Deferred
                           Instantiation



Thursday, April 29, 2010
Mahalo!



Thursday, April 29, 2010
Resources
                      •    http://www.puremvc.org

                      •    http://www.adobe.com/newsletters/edge/december2008/articles/article6/
                           index.html?trackingid=EFBLD

                      •    http://www.slideshare.net/jwilker/samuel-asher-rivello-puremvc-hands-on-
                           part-1

                      •    http://www.asserttrue.com/articles/2007/10/17/silvafug-application-
                           frameworks-presentation

                      •    http://www.codeproject.com/KB/architecture/WhatIsAFramework.aspx




Thursday, April 29, 2010

More Related Content

Similar to Hands on puremvc

4-15-2010 Intro to Social Media and Web 2.0 Tools Through Faculty Practices
4-15-2010 Intro to Social Media and Web 2.0 Tools Through Faculty Practices4-15-2010 Intro to Social Media and Web 2.0 Tools Through Faculty Practices
4-15-2010 Intro to Social Media and Web 2.0 Tools Through Faculty PracticesMathieu Plourde
 
Open Source and Open Standards for Information and Records Managers
Open Source and Open Standards for Information and Records ManagersOpen Source and Open Standards for Information and Records Managers
Open Source and Open Standards for Information and Records ManagersCheryl McKinnon
 
Mobile & Tablet UX | NYU School of Professional Studies | Week 1 (Intro)
Mobile & Tablet UX | NYU School of Professional Studies | Week 1 (Intro)Mobile & Tablet UX | NYU School of Professional Studies | Week 1 (Intro)
Mobile & Tablet UX | NYU School of Professional Studies | Week 1 (Intro)Liz Filardi
 
Practical machine learning - Part 1
Practical machine learning - Part 1Practical machine learning - Part 1
Practical machine learning - Part 1Traian Rebedea
 
Evaluation beyond the desktop
Evaluation beyond the desktopEvaluation beyond the desktop
Evaluation beyond the desktopThomas Grill
 
06 View Controllers
06 View Controllers06 View Controllers
06 View ControllersMahmoud
 
Impact Well-Beyond Market Share: Synergy Between Open Source and Standards
Impact Well-Beyond Market Share: Synergy Between Open Source and StandardsImpact Well-Beyond Market Share: Synergy Between Open Source and Standards
Impact Well-Beyond Market Share: Synergy Between Open Source and StandardsCharles Severance
 
Introduction to online social networks #UOSM2012
Introduction to online social networks #UOSM2012Introduction to online social networks #UOSM2012
Introduction to online social networks #UOSM2012Lisa Harris
 
Experiences with openEyA-Lecture Capture System (Pros and Cons)
Experiences with openEyA-Lecture Capture System (Pros and Cons)Experiences with openEyA-Lecture Capture System (Pros and Cons)
Experiences with openEyA-Lecture Capture System (Pros and Cons)Sara Valla
 
Course Possibilities & Architecture
Course Possibilities & ArchitectureCourse Possibilities & Architecture
Course Possibilities & ArchitectureFolajimi Fakoya
 
OSGi Alliance and its Technology - Where Are We Now, and What is Your Vision ...
OSGi Alliance and its Technology - Where Are We Now, and What is Your Vision ...OSGi Alliance and its Technology - Where Are We Now, and What is Your Vision ...
OSGi Alliance and its Technology - Where Are We Now, and What is Your Vision ...mfrancis
 
Tutville Final Presentation
Tutville Final PresentationTutville Final Presentation
Tutville Final PresentationKatie McCurdy
 
Multi Handset Development - ETE 2010
Multi Handset Development - ETE 2010Multi Handset Development - ETE 2010
Multi Handset Development - ETE 2010Kevin Griffin
 
Prototyping - the what, why and how at the University of Edinburgh
Prototyping - the what, why and how at the University of EdinburghPrototyping - the what, why and how at the University of Edinburgh
Prototyping - the what, why and how at the University of EdinburghNeil Allison
 
Plone Testing Tools And Techniques
Plone Testing Tools And TechniquesPlone Testing Tools And Techniques
Plone Testing Tools And TechniquesJordan Baker
 
Winter TELFest - MyEcho: Lecture Capture & Beyond - Pete Mella & James Slack
Winter TELFest - MyEcho: Lecture Capture & Beyond - Pete Mella & James SlackWinter TELFest - MyEcho: Lecture Capture & Beyond - Pete Mella & James Slack
Winter TELFest - MyEcho: Lecture Capture & Beyond - Pete Mella & James Slacktelshef
 
Educuase: New Opportunities for Teaching and Learning: Extending Learning Man...
Educuase: New Opportunities for Teaching and Learning: Extending Learning Man...Educuase: New Opportunities for Teaching and Learning: Extending Learning Man...
Educuase: New Opportunities for Teaching and Learning: Extending Learning Man...Charles Severance
 

Similar to Hands on puremvc (20)

4-15-2010 Intro to Social Media and Web 2.0 Tools Through Faculty Practices
4-15-2010 Intro to Social Media and Web 2.0 Tools Through Faculty Practices4-15-2010 Intro to Social Media and Web 2.0 Tools Through Faculty Practices
4-15-2010 Intro to Social Media and Web 2.0 Tools Through Faculty Practices
 
Open Source and Open Standards for Information and Records Managers
Open Source and Open Standards for Information and Records ManagersOpen Source and Open Standards for Information and Records Managers
Open Source and Open Standards for Information and Records Managers
 
Mobile & Tablet UX | NYU School of Professional Studies | Week 1 (Intro)
Mobile & Tablet UX | NYU School of Professional Studies | Week 1 (Intro)Mobile & Tablet UX | NYU School of Professional Studies | Week 1 (Intro)
Mobile & Tablet UX | NYU School of Professional Studies | Week 1 (Intro)
 
Practical machine learning - Part 1
Practical machine learning - Part 1Practical machine learning - Part 1
Practical machine learning - Part 1
 
Evaluation beyond the desktop
Evaluation beyond the desktopEvaluation beyond the desktop
Evaluation beyond the desktop
 
06 View Controllers
06 View Controllers06 View Controllers
06 View Controllers
 
Impact Well-Beyond Market Share: Synergy Between Open Source and Standards
Impact Well-Beyond Market Share: Synergy Between Open Source and StandardsImpact Well-Beyond Market Share: Synergy Between Open Source and Standards
Impact Well-Beyond Market Share: Synergy Between Open Source and Standards
 
Introduction to online social networks #UOSM2012
Introduction to online social networks #UOSM2012Introduction to online social networks #UOSM2012
Introduction to online social networks #UOSM2012
 
Experiences with openEyA-Lecture Capture System (Pros and Cons)
Experiences with openEyA-Lecture Capture System (Pros and Cons)Experiences with openEyA-Lecture Capture System (Pros and Cons)
Experiences with openEyA-Lecture Capture System (Pros and Cons)
 
Template for ru11 pdf
Template for ru11 pdfTemplate for ru11 pdf
Template for ru11 pdf
 
Template for ru11 pdf
Template for ru11 pdfTemplate for ru11 pdf
Template for ru11 pdf
 
Course Possibilities & Architecture
Course Possibilities & ArchitectureCourse Possibilities & Architecture
Course Possibilities & Architecture
 
OSGi Alliance and its Technology - Where Are We Now, and What is Your Vision ...
OSGi Alliance and its Technology - Where Are We Now, and What is Your Vision ...OSGi Alliance and its Technology - Where Are We Now, and What is Your Vision ...
OSGi Alliance and its Technology - Where Are We Now, and What is Your Vision ...
 
Tutville Final Presentation
Tutville Final PresentationTutville Final Presentation
Tutville Final Presentation
 
Multi Handset Development - ETE 2010
Multi Handset Development - ETE 2010Multi Handset Development - ETE 2010
Multi Handset Development - ETE 2010
 
Prototyping - the what, why and how at the University of Edinburgh
Prototyping - the what, why and how at the University of EdinburghPrototyping - the what, why and how at the University of Edinburgh
Prototyping - the what, why and how at the University of Edinburgh
 
Oc Cloud Obscurity
Oc Cloud ObscurityOc Cloud Obscurity
Oc Cloud Obscurity
 
Plone Testing Tools And Techniques
Plone Testing Tools And TechniquesPlone Testing Tools And Techniques
Plone Testing Tools And Techniques
 
Winter TELFest - MyEcho: Lecture Capture & Beyond - Pete Mella & James Slack
Winter TELFest - MyEcho: Lecture Capture & Beyond - Pete Mella & James SlackWinter TELFest - MyEcho: Lecture Capture & Beyond - Pete Mella & James Slack
Winter TELFest - MyEcho: Lecture Capture & Beyond - Pete Mella & James Slack
 
Educuase: New Opportunities for Teaching and Learning: Extending Learning Man...
Educuase: New Opportunities for Teaching and Learning: Extending Learning Man...Educuase: New Opportunities for Teaching and Learning: Extending Learning Man...
Educuase: New Opportunities for Teaching and Learning: Extending Learning Man...
 

Recently uploaded

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 

Recently uploaded (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 

Hands on puremvc

  • 1. Hands-On Flash Platform Development using Thursday, April 29, 2010
  • 2. About Me • Steven Diomampo, 24 • Sr. Multimedia Developer @ JWT • Flash Platform Enthusiast • First community presentation • Twitter: @diomampo • Blog: www.Steven.Diomampo.com Thursday, April 29, 2010
  • 3. Before We Start • Any word in bold italics should be in the provided handout under Keywords & Definitions • Don’t worry about reading the code snippets contained in the slides, I will jump to the IDE for a detailed view of it. • After each section I will pause for any questions, but feel free to chime in at anytime. Thursday, April 29, 2010
  • 4. Agenda • Overview of Frameworks & MVC • Introduction to PureMVC • The Facade • Notifications • Model, Proxies & VO’s • View, Mediators & UI • Controller & Commands • Helpful Tips • Writing our first application Thursday, April 29, 2010
  • 5. Assumptions • Basic OOP experience, preferably using ActionScript 3 • Basic knowledge or want to learn about Frameworks • Basic knowledge or want to learn about MVC Thursday, April 29, 2010
  • 6. Overview of Frameworks and MVC Thursday, April 29, 2010
  • 7. Framework Examples Cairngorm FlexUnit Thursday, April 29, 2010
  • 8. MVC-based Frameworks Cairngorm Thursday, April 29, 2010
  • 9. MVC is not a Framework • MVC is an architecture (in Flash it is considered a micro-architecture) • A Framework is a general foundation for which you can easily extend. • Although many Frameworks are based on MVC, Frameworks are not MVC Thursday, April 29, 2010
  • 10. General Benefits • Proven solutions • Speeds up development • Helps with collaborative code • Formalized approach to something • Community driven knowledge base Thursday, April 29, 2010
  • 11. MVC Frameworks are not the answer to everything!!! • Additional overhead • Might be overkill for a small project, but the principles of separation can still be applied • Your code does not magically become clean by using a Framework Thursday, April 29, 2010
  • 12. Checklist • What is the shelf life of the project? • Will I ever make updates to it? (Feature requests, bug fixes, etc.) • Will anyone else ever work on this? • Do I like to write documentation? Thursday, April 29, 2010
  • 15. Concept Build Application Requirements Mockup Thursday, April 29, 2010
  • 16. Concept Build Application 1 4 Requirements Mockup 2 3 Thursday, April 29, 2010
  • 17. Concept Build Application Requirements Mockup Thursday, April 29, 2010
  • 18. Concept Build Application UE SBU T ER F IX EQ G C HA NG BU UE ST G FQ RE ANGE IX CH UE Mockup ST B Requirements UG ER EQ FIX C HA NG Thursday, April 29, 2010
  • 21. Show the code... Thursday, April 29, 2010
  • 22. What’s wrong with that? • Does not adhere to the Single Responsibility Principle • Code reusability is little to none • The code can become unmanageable Thursday, April 29, 2010
  • 23. The Roll Your Own Approach Thursday, April 29, 2010
  • 24. What’s wrong with that? • Don’t reinvent the wheel • Ongoing support is limited • Heavier workload (Documentation and Testing) • But doesn’t it offer job security??? Thursday, April 29, 2010
  • 26. About • Created by Cliff Hall • Open source (Creative Commons 3.0 Attribution US License) • Language agnostic (support for over 10 programming languages) • Two Versions Standard and MultiCore Thursday, April 29, 2010
  • 27. Goals • The PureMVC framework has a very narrow main goal: to help you separate your application’s coding concerns into three discrete tiers; Model,View and Controller. Thursday, April 29, 2010
  • 28. Why I use it? • It’s free • Excellent documentation • Widely accepted and adopted • Team collaboration • Learning curve for a new language is reduced Thursday, April 29, 2010
  • 31. Core Actors and the Facade Thursday, April 29, 2010
  • 32. Core Actors and the Facade Thursday, April 29, 2010
  • 34. Reusability • View Components and Value Objects should not contain any references to the Framework. • This offers the ability to reuse these objects in other projects. Thursday, April 29, 2010
  • 35. Communication • Use Notifications to communicate among Actors (Publish/ Subscribe) • Dispatch Events from a View Component • Mediators send/recieve Notifications, and listen for Events to be dispatch from a View Component • Proxies send BUT CANNOT receive Notifications • Commands send/receive Notifications To publish a Notification, you will do this: sendNotification(notificationName:String, body:Object=null, type:String=null); Thursday, April 29, 2010
  • 38. The Facade Overview Package Structure • Singleton representative for the Model,View, and Controller • Gatekeeper to PureMVC that initializes the Framework • Offers methods for registering, retrieving and removing Actors • Accessible by all Framework Actors Usage • Create a single subclass of Facade, usually named ApplicationFacade.as which extends Facade and implements IFacade • Create a getInstance() method to use this class as a Singleton • Define your Notification names as static constants • Override the initializeController() method and register your Commands • Create a startup() method Thursday, April 29, 2010
  • 39. Show the code... Thursday, April 29, 2010
  • 41. Overview Model Tier • Model • Singleton that holds references to Proxies. • You will never interact directly with this • Proxies • Data storage, retrieval and manipulation. • Exposes an API for other Actors to use. • Can send Notifications, but cannot receive • Value Object • Dumb object that holds simple properties Package Structure Usage • Create subclasses of Proxy (extend Proxy and implement IProxy) [Note: Do not extend flash.utils.Proxy] • Create your own VO’s to be used throughout the application • Register your Proxies using the registerProxy() method in the ApplicationFacade • Set or load the data (VO’s, Array, etc.) for the Proxy Thursday, April 29, 2010
  • 42. Show the code... Thursday, April 29, 2010
  • 44. View Tier Overview • View • Singleton that holds references to Mediators • You will never interact directly with this • Mediators • Send and receive Notifications • Holds a reference to a Component which allows listeners to be added, and methods to be called • Components • Should remain outside the scope of the Framework • Provide a well-defined API for a Mediator to act upon Package Structure Usage • Create subclasses of Mediator (extend Mediator and implement IMediator) • Pass in a reference to the Component you would like to Mediate and addEventListeners to it • Override listNotificationInterests() to define which Notifications your Mediator will receive. • Override handleNotification() to perform actions based on each Notification Thursday, April 29, 2010
  • 45. Show the code... Thursday, April 29, 2010
  • 47. Controller Tier Overview Package Structure • Controller • Singleton that holds references to Commands via Notification names. • You will never interact directly with this • Commands • Stateless classes to be triggered by a Notification • Handle business logic or complex system actions Usage • Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand) • Override execute() within your Commands to perform logic, such as bootstrapping or manipulating a Proxy • Register your Commands using the registerCommand() method within the Facade • Trigger your Commands via a Notification Thursday, April 29, 2010
  • 48. Show the code... Thursday, April 29, 2010
  • 50. Quick Tips • Generic object implementation, meaning lots of type casting • Does not rely on the native Flash event system (ie: Notifications) • Expect a bit of boilerplate code Thursday, April 29, 2010
  • 51. Now What??? • SimpleCommand VS. MacroCommand • Modules • Design Patterns • Dynamic Mediators and Deferred Instantiation Thursday, April 29, 2010
  • 53. Resources • http://www.puremvc.org • http://www.adobe.com/newsletters/edge/december2008/articles/article6/ index.html?trackingid=EFBLD • http://www.slideshare.net/jwilker/samuel-asher-rivello-puremvc-hands-on- part-1 • http://www.asserttrue.com/articles/2007/10/17/silvafug-application- frameworks-presentation • http://www.codeproject.com/KB/architecture/WhatIsAFramework.aspx Thursday, April 29, 2010