Advertisement
Guest User

Untitled

a guest
Nov 28th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. Anti-pattern: Control Flow via View Rendering
  2.  
  3. The issue:
  4.  
  5. * Certain views require data.
  6.  
  7. * Said data is returned asynchronously.
  8.  
  9. * In order to render them, a LayoutView is inserted to make the asynchronous request.
  10.  
  11. Needlessly creates views/cruft. Options from parent view need to be passed through the wrapper view.
  12.  
  13. Ideally would have a synchronous init/render method
  14.  
  15.  
  16. Preface: Most of my views request their own data. The advantage of this is that deeply nested views do not have to be passed down data from their parent.
  17.  
  18. When interfacing with views that require data upfront (e.g. TabbedViews, Backbone Forms), a wrapper view needs to be introduced in order to request asynchronous data.
  19.  
  20.  
  21. Two types of views:
  22.  
  23. Presenter views (require data) & LayoutViews (request data)
  24.  
  25. ChartView(patient) vs MyChart/MyPatientsChart
  26.  
  27.  
  28. LayoutView that renders many children.... eg. PatientDetails, PatientSettings
  29.  
  30. change onShow to onBeforeShow
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement