Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. <?php
  2.  
  3. //t-gram's model (short-sighted IMHO):
  4. $keyboard = array(
  5. //row_0
  6. array(
  7. 'my_command_0_0',
  8. 'my_command_0_1,
  9. ),
  10. array(
  11. 'my_command_1_0'
  12. 'my_command_1_1',
  13. 'my_command_1_2',
  14. ),
  15. );
  16.  
  17. //my idea
  18. $my_keyboard = array(
  19. //row_0
  20. array(
  21. array(
  22. 'display_command' => 'my_display_to_user_command_0_0',
  23. 'actual_command' => 'my_actual_command_0_0',
  24. ),
  25. array(
  26. 'display_command' => 'my_display_to_user_command_0_1',
  27. 'actual_command' => 'my_actual_command_0_1',
  28. ),
  29. ),
  30. //row 1
  31. array(
  32. array(
  33. 'display_command' => 'my_display_to_user_command_1_0',
  34. 'actual_command' => 'my_actual_command_1_0',
  35. ),
  36. array(
  37. 'display_command' => 'my_display_to_user_command_1_1',
  38. 'actual_command' => 'my_actual_command_1_1',
  39. ),
  40. array(
  41. 'display_command' => 'my_display_to_user_command_1_2',
  42. 'actual_command' => 'my_actual_command_1_2',
  43. ),
  44. )
  45. );
  46.  
  47. /**
  48. * advatages of the second approach:
  49. * the 'command' that's being displayed is just that (a property of the display, which need not be perfectly mapped to the backend command)
  50. *
  51. * example: a user issues a command to get a music track: 'top10 dance'. If that user wants to get
  52. * another music track, a natural command would be 'next'. Instead of forcing the server to
  53. * maintain additional state, this type of problem is easily solved by the paradigm above:
  54. *
  55. * 'display_command' is what is displayed to the user.
  56. *
  57. * if that command is clicked, the 'actual_command' gets send back to the server.
  58. *
  59. * While the client would have to deal with this logic, it's preferable
  60. * for the client to bear this minor burden than for a server to have to maintain this state per-user.
  61. * Upon opening up this API to the public, I think that developers will very much like this feature.
  62. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement