Log In
Join
for free
Back To Course Home
Designing Elixir Systems with OTP
0% completed
Building Our Project in Layers
Who Should Take this Course and Why?
Introduction to Building Projects
Reimagining Design Choices
Choosing Our Layers
Thinking Before We Start
Beginning with the Right Datatypes
Creating a Mix project
Building Our Functional Core
Establishing Our Boundaries
OTP, State, and the Functional Core
Testing Our Code
Planning Our Lifecycle
Invoking Our Workers
Summary: Building Our Project in Layers
Quiz: Layering System for Designing Applications in Elixir
Knowing Our Elixir Datatypes
Introduction to Datatypes
Primitive Types
Lists
Streams
Maps and Structs
Uses of Maps
Map Traps
Strings
String Representation in Elixir
Tuples
Functions as Data
When to Leave Elixir
Summary: Knowing Our Elixir Datatypes
Quiz: Data Types that Underpin Elixir
Starting With the Right Data Layer
Introduction to the Data Layer
Access Patterns Shape Data Structures
A Different Approach
Immutability Drives Everything
Functional Data Structures
Creating Our Mastery Project
Identifying the Data of Our Project
Identifying the Data of Our Project—Continued
Summary: Starting with the Right Data Layer
Quiz: Data Layers in Elixir
Building Our Functional Core
Introduction to Our Functional Core
Organize Core Functions by Purpose
Commencing Our Quizzes
Functions are Data
Naming Concepts with Functions
Composing a Quiz from Functions
Building Single Purpose Functions
Building at a Single Level of Abstraction
Moving Our Tokens Through Transformations
Keeping the Left Margin Skinny
Trying Out the Core
Summary: Building Our Functional Core
Quiz: Building Functional Cores
Testing Our Core
Introduction to Writing Tests
Simplifying Tests with Common Setup Functions
Improving the ExUnit Infrastructure
Providing Test Data with Fixtures
Building Our Quizzes
Using Fixture Functions Directly
Prime Tests with Named Setups
Applying Named Setup Functions to Our Tests
Making Tests Repeatable
Making Tests Repeatable—Continued
Composing Within Tests
Testing Our Quiz
Taking Tests Beyond the Elixir Base
Summary: Testing Our Core
Quiz: Tests for the Functional Core
Isolating Process Machinery in a Boundary
Introduction to the Boundary Layer
Maintaining Composition Through Uncertainty
Treating Errors as Data
Reporting Successes and Errors
Using with to Compose Uncertain Structures
Building Our Optional Server
Blueprint of Our Boundary Layer
Implementing the QuizManager with Processes
Adding More Functionality to the QuizManager
Trying Out the Quiz Manager
Laying Grounds for QuizSession Implementation
Implementing QuizSession
Test Driving the Quiz Session
Wrapping the Server in an API
Validating Our Quizzes
Validating Our Templates
Building the API Layer
Test Driving the API
Call over Cast
Configuring Options
Extending our APIs Safely
Summary: Isolating Process Machinery in a Boundary
Quiz: Boundaries and GenServers
Customizing Our Lifecycle
Introduction to the Lifecycle Layer
Understanding the Lifecycle Building Blocks
Elixir Functions to Manage Processes
Starting Processes with Links
Configuring Applications to Start Supervisors
Creating a start_link
Configuring the Application
Additional Options to Manipulate Supervisors
Starting Per-User Processes with a Dynamic Supervisor
Adding a Start Link
Using Names to Find Services
Adding the Registry and Dynamic Supervisor to application.ex
Establishing Supervision Strategies
Observing It
Running with Multiple Users
Summary: Customizing Our Lifecycle
Quiz: Supervisors and the Lifecycle Layer
Invoking Our Workers
Introduction to the Worker Layer
Knowing Our Motivations
Leveraging Workers in Dependencies
Making Serial Code Concurrent with Tasks
Building Pools of Common Resources with Poolboy
Adding a Proctor to Run Timed Quizzes
Writing the Proctor Boundary Server
Laying Grounds for the Proctor Boundary Server
Completing the Implementation of the Proctor Boundary Server
Integrating the Proctor into the Boundary — QuizManager
Putting the Proctor to Work
Summary: Invoking Our Workers
Quiz: Workers and Services with Concurrency
Assembling Our Components
Introducing Persistence
Adding Persistence as a Boundary Service
Managing Persistence with Callbacks
Building a Poncho Project
Persisting the Responses
Establishing an API
Building Our Postgres Table
Integrating MasteryPersistence into Mastery
Integrating a Function to Persist Records
Integrating Our OTP Dependencies into Phoenix
Integrating Our OTP Dependencies into Phoenix—Continued
Organizing Code for OTP Abstractions
Adding Layers to Phoenix Channels
Adding Layers to LiveView
Building Scenic Projects with Layers
Summary: Assembling Our Components
Quiz: Making Different Dependencies Work Together
Testing the Boundary
Introduction to Testing Our Boundary
Tests Call the API as a User Would—Setting Up
Tests Call the API as a User Would—Helper Functions
Running the Test for Our API
Testing Poncho Projects Directly
Isolating the Proctor’s Boundary Concerns
Modifying the Boundary of the Mastery Project
Adding Notifications to Mastery and the Boundary
Working with the New Notifications
The Final Test for Our Quizzes
Summary: Testing the Boundary
Quiz: Writing Tests at the Boundary Layer
Summary: Starting with the Right Data Layer
A recap of what we've learned so far.
We'll cover the following
Choosing our data structures
Functional programming
Pros and cons of some data structures
Creating our Mastery project
Get hands-on with 1400+ tech skills courses.
Start Free Trial