Imarc

Linux is for Artisans Kevin Hamer

Written on: January 29th, 2016 in engineering

Every year, Stack Overflow’s Developer Survey shows about 20% of developers run linux (about the same as the number of developers who run OS X). At Imarc, a third of the engineers run linux distributions.

But… web developers don’t typically need to compile code. We all have high-end hardware and we don’t have some oppressive IT department trying to force Windows NT down our throats. We can use the same browsers and text editors on linux that others are using on OS X and Windows.

Why do developers choose linux? For me, it’s because of the Unix philosophy.

“Do one thing and do it well” – Doug McIlroy

This statement is commonly used to sum up the Unix philosophy, but it’s a simplification. Beyond valuing simplicity, the philosophy also values interoperability and modularity. Software should not only be simple and robust, but it should be easy to reuse and repurpose by other developers. This philosophy can be felt in every piece of software built with it in mind. Let’s look at two applications as examples.

Grep

Grep in action.

Grep searches lines of text.

It’s a simple app. It’s small. It’s fast. It does one thing and it does it well.  I’ve used grep dozens of times in the last week alone to search through source code and logs. I can even use it remotely over SSH.

Most importantly though, it’s modular; it’s designed to be used with other applications too:

  • Composer and vim both use grep.
  • I use grep in scripts to determine whether I’m in the office (grep tests whether a certain type of IP shows up in the output of ifconfig).

Any time I have a bunch of output or text to read, I can filter it with grep to just the parts I care about.

Dmenu

Dmenu let’s the user pick a line of text from a dropdown, similar to the Windows start menu, OS X launchpad, or Goto Anything (Ctrl+P) in Sublime Text.

Dmenu started as an app for dwm (Dynamic Window Manager), but it’s used for all kinds of things now. I use dmenu to launch applications like you might use Launchpad in OS X or the Windows start menu. Again, it’s simple, small and fast. I use dmenu dozens of times every day.

And again, the real value in dmenu is that it’s modular:

  • I use dmenu to quickly switch projects I’m working on.
  • I use dmenu to quickly open files and lines in file in vim, like Goto Anything (Ctrl+P) in Sublime Text or Goto Anywhere (Shift Shift) in PhpStorm.

Every time I need to filter through a lot of text, I can use grep. Every time I need to pick from a list, I can use dmenu. I can use these applications  to run other apps or I can have other apps use them. They exemplify the Unix Philosophy.

A multitool versus a toolbox

Sublime Text is currently the most popular text editor around Imarc. It runs fast, looks nice and it works on every computer here. Sublime doesn’t need grep – it can do enough of what grep does. Sublime doesn’t need dmenu either – the command palette powers things like Goto Anything (Ctrl+P) and Goto Symbol (Ctrl+R) to let you quickly pick from a list.

Sublime is like a multitool – it has lot of tools built in. On OS X and Windows, having tools built in is a definite advantage: grep and dmenu aren’t simple to install on Windows or OS X. There are tradeoffs; built in tools can’t be used outside of Sublime Text, and they can’t be repurposed. They’re not modular.

  • Composer can’t use Sublime Text’s search. Composer has to use it’s own search.
  • Similarly, you can’t use Goto Anything to switch between projects in Sublime. If we wanted a quick switcher for notes, we’d have to find some other app (like dmenu.)

Linux is like a toolbox; we can use grep or dmenu whenever we want to without any baggage. If we’re using an editor that follow the Unix Philosophy like vim, we mix and match our editor with whatever tools we want. All of these pieces are designed to work together; I can use all three to do something like:

  • Show me the list of files that reference “BlogCategory” and let me pick some to open in vim.

Consistency

Let’s say you’re on a Mac and use launchpad to launch applications and Sublime as your editor. Launchpad and Goto Anything don’t work the same; they have different rules about how they order and filter the results.

Using dmenu, the two can work the same. Even if I configure dmenu differently for each, both have access to the full feature set of dmenu.

Modular implies interchangeable

Actually, I fibbed; I don’t use grep or dmenu as much anymore. These days, I nearly always use ag in place of grep; ag is a streamlined variant of grep designed for working with source code. Similarly, I’ve moved to rofi from dmenu.

Ag in action.

Both grep and dmenu work wonderfully. I still have them on my system and use them and because of their modularity, I can switch them in and out easily.

The whole system is a toolbox

Because of the Unix philosophy, every linux distribution is composed of small, modular apps that each do one thing well.

  • I can pick a distribution that’s close to what I want.
  • Apps that seem useful, I can learn thoroughly and repurpose.
  • And if I want, I can replace any apps I don’t like with better ones.

It’s like a guitarist’s collection of pedals, amps and guitars. It’s like a carpenter’s set of tools. The OS becomes a set of your own, handpicked applications for development. It takes work to setup, but the end result is a setup that you enjoy and take pride developing with.

If you want to know more, I’d start with Eric S Raymond’s thoughts from The Art of Unix Programming.

Share:

Let's Talk.