Wednesday, April 29, 2009

Maintenance Mode

After a vacation, you really need some time off.

So I'm not going to talk about computer programming today.

In computer programming, we have two modes of operation - maintenance of what we have so far and creating new features. Maintenance is about fixing bugs in the code, updating the documentation and every other task that we programmer love to hate. Creating new stuff is cool. That's why we started programming - to create stuff. We like to create stuff, we hate to support it. Kind of like parenthood, I would guess.

Too bad for us. We can't avoid maintenance mode (unless you happen to be a consultant or something). You really shouldn't add new features until you get rid of the major existing bugs. And the same thing is true in life - the caveman, sorry, cave-person, didn't have time to invent the wheel until he had food in his belly. Hungry men don't create things - they look for food.

Just as in programming you need to constantly fix bugs to maintain the quality of an evolving product, so too must you constantly maintain your body and mind before you start to improve yourself. There are the usual things:
  1. Brush your teeth at least twice a day
  2. Eat & Drink
  3. Sleep
We all do the above to maintain our body at the most basic level. After that, we have to maintain our house:
  1. Wash the dishes
  2. Do the laundry
  3. Clean the house
  4. ...
At a higher level still, there are more maintenance jobs:
  1. Exercise at least three times a week
  2. Spend time with our loved ones
  3. Do something unrelated to anything - see movies, read novels, go hiking in nature, ...
These maintenance jobs are the most important so far, but they can't be done very well unless we finished our other tasks. In particular, everyone acknowledges that exercising regularly is very important, but too many people don't actually do it. And spending time with our significant other is so important that I'm actually willing to use the stupid term "significant other".

I think I covered most of the maintenance tasks so far. Now, before I finish, I'd like to point out that I'm not a native English speaker, and I remember hearing that it's bad to use the same word over and over again. While I didn't bother looking for a substitute for "maintenance", mainly because I didn't get the spelling correct on my first try, I did intentionally avoid a synonym for "job" - the word "chore". This isn't because my wife would be offended if I said spending time with her is a chore, but because I really don't think of these tasks as chores. They are a minimal set of things we need to do to keep what we have so far. The higher up we go, the more fun these tasks are.

Finally, the last form of maintenance is:
  1. Create something new. Challenge yourself each day.
This fights stagnation. We have to move forward. And it isn't really about maintenance, but it's good to force yourself.

Note also that I didn't put work anywhere up there. If your job goes up somewhere on your maintenance list, find another job.

Now, where did I leave those extra 10 hours a day...

Tuesday, March 24, 2009

Vacation

I'll be on vacation with little or no internet access until April the 18'th.

No internet and no cellphone is really the only way to have a real vacation these days...

Monday, March 16, 2009

Running a program on a server after logging off

At work we have a pretty powerful server on which we run computationally intensive programs. Many times, I want the programs I execute to continue running after I log off. This is how to do it:
screen -S blah
run_my_command
Ctrl+a d

I can now log off and go home. The program will continue executing safely.

The following day, I log back to the server and type:
screen -r blah

I'm now back where I was.

Sunday, March 15, 2009

Language Verbosity

I recently took a look at the upcoming C++0x specification, and I was annoyed that yet more keywords were introduced into the language. C++ is already a very complicated language, and it takes months and years to truly master. I just didn't think that introducing more keyword would advance the language. In some sense, the size of a language's vocabulary is a measure of the language's complexity.

My concern is that as the technology advances, it will become increasingly difficult to be proficient even in one single language. The learning curve just becomes steeper and steeper with time, which is fine if you're there when they make the curve steeper, but not if you're at point zero. And I know that specialization happens for all sciences as they advance, but programming isn't a science and a programming language is a tool, not a science (from the user's point of view).

Natural languages (such as the one you talk to your mom with, I hope) are not like that, however. Their vocabulary size increases with time, regardless of the language. Unless your language of choice is Newspeak, of course. Another curious fact about human languages is that they allow one to learn the language, using the language. This might not be too clear, so I'll illustrate:

John Robert Jr IV is 6 years old. His parents speak English (not American, mind you). Little Robert can't understand everything his intellectual parents say, but, by the time he starts his studies in a snooty British college, he'll have already mastered the language. How did this happen? Little Robert doesn't know any other languages but English!

The answer is that one can use English to learn English. This happens because you can understand snippets of code, er, words, and understand the rest from the context and the non-verbal information (intonation, body language, ...). In addition, there are always several ways of saying anything, at different levels of complexity. There are synonyms for nearly all words, some down-to-earth, others only for people with a PhD. in Literature. This is how Robbert will slowly learn new words which better articulate what he wants to say.

Sorry, but we really need to get back to programming languages.

Programming languages are like that as well. C++0x may introduce many new constructs, but you don't really need to use them. When I started programming in C++, I simply changed the file extension to .cpp and continued programming in C. I eventually started using the object-oriented facilities, and after that started learning what the STL really has to offer. So I think there's room for hope. Having different ways of saying the same thing, some concise, some verbose, is actually a good thing.

This is one of the clashing points of two of my favorite languages - Perl and Python. The Perl philosophy is that there should be many ways to perform the same task. Python believes there should be one (see The Zen of Python). And the thing is that Larry Wall studied linguistics. The language he devised may be a write only language, but the basic idea of having many different ways of expressing yourself doesn't just give you the opportunity to make yourself clearer, it also makes learning the language easier. You can learn new tricks as you go along, but it doesn't block you from getting what you want done.

Of course, the above isn't really true for Perl, unless you can remember what $x is for any x, but the potential is there.

Sunday, March 1, 2009

And Then There Were Two

I have decided to split this blog in two. All the programming related posts will remain here. The Origami posts will move to their new home at: http://origamitips.giladnaor.com

I hope this will allow me to better concentrate on each subject. Good week!