YAGNI

This morning my computer crashed. So I rebooted it. I was in the midst of a project that had a lot of git branches (as I was working on competitive ideas to see which version would work best), and I couldn’t recall which branch I was on.

I thought it would be a good time to update my .bashrc file to perhaps add a git status to my bash prompt. Afterall, there are some pretty nice prompt string hacks for git out there.

And so I started to edit my .bashrc file. I opened it, and I discovered that I have over 20 aliases and functions that I created, and I haven’t used any of them in the last 2 years. Heck, over the years, I even went from a colourful prompt to a black and white prompt!

I used to have fancy dotfiles for most of my things, but now I use mostly default stuff. It makes portability much easier – I can work on any station without having to bother much about the configs.

I think the YAGNI approach works best. You Ain’t Gonna Need It when it comes to adornments for your computer. All you need is to be able to do work without extra distraction. Of course an argument could be made that having your prompt show your git status makes it unnecessary for you to git status everytime you start afresh on a new project. It really depends on how much time you have saved. The tradeoff for me constantly knowing my git status is not worth it.

What was worth it for me? This piece of code in my .bashrc file:

# http://stackoverflow.com/questions/21160386/trigger-a-command-when-cding-into-a-directory
function workspace_cd() {
    cd $@ && [ -f ".bashworkspace" ] && source .bashworkspace
}
alias cd="workspace_cd"

Other than that, nothing from the custom alert functions to the shortcuts for extracting files (turns out I just type tar -xzvf all the time anyway) were particularly used.

So I truncated my bashrc file to something like 50 lines. And… that’s enough yak shaving for the day.

comments powered by Disqus