CS371P #10

Time flies when having fun. Only 4 weeks left in my first semester back in school. It’s been fun in every way. A little more challenging than I expected. I am fortunate to have the opportunity to go back to school. Most people don’t get the chance even if they want to.

It was interesting reading the Joel Test last week. I worked in one company where we did everything right including all 12 of Joel’s bullets. On the other hand I worked for one company where it was a struggle to get the owners to support us in trying to do even half of those things. Needless to say it was a much more rewarding experience to work in the company where we were allowed to practice good engineering. “Flow” was a big deal and we made efforts to keep things nice and quiet.

With regard to having candidates write code during the interview process; I’ve never asked anyone to actually write code but would certainly ask enough questions and discuss programming in order to properly assess someones qualifications. However I did at one time ask candidates to take this guru quiz. It’s pretty dated now but still interesting.

Tab stops & indenting

Coding styles have been and will be debated ad nauseam. But agreement on tab stop settings must be reached. All developers (of a code base) need to agree on tab settings (in their respective editors) for the code base or things can get ugly pretty quick.

If you look at it there are really only 3 options: 1 is not enough, anything greater than 4 is too much. That only leaves 2, 3 or 4.

The next thing to consider is whether to use tabs or spaces. It’s tempting to want to use tabs since it seems the logical thing to do. But there are issues. For one thing if you have tabs in your file then when you use cat, more or less on a source file then you have a completely different set of programs interpreting your tabs and doing so differently from what was intended. Different terms and shells can treat tabs differently. These issues beg for expanding tabs into spaces.

For vi: in your .vimrc you can just have

set expandtab

and it takes care of converting a tab into the proper number of spaces, which is set by

set tabstop=4

However a quick google on the subject reveals plenty of debate with arguments both ways.

2 more related options in vi worth mentioning;

set ai sw=4
set smartindent

Ok so I just Googled to remember exactly what these 2 options do in vim and I quickly realized that there’s much more to the story and I’m not about to go into all of it. This looks like a good explanation http://vim.wikia.com/wiki/Indenting_source_code