Software development efficiency: building your own development environment

Let’s build your new development home

Some years ago I was using Ubuntu. It was easy to install and easy to use. I mostly used Windows in my computing life and Unity was feeling similar. At least to me.

It was not perfect though:

  • Weird display bugs was popping from time to time.
  • I always felt Unity pretty slow.
  • I had to compile manually a lot of applications not available in the official repositories.
  • I had to compile manually a lot of applications totally outdated in the official repositories.

I didn’t know better so I stuck with it for years.

Then something happened. I had to upgrade my LTS version.

Everything crashed. I couldn’t even boot Ubuntu anymore. Since I had no clue about Linux in general, I didn’t even try to fix it. I had to reinstall everything.

I began to feel some bitterness toward Ubuntu.

Later on and luckily enough I met competent colleagues who showed me most of the applications I will show you today.

My whole workflow shifted from there. I went from Ubuntu to Arch Linux, from Unity to i3, from PhpStorm to Neovim.

After years of silent struggle I finally had a personalised, stable, up to date and very efficient system. I even wrote a bunch of scripts to install everything I need in one command line!

It was one of the best shift I did in my career. No more, no less.

Let’s be clear: I think your development environment is much more important than most developer think. You need to feel at home, comfortably on your couch. You will feel more efficient in a system you built. Which answers your needs.

Developing will be even more enjoyable.

Interested? Come with me. I will help you build your new home for your future mind-blowing-disrupting-crazy applications.

Shell based system: fast and powerful

linux shell Simple et efficient shell

In this article I will refer to the unix shell pretty often. There is more than one specific shell for Unix systems though. I personally use zsh and I would highly recommend it.

So, why using the shell?

  • You have access to a lot of applications. It’s definitely easier for developers to build text-based program without GUI.
  • The applications are often really fast. No heavy graphical interfaces full of 3D menu and whatnot.
  • The unix philosophy allows you to use specific software for very specifics needs. Using pipelines to use the output from one application to the input of another is really, really powerful.

I encourage you to use the shell as much as possible.

A lot of people will use graphical interface (GUI) on top of shell applications. However my experience shows that it’s not the best to learn how the applications really work:

  • A GUI can hide a lot of functionalities you would access easily with a CLI.
  • A GUI can add a layer of complexity and using its own language.

Things get confusing when you need to:

  • Use the tool on a remote server without your graphical interface.
  • Explain to a less experienced developer how the tool really work. You can explain the GUI, not really the application itself, specially if the terminology between the GUI and the CLI differ too much.

I have a real life example: sourcetree, a graphical interface for git. I worked with a junior developer who was using it without knowing how git works. When problems arose, it was difficult to know what the application did and how it did it under the hood. Way more frustrating than using git via the shell.

I use the shell as much as I can. Not because it looks cool, but because it’s easy and efficient. I promise.

With the shell you use mainly your keyboard of course, that’s why I try to avoid my mouse as much as possible. This is one of the key for efficiency: keeping your hands on your keyboard. It might sound silly but it has a lot of advantages:

  • Moving your hand from your keyboard to your mouse is tiring. You will see it if you stop doing it.
  • It’s more enjoyable to stay on your keyboard. You don’t have to switch constantly between typing and moving a pointer.
  • You will feel like a hacker even if you only write your shopping list! How cool is that?

I know, I was suspicious at first. Maybe like you, now. I can’t deny it though: I enjoy much more programming since I only try to use my keyboard in the shell.

Arch Linux: use the latest tool and technologies

arch linux screenfetch Arch Linux running smoothly on a VM

Arch Linux has a lot of advantages compare to other Linux distribution.

First of all: Arch Linux use a rolling release system. It means that the whole system is continuously updated by the community. This include the Linux kernel and every applications available in the repositories you have installed.

This is great: no need to ask yourself if you miss great features and bug fixes for your favorite applications. You will have the most up to date system you can find.

What about the applications available? The official repositories of Arch Linux are huge. You will find most of the time what you need there. If you don’t, you can have access as well to the AUR (Arch User Repositories) where you can find everything else. I’m not exaggerating.

Be careful though: the applications from the AUR are not always well tested and can break dependencies. Proceed with cautions. I’m actually using aurman to install applications from the AUR since it uses pacman for everything which is not AUR related. No need to switch between pacman and aurman, using aurman for everything works well.

