SlideShare une entreprise Scribd logo
1  sur  45
Télécharger pour lire hors ligne
by @nsdevaraj
What we'll discuss
       DI/ IoC Introduction
       View Patterns
       What, Why, How
         What is Swiz?
         Why should you use it?
       Advanced Swiz
       Swiz DAO
What the Hell is IoC?
     Inversion of Control, is... design in which the
     flow of control of a system is inverted...
     -Wikipedia




       Separate configuration from
       execution
       Promotes encapsulation
       Promotes simpler, focused
       components
What the Hell is IoC?
  Reusing your code in efficient way.
  Consider CRUD Operations Logic
  or any logic being written once and
  used across your application.
  Coding Logic not being repeated
  will help you in efficient testing.
  Dependency Injection helps you
  [Inject] Objects and get use of
  deferred instantiation.
  Context helps you have a hold on
  whole application.
IoC / Dependency Injection


  The Inversion of Control (IoC) and
  Dependency Injection (DI) patterns are all
  about removing dependencies from your
  code.
  IoC/DI are not technologies, they are
  methods.
  The Hollywood principle "Don't call us, we'll
  call you".
IoC / Dependency Injection

For example:
public class TextEditor
{
  private SpellChecker checker;
  public function TextEditor()
  {
     checker = new SpellChecker();
  }
}


What we've done here is create a dependency
between the TextEditor and the SpellChecker.
IoC / Dependency Injection
In an IoC scenario we would instead do
something like this:
public class TextEditor
{
  private ISpellChecker checker;
  public function TextEditor(ISpellChecker checker)
  {
     this.checker = checker;
  }
}
Now, while creating the TextEditor class you
have the control over which SpellChecker
implementation to use. We're injecting the
TextEditor with the dependency.
View Patterns Hierarchy
MVP Patterns
Passive View                      Supervising Controller




  Both variants allow you to increase the testability of your
  presentation logic.
MVP Patterns

Passive View
MVP Patterns

Supervising Controller
Presentation Model
Why not Traditional MVC?


  You want to maximize the code that can be
  tested with automation. (Views are hard to
  test.)
  You want to share code between pages that
  require the same behavior.
  You want to separate business logic from UI
  logic to make the code easier to understand
  and maintain.
Comparison




         L - UI logic
         S - State of the UI
Why Passive View?

  Presentation Model and Supervising
  Controller are both reasonable alternatives.
  The strength that Passive View is that both
  of the alternatives require the view to do
  some of the synchronization work, which
  results in more untestable behavior.
  In Passive View, all the view update logic is
  placed in the presenter.
How to create Passive View?
 Separate the responsibilities for the visual
 display and the event handling behavior into
 different classes named, respectively,
 the view and the presenter.
 The view class manages the controls on the
 page.
 The presenter contains the logic to respond
 to the events, update the model (business
 logic and data of the application) and, in turn,
 manipulate the state of the view.
Swiz Framework
What Swiz Users are saying..

  “Broadchoice evaluated a few
  frameworks and settled on Swiz as the
  keystone behind our Workspace
  product.”
    Sean Corfield, CTO Railo US
What Swiz Users are saying..

  “Personally I think it is way better then
  Cairngorm!”
    Kurt Wiersma, some Mach-ii dude
Why Swiz?

  Because those guys told you to?
  Not at all!! But Swiz is...
  Simple and effective!
  Easy to learn!
  Designed to help you write less code!
  Encourages loose coupling through
  MVC!
Let's Start..




        What is Swiz all about?
Swiz Overview

  Flex Applications Require:
    Remote Services
    Models / Data
    Controllers / Logic
    Views
Swiz Overview

  Components need
  each other
    Wire ourselves
    Use Locators
    Verbose XML
Swiz Overview

  Components need
  each other
    Wire ourselves
    Use Locators
    Verbose XML
    IoC
    Annotations
Swiz Overview

  Views communicate
  with components
    Flex Events
    MVC Paradigm
    DynamicMediator
    makes it easy!
Swiz Overview
 Applications need remote data
   Async Tokens
   Responders
   State around calls
   SwizResponder
   makes it easy!
Swiz Features

  IoC
    injects app
  DynamicResponder
    remote data
  DynamicMediator
    event handling
  and a whole lot more...
Swiz Doesn't mess with..

  Excessive JEE patterns
  Boilerplate code
  Verbose XML / MXML configuration
  Overly Prescriptive workflow
IoC Recap..

  Components require ‘dependencies’
  to function
  Dependencies may be simple strings and
  values, or other components
  Resolving complex dependencies is
  outside the scope of primary logic
IoC with Swiz

  Express dependencies through
  Metadata, or ‘Annotations’
  Swiz takes care of configuration through
  Dependency Injection
  Views also have dependencies such as
  Models, or PresentationModels
  Swiz handles everything for you!!
Advanced Swiz




         Working with Swiz
Defining Beans

  Define components in BeanLoaders
  Written in plain old MXML
  Swiz calls objects Beans because it only
  cares about their properties
Defining BeanLoaders
<BeanLoader xmlns=“org.swizframework.util.*”
xmlns:mx=http://www.adobe.com/2006/mxml>

<mx:RemoteObject id=“userService”
destination=“userService”/>
<mx:RemoteObject id=“mapService”
destination=“mapService”/>
<controller:UserController id=“userController”/>
<controller:MapController id=“mapController”/>
</BeanLoader>
Swiz's IoC Factory

  When Swiz loads beans, it searches for
  ‘Inject’ metadata
  When objects are retrieved, Swiz
  performs the magic of Injecting
  Swiz adds event listeners for added to
  stage and removed from stage events
  Allows Swiz to Inject and clean up Views
  too!
Loading Swiz

  Use Swiz’s ConfigBean in MXML
  Requires an array of BeanLoaders
  Access to all configuration parameters

  <swizframework:SwizConfig strict="true"
  beanLoaders="{[Beans]}"
  logEventLevel="{LogEventLevel.WARN}"/>
Expressing Dependencies

  Dependencies are NOT defined in
  MXML!
  Use [Inject] in your AS objects
  Similar to new Spring 2.0 configuration
  Qualify bean to inject by id.
  [Inject(bean="userController")]
  public var userController: UserController;
Expressing Dependencies

  To inject by type, forget the ‘bean’
  Swiz looks for bean which matches the
  variable type
  Works with interfaces and inheritance
  Swiz throws ‘AmbiguousBean’ error if
  more than one bean could be injected
View Autowiring

  You can use Inject on accessors as well
  as properties
  Properties can be autowired with two
  way bindings!
  Accessors allow views to perform logic
  when dependencies are set
Working with RemoteObjects

  ServiceHelper bind result and fault
  handlers transparently
  Swiz offers simple methods for creating
  in AbstractController
Dynamic Mediators
   Add [Mediate] annotation to a Controller
   function
[Mediate(event=“eventType”, properties=“foo, bar”)]
public function doStuff(argA : String, argB : String) {}
   Swiz creates a DynamicMediator for you
   Adds an eventListener for supplied type to
   Swiz’s centralDispatcher
   Uses ‘properties’ to construct method call
Recap

  Swiz’s IoC is very easy to use
  Swiz provides a simple MVC paradigm
  Very little XML! Mostly Annotations
  Swiz provides core utilities for:
    SwizResponders and ChainEvents
    Event handling
    DynamicMediators
Recap

  Swiz represents best practices learned
  from years of consulting
  Swiz is damn easy!
  New features are coming fast and
  furious!
Swiz 1.0
  Module support
  Any AS3 Project Support
  AIR windows support
  Additional metadata:
  [PostConstruct], [PreDestroy]
  Custom metadata processors (might be
  THE killer feature of Swiz)
Let's Start Coding...
Resources
Swiz Resources
   http://github.com/swiz/swiz-framework/
   http://groups.google.com/group/swiz-framework
   http://cdscott.blogspot.com
   http://soenkerohde.com
   http://www.returnundefined.com
Other Resources
   http://github.com/nsdevaraj/SwizDAO
   http://code.google.com/p/dphibernate
   http://code.google.com/p/flex-mojos
   http://code.google.com/p/loom

Contenu connexe

Tendances

Security on Rails
Security on RailsSecurity on Rails
Security on RailsDavid Paluy
 
Security Patterns for Microservice Architectures - ADTMag Microservices & API...
Security Patterns for Microservice Architectures - ADTMag Microservices & API...Security Patterns for Microservice Architectures - ADTMag Microservices & API...
Security Patterns for Microservice Architectures - ADTMag Microservices & API...Matt Raible
 
Dnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforussoDnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforussoDotNetCampus
 
SYDSP - Office 365 and Cloud Identity - What does it mean for me?
SYDSP  - Office 365 and Cloud Identity - What does it mean for me?SYDSP  - Office 365 and Cloud Identity - What does it mean for me?
SYDSP - Office 365 and Cloud Identity - What does it mean for me?Scott Hoag
 
Building a document e-signing workflow with Azure Durable Functions
Building a document e-signing workflow with Azure Durable FunctionsBuilding a document e-signing workflow with Azure Durable Functions
Building a document e-signing workflow with Azure Durable FunctionsJoonas Westlin
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design PatternsLilia Sfaxi
 
Dependency injection Drupal Camp Wrocław 2014
Dependency injection Drupal Camp Wrocław 2014Dependency injection Drupal Camp Wrocław 2014
Dependency injection Drupal Camp Wrocław 2014Greg Szczotka
 
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...Christian Schneider
 
Azure Key Vault with a PaaS Architecture and ARM Template Deployment
Azure Key Vault with a PaaS Architecture and ARM Template DeploymentAzure Key Vault with a PaaS Architecture and ARM Template Deployment
Azure Key Vault with a PaaS Architecture and ARM Template DeploymentRoy Kim
 
JavaEE with Vaadin - Workshop
JavaEE with Vaadin - WorkshopJavaEE with Vaadin - Workshop
JavaEE with Vaadin - WorkshopPeter Lehto
 
SIngle Sign On with Keycloak
SIngle Sign On with KeycloakSIngle Sign On with Keycloak
SIngle Sign On with KeycloakJulien Pivotto
 
Azure Active Directory - An Introduction for Developers
Azure Active Directory - An Introduction for DevelopersAzure Active Directory - An Introduction for Developers
Azure Active Directory - An Introduction for DevelopersJohn Garland
 
Asec r01-resting-on-your-laurels-will-get-you-pwned
Asec r01-resting-on-your-laurels-will-get-you-pwnedAsec r01-resting-on-your-laurels-will-get-you-pwned
Asec r01-resting-on-your-laurels-will-get-you-pwnedDinis Cruz
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for DevelopersSarah Dutkiewicz
 
Node.js and the new front-end
Node.js and the new front-endNode.js and the new front-end
Node.js and the new front-endEqual Experts
 
Rhinos have tea_on_azure
Rhinos have tea_on_azureRhinos have tea_on_azure
Rhinos have tea_on_azureCEDRIC DERUE
 
Agile methodologies based on BDD and CI by Nikolai Shevchenko
Agile methodologies based on BDD and CI by Nikolai ShevchenkoAgile methodologies based on BDD and CI by Nikolai Shevchenko
Agile methodologies based on BDD and CI by Nikolai ShevchenkoMoldova ICT Summit
 

Tendances (20)

Security on Rails
Security on RailsSecurity on Rails
Security on Rails
 
Security Patterns for Microservice Architectures - ADTMag Microservices & API...
Security Patterns for Microservice Architectures - ADTMag Microservices & API...Security Patterns for Microservice Architectures - ADTMag Microservices & API...
Security Patterns for Microservice Architectures - ADTMag Microservices & API...
 
Dnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforussoDnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforusso
 
SYDSP - Office 365 and Cloud Identity - What does it mean for me?
SYDSP  - Office 365 and Cloud Identity - What does it mean for me?SYDSP  - Office 365 and Cloud Identity - What does it mean for me?
SYDSP - Office 365 and Cloud Identity - What does it mean for me?
 
