SlideShare a Scribd company logo
Model View
Command
COMMAND CHAIN PATTERN
Command vs. Controller

 Command                                  Controller
 Command is Next Action to be             Controller is a set of methods packed
 Invoked                                  in a class
 Next action is a function or an Action   Contains method for particular
 Set                                      operation
 Command can be in different              Unless tightly coupled, difficult to
 component                                access different controller
 Easy to visualize Logic as State         Difficult to visualize Controller Logic
 Machine
 Easy to perform Command binding for Difficult to route different command
 Conditional Logic based on Data     based on Conditional Data
State Machine Pattern



 • Data Entry
                    Next   • Refresh
 • HTTP Post    • Upload     List
                  File

     Next                       null
Next is Bindable Property


                                        Yes, Bind
                                     QueryByContact
                                       Command
                   Yes, Is Contact
                    Text Empty?
                                       No, Bind
  Is Search Text
                                      QueryByAny
      Empty?
                     No, Bind         Command
                   QueryByName
                    Command
Next is an Action Set
(Instruction Set)
    Action Set is a reference to Function
    Or Action Set is an anonymous object with fields to modify
     properties
    Or Action Set is an array of Action Set
    Object with data property merges data properties to current
     control’s data property
    Object with scope property merges scope properties to current
     object’s scope property
    Object with appScope property merges scope properties to
     application scope
Reference to Function

 // this is global JavaScript Function
 function callMe(scope,sender){
      //scope is current scope of caller
      //sender is control
 }


 <button
     atom-type=“AtomButton”
     atom-next=“{callMe}”/>
Reference to Scope Function

 // definition within the scope
 ({
      callMe: function(scope,sender){
      }
 })


 <button
      atom-type=“AtomButton”
      atom-next=“{$scope.callMe}”/>
Action Set to Modify Data

 // anonymous object literal with data property will
 // update name and id properties of data associated with
 // the control


 <button
    atom-type=“AtomButton”
    atom-next=“{ { data: { name:‟Sample‟, id: 0 } } }”/>
Binding Commands

 // assuming we have two different forms for different
 // genders, and we want to submit them
 // according to the selected gender


 <button
    atom-type=“AtomButton”
    atom-next=“[ $scope.gender == „male‟ ?
    $scope.maleForm.submitCommand :
    $scope.femaleForm.submitCommand ]”
    />
Bindable Commands

 // following button command will increment count
 // on every click


 <button
    atom-type=“AtomButton”
    atom-next=“[ { scope: { counter: $scope.counter + 1 }
 } ]”/>


 // Outer brackets signify one way binding, as after
 // counter changes, next has to change as well
Array of Action Sets

 // Notice, outer Square Brackets determine it is a
 // One Way Binding


 <button
    atom-type=“AtomButton”
    atom-next=“[ [$scope.callMe,
 $scope.theForm.submitCommand] ]”
Single UI Component

    Model View Command separates everything, but everything still
     remains in one page
    Easy to access UI Hierarchy
    Easy to Isolate Visual Components as Controls
    You can easily create chain of commands
More about Web Atoms

 Web Atoms Web Site
 http://webatoms.neurospeech.com
 Web Atoms Documentation
 http://neurospeech.com/webatoms/docs
 Web Atoms Facebook Page
 http://facebook.com/webatoms
 Web Atoms Twitter Page
 http://twitter.com/akashkava

More Related Content

PPT
Command Pattern
PPTX
Command Design Pattern
PPTX
Command Pattern
PPT
Command pattern
PPT
Command Design Pattern
PPT
Command Design Pattern
PDF
Design patterns - Singleton&Command
PPT
Generalized Functors - Realizing Command Design Pattern in C++
Command Pattern
Command Design Pattern
Command Pattern
Command pattern
Command Design Pattern
Command Design Pattern
Design patterns - Singleton&Command
Generalized Functors - Realizing Command Design Pattern in C++

What's hot (17)

PDF
Command pattern in java
PPTX
Triggers
PPT
PDF
Vb script tutorial for qtp[1]
PPTX
pl/sql Procedure
PPT
Intorudction into VBScript
PPTX
Procedure and Functions in pl/sql
PPT
PLSQL Cursors
PPT
Basic cursors in oracle
PPTX
Mule expression component
PDF
Functions in php
PDF
Php, mysq lpart3
PPT
QTP VB Script Trainings
PPTX
Oracle: Cursors
PPTX
PL/SQL Fundamentals I
PPTX
PLSQL Tutorial
PPTX
Function & procedure
Command pattern in java
Triggers
Vb script tutorial for qtp[1]
pl/sql Procedure
Intorudction into VBScript
Procedure and Functions in pl/sql
PLSQL Cursors
Basic cursors in oracle
Mule expression component
Functions in php
Php, mysq lpart3
QTP VB Script Trainings
Oracle: Cursors
PL/SQL Fundamentals I
PLSQL Tutorial
Function & procedure
Ad

Similar to Model View Command Pattern (20)

