Wednesday, December 30, 2009

Make Amends with Git

I've always been a fan of small, concise commits. I strive to make my commits as small and concise as possible.

However I often fail... Very often I commit and... discover that I yet again forgot to fix a typo. Or remove a blank line. Nothing major. But it's pretty annoying to have every other commit log reading 'fixed typo' or 'formatted code'.

With Git, I don't have this problem anymore.

If I want to add some changes to the last commit, I simply type:
git add somefile
git commit --amend

Tada! I just modified my last commit to include new changes.

The other option I like to use from time to time is the rebase interactive mode. I use it to merge various commits into one. It has more powerful uses (like removing commits entirely) but I never used these (yet).
git rebase -i origin

Of course  you have to use these commits before pushing anything to a remote repository. 


With these these two commands, I can keep my commit log a little bit cleaner.

Sunday, December 27, 2009

Why Katas Work

Musicians, singers and athletes have something in common - they do a lot of practice to become the best. They may have a show or a competition from time to time, but they practice every day.

Martial arts practitioners do katas over and over. At some point it becomes a form of art.

Can the same be done with code? Can you practice to code a certain piece of software over and over until it becomes art? Uncle Bob certainly thinks so. I started doing some katas a few months ago but a question was still nagging me : do they really help me become a better programmer? Does practice matter?

According to The Talent Code, the answer is probably yes.

The book explains how to harness your talent, how to become an expert in your field. And it seems that all world experts, no matter their field of expertise, have spent a lot of time (10 000 hours) practicing. Not just any kind of practice - you can't just play around and hope you'll learn something. There is a concept of 'deep practice'.

There are three parts to deep practicing:
  • Chunk things up - slow things down, do a simple part of the whole
  • Repeat - a lot
  • Learn to feel what you are doing

I think that's what I've been unconsciously doing with katas. I wrote the same application every time. But every time I was improving, basing the next iteration on past experience. I was using more keyboard shortcuts, less code, better idioms to express myself. I was learning from my mistakes and becoming more efficient.

I believe that katas help me to  'deep practice'. It forces me to reflect on what I've done and learn from my mistakes. In the end I believe it helps me to improve.

That's good enough for me to keep doing it.

Friday, December 18, 2009

Switching to the Penguin

Finally it's done.

After months of talking about it, I finally dropped Windows and installed Ubuntu.

I decided to switch because I was tired of reinstalling Windows every year or so otherwise my machine was slowing to a crawl. Plus I mostly use open source software anyway. And I kept installing utilities to help me have a real prompt (I can't live without grep anymore...).

My first impression is that apt-get makes it a breeze to install a new machine from scratch. No need to download all the apps separately like I did on Windows, pretty much everything is one apt-get away.

A very positive experience so far!