11) ElixirConf 2017 - Its Better Unstated - TJ Stankus

design
elixirconf2017
#1

ElixirConf 2017 - Its Better Unstated - @tjstankus

This is a story about transitioning an obsession with object-oriented software design to an obsession with functional software design. It’s about experimentation, learning, and play. It’s about what happens when you let go of sacred cows you’ve hung onto for nearly 20 years and insist on wiping the slate clean.

The story is told through a code kata. It starts with a Ruby example, the result of a rigorous application of OO principles. It’s thoroughly decomposed, free of conditionals, and contains small objects representing domain concepts, including state. The solution is all about state and it’s lovely, if a little overwrought.

But could I implement the same kata in Elixir entirely without state? It turns out that leveraging functional approaches and Elixir features like pattern matching, robust list processing, and guard clauses, a conditional-free solution emerged with an 85% reduction in lines of code.

This talked is aimed squarely at the developer thinking about or just starting to transition from an OO mindset to a functional one. I’ve had several jaw-dropping moments along my learning path and I hope to share my experiences and enthusiasm with others.

Audience: Beginner

All talks are available in the Elixir Conf 2017 Talks List or via the #elixirconf2017 tag

3 Likes

#2

I could definitely tell that this talk was done by someone who has taught with Sandi Metz. It sounded like her at times.

1 Like

#3

Guilty as charged. :slight_smile: It’s hard not to talk shop and teach with her as much as I do and not be strongly influenced by her ideas and presentation style.

2 Likes

#4

I completely understand that. Sandi is terrific. I keep hoping she’ll try Elixir someday! :slight_smile:

2 Likes

#5

She was on the Elixir Fountain podcast, but IIRC, she only dabbled for a moment in it

0 Likes

#6

@JEG2 I’m working on it. :slight_smile: Actually, she’s been learning Elm as I’ve been learning Elixir. We’ve had some great conversations about the mindset transition from OOP to functional. Hopefully there will be some great material/talks coming out of those conversations.

1 Like

#7

Elm is great too.

0 Likes

#8

@tjstankus Nice use-case study of an OOP vs functional solution. It was nice to be able to go over the two solutions in detail. Nice talk :thumbsup:

1 Like