The Unreasonable Effectiveness of Declarative Code and the Near Future of Programming

The Unreasonable Effectiveness of Declarative Code and the Near Future of Programming

Writing code in a declarative style has significantly improved my effectiveness as a developer. This lightning talk will discuss how we can bring a declarative style to our Swift codebase.

De23af005c790b22f8ce4d201e6ca027?s=128

Benjamin Encz

November 07, 2016
Tweet

Transcript

  1. Benjamin Encz @benjaminencz The Unreasonable Effectiveness Of Declarative Code |

    @benjaminencz | Swift Summit, November 2016 1
  2. The Unreasonable Effectiveness Of Declarative Code And The Near Future

    of Programming The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift Summit, November 2016 2
  3. The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift

    Summit, November 2016 3
  4. The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift

    Summit, November 2016 4
  5. The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift

    Summit, November 2016 5
  6. The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift

    Summit, November 2016 6
  7. The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift

    Summit, November 2016 7
  8. Facts instead of Behavior usernameLabel.text <~ user.name ageLabel.text <~ user.age

    The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift Summit, November 2016 8
  9. Facts instead of Behavior usernameLabel.text <~ user.name ageLabel.text <~ user.age

    The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift Summit, November 2016 9
  10. Facts instead of Behavior usernameLabel.text <~ user.name ageLabel.text <~ user.age

    • Idempotent The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift Summit, November 2016 9
  11. Facts instead of Behavior usernameLabel.text <~ user.name ageLabel.text <~ user.age

    • Idempotent • Commutative The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift Summit, November 2016 9
  12. Facts instead of Behavior usernameLabel.text <~ user.name ageLabel.text <~ user.age

    • Idempotent • Commutative • Concurrent The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift Summit, November 2016 9
  13. Facts instead of Behavior usernameLabel.text <~ user.name ageLabel.text <~ user.age

    • Idempotent • Commutative • Concurrent • Reactive The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift Summit, November 2016 9
  14. Declarative Programming in Swift The Unreasonable Effectiveness Of Declarative Code

    | @benjaminencz | Swift Summit, November 2016 10
  15. public protocol DownloadSyncable { static func handleServerResponse( response: SyncResponse, request:

    SyncRequest, state: SyncRequestState? ) -> ( changes: [ModelChange], newState: SyncRequestState?, nextRequest: SyncRequest? ) } The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift Summit, November 2016 11
  16. The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift

    Summit, November 2016 12
  17. • Fact instead of behavior -> Easier to reason about

    The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift Summit, November 2016 12
  18. • Fact instead of behavior -> Easier to reason about

    • Interface forms DSL -> Constrained, unified implementation The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift Summit, November 2016 12
  19. • Fact instead of behavior -> Easier to reason about

    • Interface forms DSL -> Constrained, unified implementation • Separation of concerns via indirection The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift Summit, November 2016 12
  20. • Fact instead of behavior -> Easier to reason about

    • Interface forms DSL -> Constrained, unified implementation • Separation of concerns via indirection • Testability The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift Summit, November 2016 12
  21. The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift

    Summit, November 2016 13
  22. bit.ly/declarative-swift Further Reading: Declarative API Design in Swift (me) Defining

    Declarative (awelonblue) @benjaminencz The Unreasonable Effectiveness Of Declarative Code | @benjaminencz | Swift Summit, November 2016 14