Notes from Thomas Fisher

Elixir in the Trenches

By on in Development, Elixir

At Carbon Five, we’ve been getting excited about Elixir and Phoenix – with its promise of the productivity of Ruby and Rails without the performance penalty. We’ve used it for a few of our internal projects with great success, but we’re always wary of any new technology’s hype cycle. We wanted a bit more experience working with Elixir on a real project.

We recently had the opportunity to do so. The project was an iOS application that made heavy use of the device’s location services; users can share where they are and what they’re doing. We needed a backend for an API, and to keep all connected clients up-to-date. From the start, Phoenix and its channels seemed like a great fit. Today, we’d like to share some of what we learned.

Continue reading …


Special Processes in OTP

By on in Development, Elixir

On a recent Elixir project, I needed to test some asynchronous behaviour. Doing so led me to learn about the basics of special processes in OTP.

Our project was using Phoenix Channels and had a need to keep track of all connected socket processes. We could have used the upcoming Phoenix presence feature, but we didn’t quite need all of its features. We settled on using a simple GenServer process that would monitor each connected socket.

Continue reading …


Concurrent Acceptance Testing in Elixir

By on in Development, Elixir, Web

If you’ve practiced Test-Driven Development, you know that fast-to-execute tests are more than just a nice-to-have. As suites get slow, developers run them less often locally. Failures start to crop up in the CI environment, and the length of time between a breaking change and its detection increases.

The problem gets worse with acceptance tests. Since they execute in a browser, they’re slower to begin with and significantly more brittle. But with these negatives come a huge benefit: since they interact with your application in the same way a user does, they give you much more confidence that your system is working than isolated unit tests.

Running tests in parallel can sometimes help speed up tests, but doing so comes with its own set of issues. As with any concurrent code execution, global state can cause intermittent failures. In particular, very often tests rely on making changes to a database. These changes can easily leak from one test to another, causing havoc.

The upcoming release of ecto has a interesting new solution to this problem. It offers a connection pool built on the db_connection library, which provides a module named DBConnection.Ownership.

Continue reading …


WebRTC Made Simple

By on in Web

WebRTC is a set of JavaScript APIs that enable peer-to-peer, realtime communication between web browsers. It offers some pretty amazing capabilities, but getting through even a basic introduction to it can be daunting. The variety of new APIs and protocols is a lot to digest. This post is a simple guide to getting up-and-running with WebRTC.

pushrtc

Continue reading …


AngularJS Scopes: An Introduction

By on in Web

[raw]

At Carbon Five, we build quite a few AngularJS projects. It’s a fun, powerful framework that gets you up and running quickly, but once you’ve got your feet wet, you run into its infamous learning curve. AngularJS has a fair share of deep concepts; taking some time to understand them can get you back on track.

One of these important concepts is scopes. In an AngularJS application, the controller and view share an object called a scope; this object is at the core of its amazing two-way data binding. The controller sets properties on the scope, and the view binds to those properties. AngularJS takes responsibility for keeping the two in sync.

Continue reading …