SlideShare a Scribd company logo
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

More Related Content

What's hot

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 Functions
Joonas Westlin
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
Lilia 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 2014
Greg 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 Deployment
Roy Kim
 
JavaEE with Vaadin - Workshop
JavaEE with Vaadin - WorkshopJavaEE with Vaadin - Workshop
JavaEE with Vaadin - Workshop
Peter Lehto
 
SIngle Sign On with Keycloak
SIngle Sign On with KeycloakSIngle Sign On with Keycloak
SIngle Sign On with Keycloak
Julien 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 Developers
John Garland
 
React Vs AnagularJS
React Vs AnagularJSReact Vs AnagularJS
React Vs AnagularJS
deepakpatil84
 
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
Dinis Cruz
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for Developers
Sarah 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-end
Equal Experts
 
Apache Wicket
Apache WicketApache Wicket
Apache Wicket
Vít Kotačka
 
FREE Sql Server syllabus
FREE Sql Server syllabusFREE Sql Server syllabus
FREE Sql Server syllabus
Encryption Technology
 
Rhinos have tea_on_azure
Rhinos have tea_on_azureRhinos have tea_on_azure
Rhinos have tea_on_azure
CEDRIC 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
 

What's hot (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
 

Viewers also liked

Digging into Diigo
Digging into DiigoDigging into Diigo
Digging into Diigo
Karen 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 Management
Karen 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 Code
Karen VItek
 
Swift Growth Slides
Swift Growth SlidesSwift Growth Slides
Swift Growth Slides
guestee0ab0
 
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 & Teachers
Karen VItek
 

Viewers also liked (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
 

Similar to Swiz DAO

Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
ASG
 
Dependency Inversion Principle
Dependency Inversion PrincipleDependency Inversion Principle
Dependency Inversion Principle
Shahriar Hyder
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
Hamid Ghorbani
 
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.pptx
NourhanTarek23
 
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
Oleksandr Valetskyy
 
MVVM Design Pattern NDC2009
MVVM Design Pattern NDC2009MVVM Design Pattern NDC2009
MVVM Design Pattern NDC2009
Jonas 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 software
matthoneycutt
 
Summer internship report
Summer internship reportSummer internship report
Summer internship report
Ipsit Pradhan
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
Aayush Shrestha
 
Riacon swiz
Riacon swizRiacon swiz
Riacon swiz
ntunney
 
Modern ASP.NET Webskills
Modern ASP.NET WebskillsModern ASP.NET Webskills
Modern ASP.NET Webskills
Caleb 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, Madrid
Dierk König
 
Monorail Introduction
Monorail IntroductionMonorail Introduction
Monorail Introduction
Andrea Magnorsky
 
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
peychevi
 
VIPER
VIPERVIPER
VIPER
Vikas Kore
 
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 Spaghetti
Jared Faris
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
NexThoughts Technologies
 
Dip(dependency inversion principle) presentation
Dip(dependency inversion principle) presentationDip(dependency inversion principle) presentation
Dip(dependency inversion principle) presentation
qamar mustafa
 

Similar to 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
 

Recently uploaded

The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 

Recently uploaded (20)

The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 

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