Advertisement
Gordon___From

Untitled

Jul 2nd, 2017
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. ### Forms and Controls:
  2. "The system then calculates and displays the variance from the target. The system highlights
  3. the variance in red when it is 10% or more below the target, or in green when 5% or more above the target."
  4.  
  5. - two main responsibilities:
  6. - Screen layout: defining the arrangement of the controls on the screen, together with their hierarchic structure with one other.
  7. - Form logic: behavior that cannot be easily programmed into the controls themselves.
  8.  
  9. - copies data of data:
  10. - record set(DB)
  11. - session state
  12. - screen(view) data
  13.  
  14. - Data binding(direct data - form control binding):
  15. - to help session data and screen data synced;
  16. - to avoid infinite loop of updates define data flow direction;
  17.  
  18. - Data binding could be tricky, when some complex logic of view is involved.
  19.  
  20. Example: Variance field(reading field) which is result of difference calculation of two actual field.
  21. In general data binding gets tricky because if you have to avoid cycles where a change to the control,
  22. changes the record set, which updates the control, which updates the record set....
  23.  
  24. *The flow of usage helps avoid these*
  25. - we load from the session state to the screen when the screen is opened,
  26. - after that any changes to the screen state propagate back to the session state.
  27.  
  28. It's unusual for the session state to be updated directly once the screen is up.
  29. As a result data binding might not be entirely bi-directional - just confined
  30. to initial upload and then propagating changes from the controls to the
  31. session state.
  32.  
  33. Solutions: Events(Observer pattern), form fields subscribes to events. On input 'input_variance' is
  34. triggered. Form gets event, calculates difference and send data back to variance field.
  35.  
  36. ### MVC
  37.  
  38. The idea behind *Separated Presentation*: This pattern is a form of layering, where we keep
  39. presentation code and domain code in separate layers with the domain code unaware of presentation code.
  40. Domain objects should be completely self contained and work without reference to the presentation,
  41. they should also be able to support multiple presentations, possibly simultaneously.
  42.  
  43. In MVC, the domain element is referred to as the model. Model objects are completely ignorant of the UI.
  44.  
  45. The presentation part of MVC is made of the two remaining elements: view and controller.
  46. The controller's job is to take the user's input and figure out what to do with it.
  47.  
  48. At this point I should stress that there's not just one view and controller, you have a
  49. view-controller pair for each element of the screen, each of the controls and the screen
  50. as a whole. So the first part of reacting to the user's input is the various controllers
  51. collaborating to see who got edited.
  52.  
  53. https://martinfowler.com/eaaDev/uiArchs/mvc-deps.gif
  54.  
  55. There would be an assessment view that would represent the whole screen and define the layout
  56. of the lower level controls, in that sense similar to a form in Forms and Controllers.
  57. Unlike the form, however, MVC has no event handlers on the assessment controller for
  58. the lower level components.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement