Phoenix for Rubyists

Phoenix Framework draws heavily upon important foundations in the opinionated web frameworks that came before it, like Ruby on Rails.

Phoenix for Rubyists

Types, Operators & Control Flow

One must crawl before one walks, and it all starts with basic types and procedural logic. Even if you're experienced in a wide range of programming languages, there's going to be a lot of stuff -- even at this basic level -- that may change the way you look at writing code forever.

  • Types, Operators & Control FlowMath & Strings

    There's no getting away from these kinds of things. Eventually you're going to need to work with numbers and text, so we'll start with a crash course in some core APIs (including a dip in the erlang pool) that will make life easy.

    There's a lot of capability here, but we'll stay close to the commonly-useful and pragmatic path.

  • Types, Operators & Control FlowEXERCISE: Projectile Motion

    We'll create a simple program that calculates and object's projectile motion, given a launch angle and initial velocity

  • Types, Operators & Control FlowEXERCISE: String Acrobatics

    We've got a bunch of functions that do various things to strings, but our tests are failing.

  • Types, Operators & Control FlowFunctions

    It stands to reason that functions are really important in a functional programming language. We'll build and work with named an anonymous functions, combine functions together to form pipelines, and even map out some higher-order functions of our own.

  • Types, Operators & Control FlowLunch

    Break for Lunch

  • Types, Operators & Control FlowTuples and Lists

    Often times we find ourselves needing to work with several objects in a "collection", and will need to choose between Elixir's List and Tuple types. We'll compare and contrast tuples and lists, and write a few programs highlighting the benefits of each

  • Types, Operators & Control FlowAssociative Data Structures

    We have two main associative data structures in Elixir: keyword lists and maps. Let's learn more about them!

  • Types, Operators & Control FlowEXERCISE: Building up a List

    Assembling a bunch of items in a list is really fast, as long as we do it in a way that doesn't involve moving existing items around in memory. We'll write two programs, one which assembles a bunch of dictionary words into a tuple, and another that uses a list instead.

  • Types, Operators & Control FlowPattern Matching & Guards

    This modern language feature allows destructed assignment, and is often used in order to define several variants of a function, each to handle a specific scenario. This application of pattern matching reduces what would otherwise be a lot of internal function complexity by huge amounts.

  • Types, Operators & Control FlowEXERCISE: Function Refactoring

    We've got an elixir module that involves some code that could benefit from some pattern matching magic. Refactor the monolith function so all use of if/else are replaced by creating new functions oriented toward handling that specific pattern of arguments.

  • Types, Operators & Control FlowConditionals & Guards

    It's unusual to use if/else in Elixir, because we have some far more powerful approaches to deciding among different branches of code to use. We'll look at the case control flow structure, where pattern matching really starts to shine. We'll also take a look at how guards can be added to case clauses (and other control flow structures) to form even more specific and targeted patterns.

  • Types, Operators & Control FlowEXERCISE: More Refactoring

    We'll refactor some more code to leverage the power of pattern matching and functional control flow tools.

  • Types, Operators & Control FlowWrap Up

    Wrap up for the day