Wednesday, August 31, 2011

Tools of the trade

Warning: this will be another one of my technical posts.

As an electrical/firmware engineer, there are a number of tools that I use on a daily basis that are indispensible to my trade.  Today I wanted to post a quick list of my favourites, with perhaps future posts going into more detail.

  1. Numero uno has to be Vim, otherwise know as “the best text editor in the world”.  Now I have only been using Vim for a little more than a year, but  it has changed my life.  Ok, perhaps that is going a little overboard, but quite honestly, if you have a year of your life to devote to learning a text editor, there is no better candidate than Vim.  If you have tried it and just don’t grok it, then read the first answer to the following question.  What is my favourite command?  “gg=G”.  Just awesome.
  2. Number two is Mercurial.  This tool is for revision control, and it absolutely beats the pants of the “official tool” I am supposed to use.  Revision control software allows you to take “snapshots” of your code so that at any time in the future you can recreate anything you have done in the past.
    For example I can type “hg update v1.1” at a command line and instantly all the files in my coding product are exactly as they were when we released version 1.1 of the software.  Type “hg update v2.0” and again all the files are updated to as they were when version 2.0 was released. 
    Mercurial is one of the new breed of revision control tools known as “distributed version control” which is in contrast to the previous breed known as “centralized version control”.  Again like with Vim, I have drunk the proverbial kool-aid.  I have been won over to this new paradigm.
  3. I will end on number 3 which is Python.  No not the animal; Python, is a programming language, named after comedy troupe Monty Python.  Python is a member of a class of languages often referred to as scripting languages. 
    On a day to day basis, I would estimate that more than 90% of my programming is done in a completely different language called C, with perhaps 10% or less done in Python.  Notwithstanding, the more I learn about Python, the more I am blown away with the simple elegance and the sheer power of the language. 
    Having a scripting language in my tool belt has made me more productive and honestly opened my eyes to what is possible.  For example after learning Python, I was able to write a utility in about 150 lines of code that analysed the output of my C compiler, calculated the execution time of each assembly instruction and then produced an annotated file which contained timing information for each line of assembly, each line of C, and each C function.  Fantastic information to know when you are trying to understand the efficiency of your compiler and optimize the code to improve performance. 
    Ignoring the fact that the equivalent utility written in C would have taken probably 2000 lines of code, my mind simply wouldn’t have known where to begin using C, while with Python a relative novice was able to produce the utility in only a couple of days.  Incredible stuff.

No comments: