Skip to main content

A programmers toolbox

Programmers are artisans.  We are masters of tools... or at least should be.

I see many programmers fail to focus on their tools.  The programmer himself is the most important part of the equation right?  Well, yes, but that doesn't mean tools cannot amplify his or her abilities.

Even the worlds greatest carpenter will be hampered with substandard tools.

There are a set of common tools that every developer should be familiar with.  I am going to focus on C/C++ Unix development but this list is easily translated into other environments.

1. Your editor.
This is where you are going to spend most of your time.  On Linux you have a many choices but every developer should know one of Emacs or Vi.  I'm an Emacs guy so I won't talk about Vi much, and besides... there is nothing your OS can do that my Emacs can't. :)

Editors are highly sophisticated programs with huge arrays of features.  The better you are at running your editor the more time you will save yourself in the long run.

2. Your shell.
Ever time you interact with your OS you are using a shell.  A little bit of shell script can save you hours.  Currently the most popular Unix shell is Bash.  Therefore that's the one we will use.  Bash includes a complete programming language which is perfect for automating systems tasks.

3. Your OS.
If you don't know your operating system them you are really just flailing in the dark hoping things will work the way you expect.  Knowledge of your operating system will help you work faster and help you understand how your code interacts with the underlying hardware.

4. Your language.
A language is more than just syntax.
In addition to its syntax a language has a system of tools, libraries, patterns, and idioms all designed to work together.

Taking C++ for example:
Tools include compilers, debuggers, profilers, static and dynamic analysis, documentation generators, and editors.

Libraries include the C standard library, C++ standard library, standard template library, and boost to name a few.

For patterns and idioms we have a stack of literature which will help you write code which does things the way other developers expect them to be done.  (please refer to Star Trek for an example of communicating in a common language but with no shared idioms)

I firmly believe that no time spent learning these things can be considered wasted.  Even a little bit of extra knowledge in one of these areas can often save hours of work.

We are going to walk through linux from scratch which is the quickest and most thorough way I know to learn how the Linux operating system was put together.  I'll attempt to run the whole process in a virtual machine so that we don't need to wipe out a disk partition.  Hopefully I don't come to regret that decision.

Comments

Popular posts from this blog

Duck typing considered harmful.

I've had a chance to work on a fairly large chunk of Python at this point and have decided that Python (like Perl) is completely untenable at scale.  <rant><rave><drool>  but wait!  I have reasons! Programmers spend most of their time reading code.  We read massive amounts of code.  After we read massive amounts of code we write one... or change one... To make a change to a piece of code you first have to understand what it does and how it interacts with the system around it.  Then we start reading massive amounts of code again.  Anything you can do to minimize the amount of code a programmer has to understand to make a change becomes a huge gain in productivity. Duck typing causes the amount of code you need to read to make a change to grow very large. For example lets look at two functions, one in C++ and one in Python. First in C++ int function(type1 arg1, type2 arg2) {   return arg1->method(arg2); } In this fun...

How big are primes?

So, If we were to calculate the first billion primes how much ram would we need? At the end the primes won't fit in a 32bit integer.  If we store them all in 64bit integers we'd need 8GB. Even if they all fit in 32bit integers we'd still need 4GB of storage just to store the list. Seeing at my little machine has 4GB ram that isn't going to work either. How about just storing the intervals between primes? For the first primes (2, 3, 5, 7, 11, 13, 17) we would store (2, 1, 2, 2, 4, 2, 4) Using a byte for every interval less than 128 and a short for the rest lets us store the first billion primes in just about 1GB.  Now that we can do! Maybe we can do even better though...
C Craft  is a great article about C including discussion on the good, the bad, and why you can't eat just one. Quote from the preface: Let me open with a disclaimer. What follows is an unabashedly opinionated diatribe certain to offend many programmers. Craftsmen inevitably grow defensive of their favourite tools and practices. Rather than respect this natural sensitivity, I will exploit it, shamelessly intensifying the vitriol for attention. I care little whether one applauds or deplores my views; I mainly want my audience to feel compelled to read on. However, I try to be informative as well as incendiary. Whether one finds my statements profound or unsound, whether one abhors or adores my examples, and whether one is amused or bemused by my observations, I hope one leaves wiser.