F101 - Behaviors, Configuration, and Runtime

1,091 views

Published on

I’m going to drill our entire architecture into your head. I’ll explain this magic BehaviorGraph and Behavior idea that we always talk. By the end of this, you should understand what makes FubuMVC different.

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

  • Be the first to like this

No Downloads
Views
Total views
1,091
On SlideShare
0
From Embeds
0
Number of Embeds
445
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

F101 - Behaviors, Configuration, and Runtime

  1. 1. F101 - Behaviors, Configuration, and Runtime<br />
  2. 2. About the Author<br />Joshua Arnold<br />Chief Software Architect, Perioperative Logistics<br />Josh leads the development efforts for the Logistics team and is a principal developer on the Fubu-family of frameworks. <br />He is a husband, expectant father, passionate software craftsman, coach, closet musician, and perpetual learner.<br />http://www.linkedin.com/in/joshuaarnold<br />http://josharnold.lostechies.com<br />http://twitter.com/jmarnold<br />
  3. 3. Goals<br />Understand the underlying model that makes FubuMVC<br />
  4. 4. What’s in an Action?<br />users/jmarnold<br />
  5. 5. What’s in an Action?<br />users/jmarnold<br />{controller}/{action}<br />
  6. 6. What’s in an Action?<br />users/jmarnold<br />{controller}/{action}<br />UsersController.Show(string username)<br />
  7. 7. What’s in an Action?<br />Routing<br />users/jmarnold<br />Web Framework<br />{controller}/{action}<br />Method Invocation<br />UsersController.Show(string username)<br />
  8. 8. What’s in an Action?<br />Web Framework<br />Given some {route}:<br /> 1. Locate the Method for that route 2. Invoke that Method<br />
  9. 9. What’s in an Action?<br />Method Invocation<br />Type<br />MethodInfo<br />
  10. 10. What’s in an Action?<br />ActionCall<br />Type<br />MethodInfo<br />
  11. 11. Action Calls<br />Analogous to “Controller Actions”<br />Can come from anywhere – it’s just a glorified delegate descriptor<br />Key Term:ActionCall<br />
  12. 12. Request/Response<br />Given some {route}:<br /> 1. Locate the Method for that route 2. Invoke that Method<br /> 3. Render the respective view<br />
  13. 13. Request/Response<br />Routing<br />Given some {route}:<br />Web Framework<br />1. Locate the Method for that route<br />Method Invocation<br />2. Invoke that Method<br />3. Render the respective view<br />View Rendering<br />
  14. 14. The Pipeline<br />Method Invocation<br />View Rendering<br />
  15. 15. The Pipeline<br />ActionCall<br />Output<br />
  16. 16. The Pipeline<br />BehaviorNode<br />ActionCall<br />Output<br />Key Term:BehaviorNode<br />
  17. 17. The Pipeline<br />“Invoke this method”<br />“Render the output”<br />ActionCall<br />Output<br />
  18. 18. The Pipeline<br />“Invoke this method”<br />“Render the output”<br />ActionCall<br />Output<br />“Get the data from here and…”<br />“…and put the return value in here”<br />IFubuRequest<br />
  19. 19. Configuration Model<br />BehaviorChain<br />Node 3<br />Node 1<br />Node 2<br />
  20. 20. Behavior Chains<br />Essentially a linked list of Behavior Nodes<br />Describes the order in which behavior nodes will execute for a given request<br />Can be identified by:<br />Guid<br />Input Model Type<br />Key Term:BehaviorChain<br />
  21. 21. Request/Response<br />Routing<br />Given some {route}:<br />Web Framework<br />1. Locate the Method for that route<br />Method Invocation<br />2. Invoke that Method<br />3. Render the respective view<br />View Rendering<br />
  22. 22. Request/Response<br />Routing<br />Given some {route}:<br />*<br />FubuMVC<br />1. Find the BehaviorChain for that route<br />Resolve Chain<br />2. Invoke that BehaviorChain<br />Execute Chain<br />*<br />Not exactly how we do it, but we’ll clarify later<br />
  23. 23. Chain Execution - Configuration<br />users/jmarnold<br />UsersController.Show(“jmarnold”)<br />WebFormOutputNode<br />
  24. 24. Chain Execution - Runtime<br />UsersController.Show(“jmarnold”)<br />Render WebForms View<br />
  25. 25. Runtime: Russian Dolls<br />Full control over execution of next behavior<br />Transactions<br />Using statements<br />Etc.<br />You can decide not to execute the next<br />You can even decide to do something else instead<br />
  26. 26. Models/Terminology<br />Configuration:<br />BehaviorChain<br />BehaviorNode<br />Runtime:<br />IActionBehavior<br />
  27. 27. One More Time<br />Configuration:<br />Node 3<br />Node 1<br />Node 2<br />
  28. 28. One More Time<br />Node 1<br />Runtime:<br />Node 2<br />Node 3<br />
  29. 29. Intermission<br />Grab some coffee<br />Ask some questions<br />Make sure we’re all on the same page here<br />
  30. 30. Behavior Chain Construction<br />ActionCalls are registered through either of the following:<br />Conventional discovery (as stated in your FubuRegistry)<br />IActionSource implementations registered in your FubuRegistry<br />
  31. 31. Behavior Chain Construction<br />FubuRegistry<br />BehaviorGraph<br />BehaviorChain 1<br />Assembly Scanning<br />BehaviorChain 2<br />IActionSources<br />Key Term:BehaviorGraph<br />
  32. 32. Routing Integration<br />BehaviorChain<br />Output<br />ActionCall<br />
  33. 33. Routing Integration<br />Route<br />IUrlPolicy<br />BehaviorChain<br />Output<br />ActionCall<br />
  34. 34. Request/Response<br />Routing<br />Given some {route}:<br />*<br />FubuMVC<br />1. Find the BehaviorChain for that route<br />Resolve Chain<br />2. Invoke that BehaviorChain<br />Execute Chain<br />*<br />Not exactly how we do it, but we’ll clarify later<br />
  35. 35. Request/Response<br />Routing<br />Given some {route}:<br />FubuMVC<br />1. Find the BehaviorChainfor the route, via the BehaviorGraph, using the configured Guid<br />Resolve Chain<br />Execute Chain<br />2. Invoke that BehaviorChain<br />
  36. 36. Who Cares?<br />Behaviors seem cool…<br />What’s the point?<br />
  37. 37. How about an example?<br />
  38. 38. …And Again…<br />
  39. 39. What if we could…<br />
  40. 40. What if we could…<br />ActionCall(CreateEntityAction<TEntity>)<br />
  41. 41. What if we could…<br />{entity}/create<br />IUrlPolicy<br />ActionCall(CreateEntityAction<TEntity>)<br />
  42. 42. Reusable Actions<br />Why repeat yourself when you don’t have to?<br />
  43. 43. Reusable Behaviors<br />Why invoke an ActionCall if the input isn’t valid? <br />Use a “Validation Behavior”<br />
  44. 44. Question Time<br />
  45. 45. Where to go from here…<br />…you tell me:<br />View Engines & Html Conventions?<br />Custom Behaviors?<br />FubuRegistry DSL?<br />

×