No, pacman is not a yellow cheese addicts to pills in dark rooms but the package manager of Arch Linux. PACkage MANager. Everything falls into place.

Moreover when you install Arch Linux from scratch you can choose exactly what application you want to install. Nothing unwanted will pollute your hard disk. No useless applications will run in the background without your consent.

Installing your system from scratch can look tedious but it’s really not that bad. If you know how to use a shell, you’re good to go.

If you want to learn a bit more about Linux, here’s your chance.

I can see you arguing though. Who wants an exotic Linux distribution with a tiny community and therefore no help when you have a problem?

Arch Linux is everything except that. The community is huge, know what they are speaking about and don’t throw random shell commands on stack overflow without explanation whatsoever (I look at you Ubuntu people).

Who needs stack overflow anyway? The Arch Wiki is the best resource you can find on the web about Linux. Every single problem I had was solved in there. I’m still not exaggerating.

Now the question you ask yourself: is Arch Linux stable? Will it crash every two weeks, letting you alone and helpless? You will find people preaching it for sure. My advise? Don’t listen to them. I use it on a daily basis for almost 2 years now and it never crashed.

If you are careful with the AUR you can count on a very robust and lightweight and personalised Linux distribution.

However I’m still careful. Here my workflow: I backup every week my whole SSD on an external hard drive using dd. I wrote a little script (dback for “disk backup”) to make it even simpler.

Then I upgrade my whole system (aurman -Syu or sudo pacman -Syu if you don’t have aurman). Sometimes pacman will ask you to do some manual modifications which is always documented on the official website of Arch Linux. It’s never difficult (like deleting a file or answering a question).

Finally and for inspiration I wrote a bunch of scripts which install my whole system from top to bottom with the applications I need. I can run that on a new computer and everything I need will be installed automatically.

I would advise you not to use these scripts without knowing what you’re doing. Try to install manually Arch, learn from it and then you will be able to do your own scripts. Arch Linux is great to have a personalised system. You should build yours according to your specific needs and then automate the process.

i3: a very efficient windows manager

i3 windows manager i3 windows

Arch Linux doesn’t come with any type of desktop or windows manager. You will need to install your own. My choice: i3 windows manager.

This is a very light, fast and simple windows manager. There are no fancy 3D effects with i3. Everything is made for you to be efficient and productive without being visually repulsive.

With i3 you can create workspaces. They take a whole screen and can be moved from one screen to another. In these workspaces you can open one or multiple windows. They will embed your favorite applications.

Simple, isn’t it? Now the best part: you can do everything with your keyboard very easily. You can open, move and close workspaces or windows with simple keystrokes. You can resize windows with other keystrokes. You can open your favorite application using keystrokes.

Everything feels logical and easy to learn. I was able to use i3 efficiently two or three day after installing it. Your muscle memory will work for you here very quickly to remember the keystrokes you need to know.

The configuration possibilities are really wide for you to use it according to your specific needs. You can look at mine for inspiration. You don’t have to write all the configuration by yourself: i3 provide you a base configuration you can then modify.

You can even install it on side if you use Ubuntu. You then have the choice between i3 and Unity each time you log in.

Obviously the Arch Linux wiki has an good documentation about i3.

Urxvt, Tmux and Tmuxp to manage as many terminal as you want

tmux Tmux in Urxvt with 4 panes open and two windows

I tried a bunch of terminal emulator and Urxvt was the best choice I found.

It’s a very lightweight and fast terminal, especially if your run Urxvtd, Urxvt daemon. Spawning terminals everywhere become easy and painless.

However I’ve rarely more than two or three terminals open at the same time thanks to Tmux. It’s a powerful terminal multiplexer (like screen on steroids) which allows you to:

  • Create sessions which include windows and pane.
  • Open as many windows in your terminal as you want. Each window take the whole terminal and can be divided into pane. You want 3 windows with 4 pane each (for a total of 12 different shells open)? tmux can handle that easily.
  • You can navigate between windows and pane very easily, again via keystrokes.
  • Detach and attach your session. Imagine you close your terminal by mistake: you can recover your whole tmux session by opening a new terminal and attaching your session to it.
  • Synchronise your pane. You need to run exactly the same command in three different remote server? Open three panes, synchronise them with one command and everything you type in the first pane will be copied in the others.
  • Many more things I don’t even know about yet.

With tmuxp you can even go further to automate your tmux sessions. Indeed you can write a configuration file to open the windows and panes you want and automatically launching applications in them.

Let say that in order for you to work on your new cool project (which will make you rich) you need to:

  • Run docker compose in a pane.
  • Run npm run dev inside one of your docker container in another pane.
  • Open an ssh connection to your production server in a different window.

tmuxp allows you to do all of that with one command line and a simple configuration file.

Obviously tmux is easy to configure but offer you a lot of options for a maximum of flexibility.

I used terminator for quite some time. I was happy with it but I have to admit: the combo Urxvt, tmux and tmuxp is definitely faster, more practical, automatic and versatile. Without any doubts.

An IDE which fits exactly your needs

This IDE is Neovim, an incredible fork of Vim.

i3 windows manager This article was written in Neovim

Don’t run away yet! I know you are afraid. Let me explain why you should really try to rethink everything you know about Vim.

I already wrote about Vim multiple times so I will only summarize here why I use it:

  • Writing with Vim is great. Try to understand seriously how it works and I promise you will be surprised.
  • You don’t need any mouse with Vim.
  • Vanilla Vim has a lot of functionalities. You always learn something new.
  • Vim has a very good community which maintain a lot of plugins. They should cover 99% of your needs. In any language. JavaScript, Golang, PHP, you name it.
  • Everything is highly configurable. Forget bloated preferences, here you just fine tune everything you want.
  • You are not restricted to any language. You want to code in Rust, Go and C with the same editor with autocompletion, syntax highlighting and so on? Vim is perfect for that.
  • No more notifications appearing out of nowhere to break your flow (I look at you Intellij IDEs). You choose exactly what you want.
  • Instead of having an IDE full of stuff you will never use, you can build your own only with what you need.
  • It’s free.

Suspicious again? I was as well before trying it. A lot. However since I use it I never looked back.

Nice tools for git: tig and diff-so-fancy

tig tig: on top the branch hierarchy, on the bottom you can see every change made

diff-so-fancy diff-so-fancy is very nice to see quickly everything you modified

I think git is very easy to use in the shell when you understand how it works. Basically you need on a daily basis to use:

  • git push
  • git pull
  • git branch
  • git checkout
  • git merge
  • git rebase

Do you really need a bloated GUI for that? If you use git in the terminal you will know exactly what you are doing.

The first tool I use with Git is tig. It allows you to go through the git branch hierarchy and see the details of each commit you made.

git-so-fancy display git diff in a very readable way in your terminal. I always use it to verify what I commit before actually committing it.

I think with these two tools you can use git efficiently. The best part: they are both available in the official Arch Linux repositories.

Ranger, a nice file manager

diff-so-fancy Ranger with image preview in the terminal

I usually use the shell to do any operations on files. However when I need a proper file manager I use Ranger in the shell.

You can configure keystrokes for your favorite folders, execute some command lines on a bunch of files… The possibilities are really huge. You can even configure keystroke to automatically jump to your favorite folders.

Better CLI for MySQL and PostgreSQL

If you need a quick and practical interface in the shell to interact with your database, I would recommend mycli for mysql and pgcli for PostgreSql.

These tools look a lot like MySQL and PostgreSql CLI on steroids:

  • The autocompletion is way, way better.
  • You can use snippets you can configure easily.
  • You can configure different database connections.

I didn’t find a way to use it through ssh. Nevertheless for my local databases these applications are practical.

In order to install them on Arch Linux you will need to fetch them from the AUR.

Your development environment is ready!

diff-so-fancy My personalised system

Efficiency and versatility: these are the two main reasons why I’ve chosen to build and configure my entire web development environment.

This set of application is pretty easy to maintain and will evolve very well as your needs change. You won’t have to reinstall everything all the time.

This kind of environment asks for a bit of time and efforts to setup and understand. Really a bit, a couple of weeks. Then you just have to automatize everything (as a good developer should do) and you will have a very personalised development environment. You will feel in control of it. You will feel at home.

The learning curve is not hard. It can be challenging but most important: it’s fun and it’s interesting. Trust me.

Don’t listen to people who never tried Vim saying that’s it’s the most complicated thing on Earth. Don’t listen to them arguing that Arch Linux will crash even more than Windows 95. They never used Arch Linux most of the time.

I know what I’m talking about. I was one of them.