Better Code for a Better World

Better Code for a Better World

Some rantings about code and an introduction to using ReactiveCocoa to solve all of the problems currently facing mankind—a phrase I only use somewhat facetiously because if software really is taking over the world then better software can, in a very real way, lead to a better world, assuming you’re not writing software for a doomsday device, in which case you should go ahead and write terrible software—but mostly focusing on writing reactive user interfaces because that’s nice and demoable.

62e8c8bfaa8d755cab82accb48d335c8?s=128

Josh Abernathy

October 27, 2012
Tweet

Transcript

  1. (Welcome!)

  2. Josh Abernathy @joshaber

  3. None
  4. None
  5. for a ReactiveCocoa Better World

  6. for a Better World Better Code

  7. Some rantings about code and an introduction to using ReactiveCocoa

    to solve all of the problems currently facing mankind—a phrase I only use somewhat facetiously because if software really is taking over the world then better software can, in a very real way , lead to a better world, assuming you’re not writing software for a doomsday device, in which case you should go ahead and write terrible software—but mostly focusing on writing reactive user interfaces because that’s nice and demoable.
  8. PERSPECTIVE

  9. None
  10. Bug-free (ish)

  11. Bug-free (ish) Expressive

  12. Bug-free (ish) Concise Expressive

  13. PHILOSOPHY

  14. “Out of the Tarpit”

  15. Complexity is STATE

  16. None
  17. 2 states

  18. 2 states 4 states

  19. 2 states 4 states 8 states

  20. 2 states 4 states 8 states 16 states

  21. 32 states ... 64 states ... 128 states ... gazillion

    states ...
  22. Minimize state

  23. Minimize state by deriving it

  24. None
  25. None
  26. 2 states

  27. 2 states 4 states

  28. 2 states 4 states 4 states

  29. Complexity is CONTROL

  30. Say what Not how

  31. What and how

  32. What

  33. What and how

  34. What

  35. Complexity is the ENEMY

  36. Is this complexity inherent to the problem?

  37. i.e.,

  38. Would a normal person think this is necessary?

  39. ReactiveCocoa To The Rescue!

  40. None
  41. None
  42. None
  43. None
  44. Declarative!

  45. Minimal state! (we’ll see that more later)

  46. PRAGMATISM

  47. What is it?

  48. It’s like a series of tubes...

  49. A sequence of values over time.

  50. A stream of things.

  51. int a = 0; a = 1; ... a =

    2;
  52. 0 value of a: 1 2

  53. (We already do this with variables, we just pretend we

    don’t.)
  54. a RACSubscribable b c

  55. a RACSubscribable

  56. RACSubscribable

  57. a b c RACSubscriber

  58. ???

  59. UI events

  60. None
  61. (20, 20)

  62. (20, 20) (100, 0)

  63. (20, 20) (100, 0) (120, 50)

  64. None
  65. h h

  66. h hi h hi

  67. h hi hi! h hi hi!

  68. KVO

  69. Async work

  70. Network request

  71. ???

  72. KVO property = UI events = Network request = Async

    work = ??? = Subscribables
  73. So what?

  74. Shared Vocabulary

  75. Shared Toolset

  76. +combineLatest:reduce: -select: -where: -distinctUntilChanged -throttle: ...and infinity more...

  77. Composable

  78. To the Xcode!

  79. None
  80. Bug-free (ish)

  81. Bug-free (ish) Expressive

  82. Bug-free (ish) Concise Expressive

  83. Minimize state by deriving it

  84. Say what Not how

  85. github.com/github/ReactiveCocoa More Info: Reactive Extensions (Rx) @joshaber elm-lang.org Functional Reactive

    Programming
  86. (Thanks!)