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

Writing Modular Programs

Elixirs module system allows us to define layers of related functions. In this part of the course, we'll explore the concepts of modules, and the ability to reference code in one module from another.

  • Writing Modular ProgramsModules & Three Important Directives

    Modules are just a group of several functions, some of which may be private and some of which may be public. Modules give us the ability to define named functions using the def macro, which offer a few other features that were unavailable in the world of anonymous functions

  • Writing Modular ProgramsEXERCISE: Mission Control

    We've got a set of tests for a couple of Elixir modules that are used to control a space ship. Alter the code to make the unit tests pass, and ensure that you've kept as much of each module's internal functionality private as possible.

  • Writing Modular ProgramsBasic Metaprogramming

    While the use macro is not strictly a directive, it's of particular importance when considering "mixins" for common functionaliy across multiple modules.

  • Writing Modular ProgramsEXERCISE: Extending a module

    The use macro can essentially be used to decorate a module with some code from another