Thoughts on software craftsmanship.

Tips for Naming

Naming things is famously one of the two hard things in computer science. The humor in this adage derives from the fact that naming seems like it should be easy. And yet, most of us can relate to the importance and difficulty in coming up with good names for objects and concepts in our code.

Continue reading...

Using Ecto Schemas with Database Views

Database views are a great way to provide a simplified abstraction over complicated data logic. They provide a way to treat a complex query as if it were a simple table, and with no extra work, you can build Ecto schemas on top of database views to bring the power of that abstraction into your Elixir code!

Continue reading...

Elixir In Action

I just finished Saša Jurić’s excellent Elixir in Action published by Manning. I’ve been learning Elixir for about six months now, having learned the basic concepts and syntax from Dave Thomas’s Programming Elixir, which is a great introduction to writing Elixir. But I still lacked an understanding of how to build with Elixir, specifically how to create, structure, and deploy OTP applications, set up supervision trees, and leverage the power of concurrency and distribution. That’s where Elixir in Action was the ideal next step.

Continue reading...

Optimize for Deletion

I just watched Greg Young’s talk The Art of Destroying Software. It’s a compelling, unconventional argument for changing the way we write code to maximize our ability to delete it. Young’s rule of thumb is 1 week: don’t write any self-contained part of your system that would take more than a week for someone unfamiliar with it to rewrite from scratch.

Continue reading...

Coders At Work: Reflections on the Craft of Programming

I’ve recently worked my way through Coders At Work: Reflections on the Craft of Programming, Peter Seibel’s oustanding collection of interviews with some of the industry’s most experienced programmers. Published in 2009 but featuring practitioners who’ve been working for decades, it’s full of wisdom both current and timeless on the craft of building software. Here are some of my favorite ideas from the book.

Continue reading...

Testing current_user In a Phoenix App the Easy Way

One of the things that’s drawn me to Elixir is how well it lends itself to test-driven development. But while testing a controller action in an Elixir application using Phoenix, I ran into a problem familiar from Ruby/Rails: how to test a controller action that requires authentication, i.e. that requires a current_user present.

Continue reading...

Simple Made Easy

We need to build simple systems if we want to build good systems.

—Rich Hickey

I’ve been rolling Rich Hickey’s talk, “Simple Made Easy,” around in my head for a while. At heart, it’s about how to write simpler software, which we all want to do, right? But our software and systems somehow end up complicated—buggy, hard to learn, and hard to change. The reason, Hickey suggests, it because we fall into the trap of mistaking simple with easy. Before his talk, I’d considered them synonyms, but the difference is crucial.

Continue reading...

The Senior Software Engineer

I’ve been building websites professionally for about 10 years now, and for most of my career have focused on getting better at writing clear, valuable, maintainable code. In many of my roles, I’ve been the sole developer on a project, so that was the best I could do. But since joining Lessonly and working on a growing team, I’ve come to realize that there’s only so much a single developer can do, and that by empowering my team, I can produce better, more lasting work than I could just by putting my nose to the grindstone.

Continue reading...