PDF
ASP.NET MVC - Whats The Big Deal
PDF
MVC pattern for widgets
PPT
Command presentation on design pattern.
PPT
Commanda gfin it show the hole idea of command
PDF
Java Web Programming [8/9] : JSF and AJAX
PDF
360 Max Cairngorm Zamf
PPTX
Asp.net web forms new shiny things part 1
KEY
[Coscup 2012] JavascriptMVC
PPTX
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)
PDF
Infusion for the birds
PDF
mvcExpress training course : part1
PPTX
Bringing the light to the client with KnockoutJS
ZIP
Solving Real World Problems with YUI 3: AutoComplete
PDF
J query fundamentals
PDF
The Dom Scripting Toolkit J Query
KEY
User Interface Development with jQuery
PPT
JavaScript JQUERY AJAX
PDF
Rich Internet Applications con JavaFX e NetBeans
PPTX
User Interface Patterns and Nuxeo
PPTX
ASP.NET MVC as the next step in web development
ASP.NET MVC - Whats The Big Deal
MVC pattern for widgets
Command presentation on design pattern.
Commanda gfin it show the hole idea of command
Java Web Programming [8/9] : JSF and AJAX
360 Max Cairngorm Zamf
Asp.net web forms new shiny things part 1
[Coscup 2012] JavascriptMVC
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)
Infusion for the birds
mvcExpress training course : part1
Bringing the light to the client with KnockoutJS
Solving Real World Problems with YUI 3: AutoComplete
J query fundamentals
The Dom Scripting Toolkit J Query
User Interface Development with jQuery
JavaScript JQUERY AJAX
Rich Internet Applications con JavaFX e NetBeans
User Interface Patterns and Nuxeo
ASP.NET MVC as the next step in web development
Ad

More from Akash Kava (7)

PDF
UI Controls for HTML5 to build Rich Web Applications
PPTX
Migrating from flex or silverlight to HTML
PPTX
Web Atoms - More Markup - Less Script
PPTX
UI Atoms - 3 in 1 Layout and Advanced DataForm
PPTX
Android/iPhone/Blackberry Web Service Connector
PPTX
UI Atoms Form Layout
PPTX
Ui Atoms Validation
UI Controls for HTML5 to build Rich Web Applications
Migrating from flex or silverlight to HTML
Web Atoms - More Markup - Less Script
UI Atoms - 3 in 1 Layout and Advanced DataForm
Android/iPhone/Blackberry Web Service Connector
UI Atoms Form Layout
Ui Atoms Validation

Recently uploaded (20)

PDF
cuic standard and advanced reporting.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Spectroscopy.pptx food analysis technology
PDF
Empathic Computing: Creating Shared Understanding
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation theory and applications.pdf
PPTX
Cloud computing and distributed systems.
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
sap open course for s4hana steps from ECC to s4
PDF
KodekX | Application Modernization Development
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
cuic standard and advanced reporting.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Dropbox Q2 2025 Financial Results & Investor Presentation
Spectroscopy.pptx food analysis technology
Empathic Computing: Creating Shared Understanding
Spectral efficient network and resource selection model in 5G networks
Reach Out and Touch Someone: Haptics and Empathic Computing
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation theory and applications.pdf
Cloud computing and distributed systems.
Programs and apps: productivity, graphics, security and other tools
sap open course for s4hana steps from ECC to s4
KodekX | Application Modernization Development
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx

Model View Command Pattern

  • 2. Command vs. Controller Command Controller Command is Next Action to be Controller is a set of methods packed Invoked in a class Next action is a function or an Action Contains method for particular Set operation Command can be in different Unless tightly coupled, difficult to component access different controller Easy to visualize Logic as State Difficult to visualize Controller Logic Machine Easy to perform Command binding for Difficult to route different command Conditional Logic based on Data based on Conditional Data
  • 3. State Machine Pattern • Data Entry Next • Refresh • HTTP Post • Upload List File Next null
  • 4. Next is Bindable Property Yes, Bind QueryByContact Command Yes, Is Contact Text Empty? No, Bind Is Search Text QueryByAny Empty? No, Bind Command QueryByName Command
  • 5. Next is an Action Set (Instruction Set)  Action Set is a reference to Function  Or Action Set is an anonymous object with fields to modify properties  Or Action Set is an array of Action Set  Object with data property merges data properties to current control’s data property  Object with scope property merges scope properties to current object’s scope property  Object with appScope property merges scope properties to application scope
  • 6. Reference to Function // this is global JavaScript Function function callMe(scope,sender){ //scope is current scope of caller //sender is control } <button atom-type=“AtomButton” atom-next=“{callMe}”/>
  • 7. Reference to Scope Function // definition within the scope ({ callMe: function(scope,sender){ } }) <button atom-type=“AtomButton” atom-next=“{$scope.callMe}”/>
  • 8. Action Set to Modify Data // anonymous object literal with data property will // update name and id properties of data associated with // the control <button atom-type=“AtomButton” atom-next=“{ { data: { name:‟Sample‟, id: 0 } } }”/>
  • 9. Binding Commands // assuming we have two different forms for different // genders, and we want to submit them // according to the selected gender <button atom-type=“AtomButton” atom-next=“[ $scope.gender == „male‟ ? $scope.maleForm.submitCommand : $scope.femaleForm.submitCommand ]” />
  • 10. Bindable Commands // following button command will increment count // on every click <button atom-type=“AtomButton” atom-next=“[ { scope: { counter: $scope.counter + 1 } } ]”/> // Outer brackets signify one way binding, as after // counter changes, next has to change as well
  • 11. Array of Action Sets // Notice, outer Square Brackets determine it is a // One Way Binding <button atom-type=“AtomButton” atom-next=“[ [$scope.callMe, $scope.theForm.submitCommand] ]”
  • 12. Single UI Component  Model View Command separates everything, but everything still remains in one page  Easy to access UI Hierarchy  Easy to Isolate Visual Components as Controls  You can easily create chain of commands
  • 13. More about Web Atoms Web Atoms Web Site http://webatoms.neurospeech.com Web Atoms Documentation http://neurospeech.com/webatoms/docs Web Atoms Facebook Page http://facebook.com/webatoms Web Atoms Twitter Page http://twitter.com/akashkava