Building a document e-signing workflow with Azure Durable Functions
Building a document e-signing workflow with Azure Durable FunctionsBuilding a document e-signing workflow with Azure Durable Functions
Building a document e-signing workflow with Azure Durable Functions
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
Dependency injection Drupal Camp Wrocław 2014
Dependency injection Drupal Camp Wrocław 2014Dependency injection Drupal Camp Wrocław 2014
Dependency injection Drupal Camp Wrocław 2014
 
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...
 
Azure Key Vault with a PaaS Architecture and ARM Template Deployment
Azure Key Vault with a PaaS Architecture and ARM Template DeploymentAzure Key Vault with a PaaS Architecture and ARM Template Deployment
Azure Key Vault with a PaaS Architecture and ARM Template Deployment
 
JavaEE with Vaadin - Workshop
JavaEE with Vaadin - WorkshopJavaEE with Vaadin - Workshop
JavaEE with Vaadin - Workshop
 
SIngle Sign On with Keycloak
SIngle Sign On with KeycloakSIngle Sign On with Keycloak
SIngle Sign On with Keycloak
 
Azure Active Directory - An Introduction for Developers
Azure Active Directory - An Introduction for DevelopersAzure Active Directory - An Introduction for Developers
Azure Active Directory - An Introduction for Developers
 
React Vs AnagularJS
React Vs AnagularJSReact Vs AnagularJS
React Vs AnagularJS
 
Asec r01-resting-on-your-laurels-will-get-you-pwned
Asec r01-resting-on-your-laurels-will-get-you-pwnedAsec r01-resting-on-your-laurels-will-get-you-pwned
Asec r01-resting-on-your-laurels-will-get-you-pwned
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for Developers
 
Node.js and the new front-end
Node.js and the new front-endNode.js and the new front-end
Node.js and the new front-end
 
Apache Wicket
Apache WicketApache Wicket
Apache Wicket
 
FREE Sql Server syllabus
FREE Sql Server syllabusFREE Sql Server syllabus
FREE Sql Server syllabus
 
Rhinos have tea_on_azure
Rhinos have tea_on_azureRhinos have tea_on_azure
Rhinos have tea_on_azure
 
Agile methodologies based on BDD and CI by Nikolai Shevchenko
Agile methodologies based on BDD and CI by Nikolai ShevchenkoAgile methodologies based on BDD and CI by Nikolai Shevchenko
Agile methodologies based on BDD and CI by Nikolai Shevchenko
 

En vedette

Digging into Diigo
Digging into DiigoDigging into Diigo
Digging into DiigoKaren VItek
 
Best Apps and Websites for Classroom Management
Best Apps and Websites for Classroom ManagementBest Apps and Websites for Classroom Management
Best Apps and Websites for Classroom ManagementKaren VItek
 
NYSCATE HV 2015 ScratchJr Hour of Code
NYSCATE HV 2015 ScratchJr Hour of CodeNYSCATE HV 2015 ScratchJr Hour of Code
NYSCATE HV 2015 ScratchJr Hour of CodeKaren VItek
 
Swift Growth Slides
Swift Growth SlidesSwift Growth Slides
Swift Growth Slidesguestee0ab0
 
Ai Investor Presentation July 2007
Ai Investor Presentation July 2007Ai Investor Presentation July 2007
Ai Investor Presentation July 2007Teguh Prasetya
 
Free iPad Apps for Foreign Language, Productivity & Teachers
Free iPad Apps for Foreign Language, Productivity & TeachersFree iPad Apps for Foreign Language, Productivity & Teachers
Free iPad Apps for Foreign Language, Productivity & TeachersKaren VItek
 

En vedette (7)

Digging into Diigo
Digging into DiigoDigging into Diigo
Digging into Diigo
 
BlazeDS
BlazeDSBlazeDS
BlazeDS
 
Best Apps and Websites for Classroom Management
Best Apps and Websites for Classroom ManagementBest Apps and Websites for Classroom Management
Best Apps and Websites for Classroom Management
 
NYSCATE HV 2015 ScratchJr Hour of Code
NYSCATE HV 2015 ScratchJr Hour of CodeNYSCATE HV 2015 ScratchJr Hour of Code
NYSCATE HV 2015 ScratchJr Hour of Code
 
Swift Growth Slides
Swift Growth SlidesSwift Growth Slides
Swift Growth Slides
 
Ai Investor Presentation July 2007
Ai Investor Presentation July 2007Ai Investor Presentation July 2007
Ai Investor Presentation July 2007
 
Free iPad Apps for Foreign Language, Productivity & Teachers
Free iPad Apps for Foreign Language, Productivity & TeachersFree iPad Apps for Foreign Language, Productivity & Teachers
Free iPad Apps for Foreign Language, Productivity & Teachers
 

Similaire à Swiz DAO

Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkASG
 
Dependency Inversion Principle
Dependency Inversion PrincipleDependency Inversion Principle
Dependency Inversion PrincipleShahriar Hyder
 
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...Svetlin Nakov
 
Introduction to Spring sec1.pptx
Introduction to Spring sec1.pptxIntroduction to Spring sec1.pptx
Introduction to Spring sec1.pptxNourhanTarek23
 
Oleksandr Valetskyy - Become a .NET dependency injection ninja with Ninject
Oleksandr Valetskyy - Become a .NET dependency injection ninja with NinjectOleksandr Valetskyy - Become a .NET dependency injection ninja with Ninject
Oleksandr Valetskyy - Become a .NET dependency injection ninja with NinjectOleksandr Valetskyy
 
MVVM Design Pattern NDC2009
MVVM Design Pattern NDC2009MVVM Design Pattern NDC2009
MVVM Design Pattern NDC2009Jonas Follesø
 
Structure mapping your way to better software
Structure mapping your way to better softwareStructure mapping your way to better software
Structure mapping your way to better softwarematthoneycutt
 
Summer internship report
Summer internship reportSummer internship report
Summer internship reportIpsit Pradhan
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular jsAayush Shrestha
 
Riacon swiz
Riacon swizRiacon swiz
Riacon swizntunney
 
Modern ASP.NET Webskills
Modern ASP.NET WebskillsModern ASP.NET Webskills
Modern ASP.NET WebskillsCaleb Jenkins
 
OpenDolphin with GroovyFX Workshop at GreachConf, Madrid
OpenDolphin with GroovyFX Workshop at GreachConf, MadridOpenDolphin with GroovyFX Workshop at GreachConf, Madrid
OpenDolphin with GroovyFX Workshop at GreachConf, MadridDierk König
 
Best practices for creating modular Web applications
Best practices for creating modular Web applicationsBest practices for creating modular Web applications
Best practices for creating modular Web applicationspeychevi
 
VIPER Architecture
VIPER ArchitectureVIPER Architecture
VIPER ArchitectureAhmed Lotfy
 
Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiJared Faris
 
Dip(dependency inversion principle) presentation
Dip(dependency inversion principle) presentationDip(dependency inversion principle) presentation
Dip(dependency inversion principle) presentationqamar mustafa
 

Similaire à Swiz DAO (20)

Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Dependency Inversion Principle
Dependency Inversion PrincipleDependency Inversion Principle
Dependency Inversion Principle
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
 
Introduction to Spring sec1.pptx
Introduction to Spring sec1.pptxIntroduction to Spring sec1.pptx
Introduction to Spring sec1.pptx
 
Oleksandr Valetskyy - Become a .NET dependency injection ninja with Ninject
Oleksandr Valetskyy - Become a .NET dependency injection ninja with NinjectOleksandr Valetskyy - Become a .NET dependency injection ninja with Ninject
Oleksandr Valetskyy - Become a .NET dependency injection ninja with Ninject
 
MVVM Design Pattern NDC2009
MVVM Design Pattern NDC2009MVVM Design Pattern NDC2009
MVVM Design Pattern NDC2009
 
Structure mapping your way to better software
Structure mapping your way to better softwareStructure mapping your way to better software
Structure mapping your way to better software
 
Summer internship report
Summer internship reportSummer internship report
Summer internship report
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
 
Riacon swiz
Riacon swizRiacon swiz
Riacon swiz
 
Modern ASP.NET Webskills
Modern ASP.NET WebskillsModern ASP.NET Webskills
Modern ASP.NET Webskills
 
