Learn You Some Pattern Matching for Great Good!

Speaker:
Elayne Juten


Abstract:

Move if to the bottom of your toolbox. Have you ever looked at a function with numerous conditionals buried within and thought ““there has to be a better way””? Well, there is! It’s pattern matching!

This talk will focus on the basics of pattern matching, both how pattern matching works and why we might want to use it to simplify our code structure.

First, we will walk through an example of a simple pattern match and take a look at how these concepts can be applied in a larger codebase.

Then we will refactor by taking a look at a function that utilizes multiple conditionals and walk through how to implement pattern matching in a step by step process. We’ll also discuss why refactoring to pattern matching can improve codebases.

Lastly, we’ll discuss the pros and cons of utilizing pattern matching in different situations you might see in a large codebase. By the end of this talk, you’ll have added pattern matching to your toolbox to wield with confidence.

Talk objectives:

  • Help teach the basics of pattern matching. How to code pattern matching from scratch as well as how to turn multiple conditionals into a pattern matched function head.
  • We’ll also discuss the why. Why this work is important to the health of a codebase as well as some of the pitfalls that pattern matching to the extreme can cause.

Target audience:

  • This talk would appeal to newer programmers or newer to Elixir programmers.

Audience:
Introductory and overview

Tags:
Patterns,Refactoring