Your SlideShare is downloading. ×
0
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Structuring your flex application with swiz
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Structuring your flex application with swiz

2,009

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,009
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  1. Structuring Flex applications with the Swiz framework<br />Spreker: Jamie Craane<br />
  2. Agenda<br />Presentationpatterns<br />Swiz<br />Q&A<br />
  3. PresentationPatterns<br />Autonomous view<br />Presentation Model<br />Code Behind<br />Model View Presenter<br />Model View Controller<br />And many more…<br />
  4. Autonomous view<br />View<br />
  5. Code Behind<br />View<br />MXML<br />Code-behind<br />Eventhandlers<br />Data Model<br />
  6. Model View Presenter<br />Uses contract to <br />read/write view data<br />View<br />Presenter<br />Read/write<br />model<br />Model<br />
  7. Presentation Model<br />View<br />Presentation<br />model<br />Model<br />
  8. Model View Controller<br />Responds to user events<br />View<br />Controller<br />Updates<br />model<br />Model<br />Notifies view<br />
  9. MVC<br />View<br />Model<br />Service<br />display<br />update<br />update<br />mediator<br />update<br />invokes<br />invokes<br />invokes<br />Controller<br />
  10. Model: Representing State<br /><ul><li>Representsclient state
  11. [Bindable] : dispatcheseventon state change</li></ul>session<br />user<br />personList<br />taskList<br />selectedPerson<br />
  12. View: Presentation and Interaction<br />View<br />Model<br />References<br />personlist<br />taskdetails<br />Notifies<br /><ul><li>Presents model to the user
  13. Responds to model changes, ({} databinding)
  14. Responds to user actions, (Declarativeeventhandling)
  15. MostlyMXML</li></li></ul><li>Controller: ExposeActions<br /><ul><li>User-initiatedactions
  16. Invokes services
  17. Updates model</li></ul>View<br />Controller<br />call<br />Service<br />Invoke<br />Model<br />Updates<br />
  18. Service: Encapsulatesbackends<br />Services<br />PersonService<br />TaskService<br />PersonService<br />Mock<br /><ul><li>Service callsremotedestinations
  19. HttpServiceorRemoteObject (ie. BlazeDS)
  20. Returns anASyncToken
  21. Logical place forstubs</li></li></ul><li>Mediators: update view<br />User-initiatedactions<br />Updates view<br />Updates model (ifneeded)<br />Mediator<br />Interface<br />View<br />call<br />View<br />Updates<br />Model<br />Updates<br />
  22. Swiz<br />Micro architecture and Dependency Injection framework<br />
  23. MircoArchitectureFramework<br />“Enables, but not restricts, in the implementation of an application following any given architecture”<br />
  24. Swiz in a nutshell<br />Dependency Injection<br />Event Mediation<br />Utilities<br />ServiceHelper<br />Global exception handler<br />And more…<br />MetaData processors<br />
  25. DependencyInjection 1<br />How can a given object obtain a reference to another object?<br />
  26. DependencyInjection 2<br />Object A<br />Object B<br />Depends on<br />
  27. DependencyInjection 3<br />Object A<br />DI framework<br />Object B<br />Object A<br />Object B<br />Application<br />Context<br />
  28. Dependencyinjection 4<br />[Inject]<br />public var userController:UserController;<br /><?xml version="1.0" encoding="utf-8"?><br /><swiz:BeanProvider<br /> <controller:UserController/><br /></swiz:BeanProvider><br />
  29. Dependencyinjection 5<br />Typically inject by type<br />Specify Bean ID if necessary<br />Works with interfaces and inheritance<br />
  30. WhyDependencyInjection?<br />Removes dependencies on concrete implementations<br />No ServiceLocator<br />Easy to see dependencies<br />
  31. EventMediation<br />dispatcher.dispatchEvent(<br />new TaskEvent(TaskEvent.SAVE_TASK_SUCCESS, true));<br />[Mediate(event="TaskEvent.SAVE_TASK_SUCCESS")]<br />publicfunction saveTaskSuccess():void {<br /> this.closeTaskDetailsWindow();<br /> taskController.retrieveTasks();<br />}<br />
  32. EventMediation<br />[Mediate(event="UserWindow.SAVE_CLICKED", properties="user")]<br />public function saveUser(user:User):void {<br /> userController.addUser(user);<br />}<br />
  33. ServiceHelper<br />serviceHelper.executeServiceCall(<br />taskService.addTask(task), <br />onAddTaskResult,<br /> [task]<br />);<br /><swiz:SwizConfigid="mySwizConfig"<br />eventPackages="nl.qnh.addressbook.event"<br />viewPackages="nl.qnh.addressbook.view"<br />defaultFaultHandler="{genericFault}"/><br />
  34. MockDelegateHelper<br />var result:XML = <br /> <tasks><br /> <task><br /> <id>1</id><br /> <name>This is a task</name><br /> </task><br /> </tasks><br />return<br />new MockDelegateHelper().createMockResult(result);<br />
  35. MetaData Processors<br />Easily create your own metadata tags<br />[Log]<br />publicvar log:ILogger;<br />/** Code Omitted **/<br />log.error(“An error occured”);<br />[MediateView(“PersonView”)]<br />public var personView:PersonView;<br />
  36. MetaData Processors<br />Extend BaseMetadataProcessor<br />Implement setUpMetadataTag and tearDownMetadataTag<br />Add “-keep-as3-metadata+=Log” to compiler arguments<br />
  37. References<br />http://swizframework.org/<br />http://martinfowler.com/eaaDev/uiArchs.html<br />http://blogs.adobe.com/paulw/archives/2007/09/presentation_pa.html<br />

×