Abstractioneering Connection details are abstracted out so they can be changed in one place The User object encapsulates a user’s behavior Separation of data and representation

Abstractioneering The real value of Rails (or any MV* framework) is in providing a set of useful abstractions to solve common problems and promote code reuse.

Abstractioneering The real value of Rails (or any MV* framework) is in providing a set of useful abstractions to solve common problems and promote code reuse. Our goal as software engineers should be to recognize common problems and write reusable abstractions to solve them.

Functional Programming Start with functions - these represent actions or behaviors Build programs by combining simple functions into more complicated ones

Functional Programming Start with functions - these represent actions or behaviors Build programs by combining simple functions into more complicated ones Verbs, not nouns

Functional Programming Category theory is the mathematical study of functions and composition Monads are important objects in category theory As such, monads tend to be more important and prevalent in strongly functional languages.

Functional Programming A language that doesn't affect the way you think about programming, is not worth knowing. For instance, Haskell programs can’t do anything without monads

Functional Programming A language that doesn't affect the way you think about programming, is not worth knowing. - Alan Perlis For instance, Haskell programs can’t do anything without monads

Monad Laws The last law looks complicated, but that’s because we’re at the wrong level of abstraction. With an appropriate cross-composition operator it’s

Monad Laws The last law looks complicated, but that’s because we’re at the wrong level of abstraction. With an appropriate cross-composition operator it’s

The Ubiquitous Monad IO - as discussed, and hence the do joke List - represents non-deterministic (or, with a little modiﬁcation, probabilistic) computation

The Ubiquitous Monad IO - as discussed, and hence the do joke List - represents non-deterministic (or, with a little modiﬁcation, probabilistic) computation Maybe - represents computation that might fail to return a value

The Ubiquitous Monad IO - as discussed, and hence the do joke List - represents non-deterministic (or, with a little modiﬁcation, probabilistic) computation Maybe - represents computation that might fail to return a value State - functions that alter program state

The Ubiquitous Monad IO - as discussed, and hence the do joke List - represents non-deterministic (or, with a little modiﬁcation, probabilistic) computation Maybe - represents computation that might fail to return a value State - functions that alter program state Persistent - functions that alter a database

Takeaways Monads are a different type of composition, well suited to managing state, history, or side effects Functional programming and category theory are worth studying - especially together

References Source code - https://github.com/jamesdabbs/rb- monads The Kingdom of Nouns - http://steve- yegge.blogspot.com/2006/03/execution-in-kingdom- of-nouns.html Learn You a Haskell - http://learnyouahaskell.com/