OpenDolphin with GroovyFX Workshop at GreachConf, Madrid
OpenDolphin with GroovyFX Workshop at GreachConf, MadridOpenDolphin with GroovyFX Workshop at GreachConf, Madrid
OpenDolphin with GroovyFX Workshop at GreachConf, Madrid
 
Monorail Introduction
Monorail IntroductionMonorail Introduction
Monorail Introduction
 
Best practices for creating modular Web applications
Best practices for creating modular Web applicationsBest practices for creating modular Web applications
Best practices for creating modular Web applications
 
VIPER
VIPERVIPER
VIPER
 
VIPER Architecture
VIPER ArchitectureVIPER Architecture
VIPER Architecture
 
Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript Spaghetti
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Dip(dependency inversion principle) presentation
Dip(dependency inversion principle) presentationDip(dependency inversion principle) presentation
Dip(dependency inversion principle) presentation
 

Dernier

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 

Dernier (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 

Swiz DAO

  • 2. What we'll discuss DI/ IoC Introduction View Patterns What, Why, How What is Swiz? Why should you use it? Advanced Swiz Swiz DAO
  • 3. What the Hell is IoC? Inversion of Control, is... design in which the flow of control of a system is inverted... -Wikipedia Separate configuration from execution Promotes encapsulation Promotes simpler, focused components
  • 4. What the Hell is IoC? Reusing your code in efficient way. Consider CRUD Operations Logic or any logic being written once and used across your application. Coding Logic not being repeated will help you in efficient testing. Dependency Injection helps you [Inject] Objects and get use of deferred instantiation. Context helps you have a hold on whole application.
  • 5. IoC / Dependency Injection The Inversion of Control (IoC) and Dependency Injection (DI) patterns are all about removing dependencies from your code. IoC/DI are not technologies, they are methods. The Hollywood principle "Don't call us, we'll call you".
  • 6. IoC / Dependency Injection For example: public class TextEditor { private SpellChecker checker; public function TextEditor() { checker = new SpellChecker(); } } What we've done here is create a dependency between the TextEditor and the SpellChecker.
  • 7. IoC / Dependency Injection In an IoC scenario we would instead do something like this: public class TextEditor { private ISpellChecker checker; public function TextEditor(ISpellChecker checker) { this.checker = checker; } } Now, while creating the TextEditor class you have the control over which SpellChecker implementation to use. We're injecting the TextEditor with the dependency.
  • 9. MVP Patterns Passive View Supervising Controller Both variants allow you to increase the testability of your presentation logic.
  • 13. Why not Traditional MVC? You want to maximize the code that can be tested with automation. (Views are hard to test.) You want to share code between pages that require the same behavior. You want to separate business logic from UI logic to make the code easier to understand and maintain.
  • 14. Comparison L - UI logic S - State of the UI
  • 15. Why Passive View? Presentation Model and Supervising Controller are both reasonable alternatives. The strength that Passive View is that both of the alternatives require the view to do some of the synchronization work, which results in more untestable behavior. In Passive View, all the view update logic is placed in the presenter.
  • 16. How to create Passive View? Separate the responsibilities for the visual display and the event handling behavior into different classes named, respectively, the view and the presenter. The view class manages the controls on the page. The presenter contains the logic to respond to the events, update the model (business logic and data of the application) and, in turn, manipulate the state of the view.
  • 18. What Swiz Users are saying.. “Broadchoice evaluated a few frameworks and settled on Swiz as the keystone behind our Workspace product.” Sean Corfield, CTO Railo US
  • 19. What Swiz Users are saying.. “Personally I think it is way better then Cairngorm!” Kurt Wiersma, some Mach-ii dude
  • 20. Why Swiz? Because those guys told you to? Not at all!! But Swiz is... Simple and effective! Easy to learn! Designed to help you write less code! Encourages loose coupling through MVC!
  • 21. Let's Start.. What is Swiz all about?
  • 22. Swiz Overview Flex Applications Require: Remote Services Models / Data Controllers / Logic Views
  • 23. Swiz Overview Components need each other Wire ourselves Use Locators Verbose XML
  • 24. Swiz Overview Components need each other Wire ourselves Use Locators Verbose XML IoC Annotations
  • 25. Swiz Overview Views communicate with components Flex Events MVC Paradigm DynamicMediator makes it easy!
  • 26. Swiz Overview Applications need remote data Async Tokens Responders State around calls SwizResponder makes it easy!
  • 27. Swiz Features IoC injects app DynamicResponder remote data DynamicMediator event handling and a whole lot more...
  • 28. Swiz Doesn't mess with.. Excessive JEE patterns Boilerplate code Verbose XML / MXML configuration Overly Prescriptive workflow
  • 29. IoC Recap.. Components require ‘dependencies’ to function Dependencies may be simple strings and values, or other components Resolving complex dependencies is outside the scope of primary logic
  • 30. IoC with Swiz Express dependencies through Metadata, or ‘Annotations’ Swiz takes care of configuration through Dependency Injection Views also have dependencies such as Models, or PresentationModels Swiz handles everything for you!!
  • 31. Advanced Swiz Working with Swiz
  • 32. Defining Beans Define components in BeanLoaders Written in plain old MXML Swiz calls objects Beans because it only cares about their properties
  • 33. Defining BeanLoaders <BeanLoader xmlns=“org.swizframework.util.*” xmlns:mx=http://www.adobe.com/2006/mxml> <mx:RemoteObject id=“userService” destination=“userService”/> <mx:RemoteObject id=“mapService” destination=“mapService”/> <controller:UserController id=“userController”/> <controller:MapController id=“mapController”/> </BeanLoader>
  • 34. Swiz's IoC Factory When Swiz loads beans, it searches for ‘Inject’ metadata When objects are retrieved, Swiz performs the magic of Injecting Swiz adds event listeners for added to stage and removed from stage events Allows Swiz to Inject and clean up Views too!
  • 35. Loading Swiz Use Swiz’s ConfigBean in MXML Requires an array of BeanLoaders Access to all configuration parameters <swizframework:SwizConfig strict="true" beanLoaders="{[Beans]}" logEventLevel="{LogEventLevel.WARN}"/>
  • 36. Expressing Dependencies Dependencies are NOT defined in MXML! Use [Inject] in your AS objects Similar to new Spring 2.0 configuration Qualify bean to inject by id. [Inject(bean="userController")] public var userController: UserController;
  • 37. Expressing Dependencies To inject by type, forget the ‘bean’ Swiz looks for bean which matches the variable type Works with interfaces and inheritance Swiz throws ‘AmbiguousBean’ error if more than one bean could be injected
  • 38. View Autowiring You can use Inject on accessors as well as properties Properties can be autowired with two way bindings! Accessors allow views to perform logic when dependencies are set
  • 39. Working with RemoteObjects ServiceHelper bind result and fault handlers transparently Swiz offers simple methods for creating in AbstractController
  • 40. Dynamic Mediators Add [Mediate] annotation to a Controller function [Mediate(event=“eventType”, properties=“foo, bar”)] public function doStuff(argA : String, argB : String) {} Swiz creates a DynamicMediator for you Adds an eventListener for supplied type to Swiz’s centralDispatcher Uses ‘properties’ to construct method call
  • 41. Recap Swiz’s IoC is very easy to use Swiz provides a simple MVC paradigm Very little XML! Mostly Annotations Swiz provides core utilities for: SwizResponders and ChainEvents Event handling DynamicMediators
  • 42. Recap Swiz represents best practices learned from years of consulting Swiz is damn easy! New features are coming fast and furious!
  • 43. Swiz 1.0 Module support Any AS3 Project Support AIR windows support Additional metadata: [PostConstruct], [PreDestroy] Custom metadata processors (might be THE killer feature of Swiz)
  • 45. Resources Swiz Resources http://github.com/swiz/swiz-framework/ http://groups.google.com/group/swiz-framework http://cdscott.blogspot.com http://soenkerohde.com http://www.returnundefined.com Other Resources http://github.com/nsdevaraj/SwizDAO http://code.google.com/p/dphibernate http://code.google.com/p/flex-mojos http://code.google.com/p/loom