code_junkie

Is it possible to embed Cockburn style textual UML Use Case content in the code base to improve code readability?

Nov 11th, 2011
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. using MyCompany.MyApp.Web.UseCases;
  2.  
  3. protected void MyFirstUserControl_SomeUIWorkflowRequestCommingIn(object sender, EventArgs e)
  4. {
  5. // some code here to respond and make "state" changes or whatever
  6. //
  7. // blah blah blah
  8.  
  9.  
  10. // finally we have this (how did we know to call fish level method?? because we knew when we wrote the code to send the event in the user control)
  11. UpdateUserInterfaceOnFishLevelUseCaseGoalSuccess(FishLevel.SomeNamedUIWorkflow.SelectedItemForPurchase)
  12.  
  13. }
  14.  
  15.  
  16.  
  17. protected void UpdateUserInterfaceOnFishLevelGoalSuccess(FishLevel.SomeNamedUIWorkflow goal)
  18. {
  19. switch (goal)
  20. {
  21. case FishLevel.SomeNamedUIWorkflow.NewMasterItemSelected:
  22. //call some UI related methods here including methods for the other user controls if necessary....
  23. break;
  24. case FishLevel.SomeNamedUIWorkFlow.DrillDownOnDetails:
  25. //call some UI related methods here including methods for the other user controls if necessary....
  26. break;
  27. case FishLevel.SomeNamedUIWorkFlow.CancelMultiSelect:
  28. //call some UI related methods here including methods for the other user controls if necessary....
  29. break;
  30.  
  31. // more cases...
  32.  
  33.  
  34. }
  35. }
  36.  
  37. }
  38.  
  39.  
  40. //also we have
  41. protected void UpdateUserInterfaceOnSeaLevelGoalSuccess(SeaLevel.SomeNamedUIWorkflow goal)
  42. {
  43. switch (goal)
  44. {
  45. case SeaLevel.CheckOutWorkflow.ChangedCreditCard:
  46. // do stuff
  47.  
  48.  
  49. // more cases...
  50.  
  51.  
  52. }
  53. }
  54.  
  55. }
  56.  
  57. class SeaLevel...
  58. class FishLevel...
  59. class KiteLevel...
Add Comment
Please, Sign In to add comment