Friday, December 30, 2011

C++ and Automatic Garbage Collection

Programmers know about the mental state commonly referred to as “flow”. In this state, we are most productive, by a significant margin. This state is, of course, not limited to software development, and is well known in most creative pursuits. 
For example, I’m currently writing this article in a program called Scrivener, an excellent writing application targeted at professional writers - the kind that write novels, screen plays, etc. It has a special mode, called “full screen composition mode”, which I’m using at the moment.  In this mode, there is nothing on the screen except a blank white page. There are no formatting buttons, no word counts, no tasks bars, and certainly no talking paper clips. It is completely optimized for doing one thing, and one thing only - writing. Everything else is hidden away.
This Scrivener feature is there to help writers get into “flow” mode.
To enter this mode, you focus, completely, on the task in hand. And such a complete focus is not easy to establish. An incoming phone call, even if ignored, is more than enough to destroy it.

Focus is about saying no to the things which aren’t important right now. 

This is not a new concept, nor was it discovered by Steve Jobs. Learning to focus has been a very important step in Buddhist meditation techniques for thousands of years.
Of course, Scrivener is not the only tool that helps people focus. Another excellent tool more familiar to programmers is vi. This editor is not famous for ease of use, but once the learning curve is overcome, the editor is excellent at getting out of your way and becoming invisible. People report that vi helps them enter this productive zone, and I can attest to this myself.
Some programming languages also help you enter the zone more easily. Remember, getting into flow is completely focusing on a task. This is why for different tasks, some languages are better suited than others, with regard to flow. It is all about what the language chooses to hide from you. For a high level task, Python is probably a better choice than C, because it will be easier to enter a productive mental mode in Python without worrying about remembering to call free().
A great many people claim that the single greatest benefit for programming productivity in recent decades is automatic garbage collection, as seen in managed languages, such as Java and C#. Let’s ignore the fact that McCarthy invented it for LISP way back in 1959. This is an enormous benefit because today programmers focus on writing the code they want, and they don’t have to think about managing memory. The language hides it away.
A great many people, myself included, claim that C++ is a bloated language. They also claim, myself excluded, that C++ is terrible because of the manual memory management. It certainly is a great burden to manage memory manually - it is generally difficult to do correctly and it also makes it harder to enter the precious mental state we all covet, because it’s one more thing to worry about. But it is simply not true for C++.
It is true that in C you have to manually manage memory. It is true that 10 years ago, most people managed memory manually in C++. However, today this is no longer true.  Unfortunately, most Java/C# lovers, C++ haters, miss this fact.
More importantly, they miss out that the Java/C# promise is horrendously broken. Consider the following code snippet, taken from the book Release It  by Michael T. Nygard, page 33:

This Java code has  a bug in it. In this particular case, this bug caused thousands of people to wait for hours and hours for their flight and caused major financial damages to an airliner. 
The bug is that java.sql.Statement.close() can throw an exception. If it does, then the close method of the connection is never called, and a resource is leaked.
In Java/C#, code in the “finally” block has to be managed C-style. But C doesn’t have exceptions, and exceptions complicate resource management by an order of magnitude. Exceptions are critical. Exceptions change everything. There are work arounds in Java and C#, but they are just that - work arounds. They aren’t pretty!

http://www.flickr.com/photos/91256982@N00/4681092063/

The real problem here is that the garbage collector isn’t like a person walking around with a giant garbage can, cleaning up. A garbage collector, in Java/C#  at least, is like a person walking around with a giant plastic recycle bin, cleaning up after scattered bottles. He ignores all those copies of yesterday’s newspapers and the empty tuna cans.
A Garbage Collector should collect all garbage, and garbage is defined as any no longer needed resource. And a resource is not just a piece of memory (with the book-keeping that comes with it). A resource is also a file handle, a DB connection, a no longer needed synchronization lock, etc.
C++ shines here, because C++ has a built in garbage collector that manages all such resources. Yes, you heard that right. C++ has a built in garbage collector. In modern C++, most programmers never, ever, have to write “delete”. The “delete” keyword went the way of the dodo. It went the way of the goto. 
The same mechanism used for managing memory can be used for managing any kind of resource.

Focus is about saying no to the things which aren’t important right now

In Java, resource management is rarely not an important thing to think about.

Thursday, June 3, 2010

Saturday, March 27, 2010

Four Year. Go.



A bit naive, as always, but not a bad idea.

Friday, October 9, 2009

What You Have You Keep

The second law of thermodynamics states that in an isolated system, entropy is an increasing function. In his book, Do Androids Dream of Electric Sheep, Philip K. Dick talks about fighting entropy, or Kipple, as he calls it:
Kipple is useless objects, like junk mail or match folders after you use the last match or gum wrappers or yesterday's homeopape. When nobody's around, kipple reproduces itself. For instance, if you to go bed leaving any kipple around your apartment, when you wake up there is twice as much of it. It always gets more and more.

No one can win against kipple, except temporarily and maybe in one spot.

I've found that there is much truth in the Kipple Theorem. Just think of your house, which contiguously gets more cluttered over time. The same also happens to source code, if left to its own devices. It is also true of memory, which gets disordered over time. What was once clear and orderly, becomes obscure and messy.

Over the past couple of weeks, I've tried to always put something back in its place whenever I go from one room to another. When I do this with disciple, my house starts to look much better. A couple of days of slacking off, and the house looks once more like a total mess. And I don't ever remember making it a mess. It's just that kipple does multiple while you're asleep. Unless we take active, continuous action to combat it, kipple will always win.

Source code is no different. It grows smelly over time. No matter what your source control's log tells you, changes are constantly taking place. They make the code more unreadable, make methods more incomprehensible, and occasionally even introduced some bugs in unimportant locations.

The same is true when learning things, such as Japanese. I've studies nearly 400 kanji characters over the last couple of weeks. Unless I take active steps to maintain what I've learned, my neurons start getting all bogged down with kipple. That's why I am very fanatical about reviewing the items in my SRS software every day. Left alone, for even a little bit, the kipple raises its ugly head and starts to take over.

Kipple Fighting 101

When you learn chess, you basically have to study three different stages - opening, middle game and end game. For the opening stage, you basically memorize the known openings, which have already been studied thoroughly. During the middle game you need to understand basic principles and how to implement them. The end game part is usually kind of a mixture of the previous stages: memorize principles for different scenarios.

One of the most basic scenarios in the end-game is the one where you have a king and a rook and the opponent has only a king. It is very easy for you to win now. But, to make things explicit, the guiding principle is to always prevent the enemy from returning to territories from which he retreated. When the enemy king moves, you make sure he cannot move back to where he once was. You corner him into closer and closer areas.

In the endless chess game against kipple, the opposite is true:

What I have, I keep!

This means an endless game of maintenance. You've learned a new word - make sure you review it periodically. You finished cleaning the kitchen - make sure it stays clean. Constant vigilance is the key to winning this battle.

Whenever you go over source code, you will encounter kipple. It is your responsibility to engage it immediately. No matter what your current objective is, you must spend some of your time chasing and destroying the kipple. Otherwise, the kipple will take over the code base, and before you know it, no one on your team has a clue what does what.

Monday, October 5, 2009

Kill the CAPS LOCK!

The Caps Lock key can do wonders to wreak havoc in VI. You're in command mode, minding your own business, when all of a sudden all hell breaks loose. All because you pressed the caps lock key instead of the shift key.

For a long while I was reluctant to follow the plethora of tutorials on how to kill the caps lock key. The reason is that there are several cases where I thought it was very beneficial to actually use it to, well, lock the caps. For example, by tradition, definitions in C/C++ are written in all capital letters. I finally figured out how to get along without the evil key, as I will explain below:

g~w - capitalize one word
g~~ - capitalize the entire sentence
gU{motion} - capitalize motion

I still have some open issues. For example, to capitalize the word I just wrote, I have to go backwards ('b') and then capitalize it ('g~w') and then go back to insert mode ('A'). I'll be happy to learn of better options, options that take into account that I despite having to configure my setup. Nonetheless, I'm now much better off than I was with the occasional caps lock accident.

You can now make the caps lock key do something else, such as behave as a shift key or an esc key.


Further Reading:

Wednesday, September 30, 2009

Exercise

I've written before that I have the great privilege of working with people who are much smarter than myself. After more than a year of working with some ridiculously smart people, I've come to the following conclusiong:
Smart people exercise more than average people.
This doesn't mean that every smart person I know exercises regularly. I know quite a few ridiculously intelligent people who don't. But, from what I can see, the average amount of smart people who exercise is much higher than in the average population.

I've been exercising more regularly lately, and my coworkers contribute much to it. As a matter of fact, I just went for an 8km run with half of my group. It turns out that some guys with a PhD in Computer Science can be pretty competitive and this forced me to push myself.

It does feels great after wards, tough.

Promise!

Tuesday, September 29, 2009

Learning Japanese - Spaced Repetition Software

Note: this article is part of a series on how to memorize
material. You can start at:
The classical method for reviewing items you have already memorized is using flashcards. The basic technique is to create a flashcard with a question on one side of the card and the answer on the other side. Each day, you'd review several cards. For each card, you'd read the question side, try to recall the answer, and then compare your answer with the one written on the backside of the flashcard. However, this method has a major limitation:
After some time, you'll have a large "database" of several hundred and even thousand cards. It is not practical to review all of them at once. How do you know which cards to review?
 Several better techniques have been developed over time. For example, in the 1970s, Sebastien Leitner developed the system now named after him. Using this method, you'd have several numbered decks. Each time you succeed in recalling a flashcard, that card will travel to a deck with a lower priority. On the other hand, if you fail to successfully recall the card, then that card would move to a higher priority deck.

You would now schedule your reviews according to the priorities of the decks. For example. each day you would review cards from the highest priority deck, every other day you'd review cards from the second highest priority deck and so forth. This better optimizes your time - you would spend less time reviewing cards you can easily recall, and more time reviewing cards that are hard for you.

This was no doubt a major improvement. In the computer age, however, we can optimize this method much further. Computer programs which do this are called Spaced Repetition Software (SRS). The first program, of which I'm aware, that pursued this task is SuperMemo.

The basic idea of all the SRS programs are to schedule cards for review at a time in which the review will have an optimal benefit in entrenching the fact in long term memory. When you first learn a card, it is scheduled for review quite often. After each review, the program asks you to rate how easy it was for you to recall the fact. Using this data, the program can optimize the time for the next review.

The theory is that the best time to review a card is just when you're starting to forget it. If you have to sweat a little to recall the card, but you do manage to remember it, then you'll remember the card for a long time. The idea is to always live on the edge. Never have a feeling that life is easy. As in most things, this gives you great benefits - namely, long term recollection.

I've used a couple of SRS programs over the past few months. At first, I used mnemosyne, which is a cross platform, open source program. Overall the program is pretty easy to use and very streamlined. You aren't presented with too many options, and you can begin using it immediately. It also has many plugins and existing decks which you can download. The downside is that it is not very configurable, which I for one actually like. It was also a pain to install on an old PowerPC mac, but for Intel machines the installation is very easy. Finally, adding audio and graphics to the flash cards is pretty annoying.

After spending around a month away from computers, I found it was very difficult to return to using mnemosyne. This is actually a problem with all SRS programs. The algorithm requires you to use it at constant time intervals for best performance. After using it daily, a month of absence will take many weeks for the algorithm to overcome. That's why I decide to start fresh and switch to a competitor - Anki.

Anki has very similar features to mnemosyne. It also has many plugins and existing decks. However, it looks much better visually, everything about it can be configured, sound and graphics are a snap to insert and it has mobile and online versions. It can even let you synchronize your decks across multiple computers. As a final bonus, it is updated much more frequently than mnemosyne.

I've now been using Anki for a couple of weeks. This is definitely not long enough to get a feel of its scheduling algorithm. It takes many weeks of daily usage before you can start to experience the benefits of any SRS algorithm. From what I can tell, it looks like a really solid program so far, and I'm happy with it.

Further Reading
  1. Learning Japanese - Memorization: the openning article in this series.
  2. Learning Japanese - Vocabulary: shows a nifty plugin for Anki that can really help you learn your vocabulary.
  3. Configurability: what I think of configurability.

Monday, September 28, 2009

iPod Touch

I ordered myself an ipod touch the other day.

I already have an old ipod shuffle, which I take with me on runs. I also use it to listen to pod casts on long car drives. I can say I'm very pleased with it.

The question is now:

Why?

Why did I order the ipod touch. The answer is that not so much for the music. It is certainly a big step up from the shuffle (which will continue to serve me when excercising), especially having my entire music library and all the podcasts available at whim. Nonetheless, I didn't order it for the music.

I ordered it because it looks like a good portable computing device. No, I don't intend to program on it. I intend to read ebooks on it like I did with my ancient Palm Tungsten E until it passed away. I intend to finally organize my life in some sort of calendar (maybe I'll finally know what happens with me in the weekends). I'll definitely look into some GTD organizer. Some Japanese learning app will definitely find its way in there. I'll probably think of some other useful uses.

And that's the reason I'm buying the touch - because it is extensible. I'm sure a year from now I'll find a dozen more good uses for it.

Too bad it doesn't have a camera...

Sunday, September 27, 2009

Japanese - Vocabulary

I'm currently studying Japanese words with the "Core 2000" list of words on smart.fm (free registration).

Each new word is introduced on smart.fm's iKnow system, which provides some nice features. Each word includes:
  1. The meaning, in english.
  2. The writing in kanji with stroke order.
  3. An example sentence showing the word used in context.
  4. An audio recording of a native speaker reading the sentence.
After showing you some words, the website goes on to drill you about it. So far, I've found that it is best to spend some time alone with each word, trying to memorize it, and only then proceed to the drill stage. Another problem with the drilling is that it appears geared mostly towards short term memory. This is where a nifty tool comes in.

In order to remember the words long-term, I study these new words using an SRS program, namely, Anki. The really great thing is that Anki has a plugin which can automatically import data from smart.fm. This means that in a matter of minutes I can have all the words, example sentences and recordings integrated into Anki.

Here's how it's done:
  1. Install Anki.
  2. Install anki-iknow-importer.
  3. In Anki, choose Tools/Smart.fm Importer.
  4. Fill the two dialog boxes. The most important is the address of the Smart.FM list.






That's pretty much about it. I can now review the words and sentences over time, and Anki will make sure my learning process is optimized.

Further Reading
  1. Learning Japanese - Resources
  2. Learning Japanese - Memorization

Saturday, September 26, 2009

Python, Subprocess and Multiple Arguments

Calling external programs from within a python script is a pretty common task. However, most of the times when I want to pass some arguments to the external program, I usually get stuck. The official Python documentation for the subprocess module is a bit lacking, in my humble opinion, in its treatment of argument passing.

This is not to say that all the information isn't available in the official documentation. In fact, it is. It's just not where I always look for it. The first thing I look for are examples. I simply do not have time to read the entire documentation page for something which should not be too difficult.

The basic idea is this:
  1. Either provide a string of the entire command and argument, but use Shell=True
  2. Provide a string for only the command
  3. Provide a list of strings, where the first item is the command and the other items are the arguments
It's the third option that keeps on giving me trouble, so here is a simple working example for reference:
 1 #!/bin/env python
 2 import subprocess
 3 
 4 program_name = "ls"
 5 arguments = ["-l", "-a"]
 6 
 7 command = [program_name]
 8 command.extend(arguments)
 9 
10 output = subprocess.Popen(command, stdout=subprocess.PIPE).communicate()[0]
11 print output


Passing Arguments with Quotes
If you want to pass arguments that are passed with quotes in the shell, then just pass them as a single list item, without the quotes.

Links
  1. James Gardner wrote the most comprehensive introduction to the python subprocess module I've encountered.
  2. The official documentation.

Further Reading
  1. Bash: Passing Arguments with Quotes
  2. Why Not to Write Shell Scripts

Friday, September 25, 2009

Learning Japanese - Resources

Selected Articles

  1. Memorization - how to memorize kanji, words and grammar.
Guides & Blogs
  1. All Japanese All the Time - this website has tons of articles about how to learn Japanese by having fun and immersing yourself in the language 24/7. The author claims to have learned Japanese in 18 months while studying for a computer science degree in an American college.
  2. Nihongo Pera Pera - includes many articles on how to study Japanese by yourself. Includes many tips, especially on how to use the computer to its fullest potential.
Grammer

  1. Tae Kim's guide to Japanese grammar contains an excellent guide with plenty of examples.
Computer Software

  1. Smart.FM - for a free registration, you get access to tons of free online material. I'm currently studying a list of 2000 core Japanese sentences. The online learning system, called iKnow, has example sentences and recordings by native speakers. See my article on how to use it to learn vocabulary.
  2. Reviewing the Kanji - this website is a great companion to Remembering the Kanji. You can select how many lessons you've already learned, and then quiz yourself. The real bonus is that for each character, you have access to user created stories. These stories can be voted on, and this means that you can easily find some really great stories!
  3. Anki or Mnemosyne - both of these are completely free space repetition software (SRS). Anki is very polished and overflowing with options, whereas Mnemosyne is much simpler. Both offer a wide collection of preexisting cards. Anki also has version for some portable devices and a free online account which can synchronize between several computers.
  4. Rikaichan - an excellent firefox plugin that gives you information on kanji and words whenever you hover your mouse over them.
Stories in Japanese
  1. Free stories can be found at this website. The stories are short and simple, and there are plenty of them to choose from.
  2. White Rabbit Press offers a series of booklets graded according to the JLPT vocabulary. The kanji characters have furigana, and there's a bundled CD with a native speaker reading each story. Each set includes 5 booklets.

Thursday, September 24, 2009

Learning Japanese - Memorization

I've been studying the Japanese language for nearly a year now. I didn't learn as much Japanese as I'd liked to have, but I did learn a great deal about learning.

In a previous article, I listed my early attempt at learning how to memorize. I've learned a lot since then, and I'd like to share it with you. It boils down to three main tips:
  1. Use associative memory
  2. Learn in context
  3. Use SRS software
Associative Memory


The Japanese writing system consists of several "alphabets" used simultaneously. The most famous is the kanji writing system, which is made up of thousands of characters. In order to read a newspaper, you need to be familiar with about 2000 different characters. That's quite a lot of letters to remember.

My initial approach was to learn by repetition. I'd write each character dozens of times and then quiz myself. This method not only takes a lot of work, but it's very easy to forget characters after some time without review. I can say that after about 200 characters, it was getting too time intensive to continue.

I recently started using Remembering the Kanji by James Heisig. The book promotes using our imagination to better memorize.

Each character has a keyword attached to it, and the complex characters are made up of combinations of simpler characters. Therefore, in order to remember the complex "letters", you make up some story that connects the keywords of the simpler letters and the keyword of the complex letter.

The keyword of the simpler characters are remembered using the keywords of even simpler characters. This all goes down until the axioms, sorry, the primitive elements.

It is now very easy to remember how to write a new character. For example, to remember how to write "bull's eye" I just image myself throwing a white ladle at a target and hitting the bull's eye. To commit this to memory, I spend several minutes picturing myself standing all tense, with a large audience watching, the fate of the free world resting on my ability to hit the bull's eye with a shining, white ladle. Now, I know that to the letter with the keyword "bull's eye" is made up of the letters for white and lade.

The serious beginning in the story is in direct contrast to the silly image of throwing a ladle, which only helps burn the story into memory. I try to spend a couple of minutes really imagining the story. I also attempt to make the story as interesting and bizarre as possible, preferably involving as many senses as possible.

So far this technique has been working miracles for me. I intend to finish learning all of the basic 2000 characters in half a year, and I really believe its possible!


Free Resources:
  1. The first few lessons of Remembering the Kanji are available for free.
  2. There is a website where you can read the top rated stories people invented.
Further Reading:
  1. Learning in context - to be written
  2. Using SRS software

Monday, July 20, 2009

Configurability

A while back I stumbled upon the following vim command, which opens a file explorer view. Now, this is truly scary stuff. I was as shocked and disappointed as you probably are. Assuming you're me, that is, and you're most likely not me. You just might be that other person who reads this blog, in which case you probably have no idea what I'm whining about. Alas, to explain, we have to go a little bit back in history.

The best way to travel back in time is the "Once Upon A Time - Man" way. We'll use Peter, which Wikipedia tells us is the very embodiment of the Good Man, as our guide.

In ancient times Peter lived with his entire extended family in the same house. Maestro was the leader of this establishment, and everyone, from Jumbo to Pierrette, went to sleep at night under the same roof. It was one big happy family.

As time went on, and social orders changed, the atomic unit shrank to include only the immediate family. Peter had to leave his parent's house and make his own way in life. After finding a lovely life (people who are Good have beautiful wives), he would get his own place and raise his children there. Until they got kicked out because they were lousy bums who had to get a job.

Nowadays, Peter and his present day wife would probably get divorced, so the family unit is now as small as it gets, unless the universe gets very creative.

Okay, we finished our time travel, and you probably have no idea why a little file explorer freaked me out. I guess we'll just have to make the same journey again until you get it.

A couple of thousand years ago, after the petty city states finished their squabbling, it was pretty nifty to be a king. As a king you were a member of a very small club. There just weren't many kings back then. Every once in a while someone would go around conquering half the world, limiting the number of nations and thus the number of kings.

This continued until just after the world wars and the rise of nationalism, which resulted in everyone wanting their own state. Wolfram Alpha says there are 203 sovereign states right now. Unfortunately, Wolfram Alpha can't answer the simple query: "Number of countries as function of time", but neither can google. You can imagine that over the past centuries this number is an increasing function.

Now, not only does the number of states increase, their power decreases as well. When once a totalitarian state was a pretty simple matter, the internet has made it much more difficult. Not only because Iranians protesters can twit, but also because Hezbollah backed Palestinian terrorists can coordinate attacks and learn how to make bombs. The state is no longer omnipotent.

One more diversion before I get to the point, which should be quite anticlimactic. When Henry Ford made the Model T, all the cars were black. Now they come in a wide range of colors. In addition, everyone wants his very own custom T shirt. I'll leave Apple out of it for the moment, because I'm going to get back to them soon. Everyone besides Apple wants you to have a unique user experience, complete with a customizable theme.

The Point. When I saw that Vim has a file explorer, I was terrified that it would go the way of the emacs. I hate it when a software not only allows, but actually expects you to customize everything in it. This is why I was afraid that Vim was starting down the road that would make it a good OS (albeit lacking a good editor). Emacs tries to do everything, and it tries to let you do everything. That just sucks, no matter what estimmed blogger Steve Yegge says.

For example, I mapped my Win key to the escape key, so that I can quickly switch between normal and insert mode. The annoying thing is that this only works on my machines. When I use a different machine, things suck. This is why I hate Configurability. I prefer uniformity. And I much prefer stuff That Just Works. This is the Apple part I promised two paragraphs back.

I could go on for much longer on this issue, and I probably should. Alas, I've written too much stuff already, without even explaining how everything relates, and the wife deserved some attention. More later.

p.s.
The file explorer in Vim is ok. It's just a file open dialog box. So Vim is still good.

Thursday, July 9, 2009

One Year Summary

A bit over a year ago I started this blog. I didn't know much about blogs and twitter and such at the time. After a year of blogging, I'm afraid I still don't. I think my main pain is that I still write these posts in the damn web UI. I'd much rather write in vim, but I haven't found the time yet to figure out the best way to do it.

During the past year I made many public promises to myself, on this blog and the others. I haven't really lived up to all of them. I have a consistent problem of trying to do too many things. Working full time and studying Japanese have taken up nearly all of my time.

While I didn't get down to writing a game in Python like I wanted to, I did manage to learn the language. Luckily, it was a perfect fit for many of the tasks I had to do at work, and it was a joy to learn it. I have my gripes with the language, but since I work in C++ most of the time, its a very welcome change. Needless to say, Python code is much more readable. C++0x has the auto keyword which will help, but a static language will never be able to match a dynamic one in this criteria.

I intend to continue studying Japanese, though maybe not in a university framework. I have to figure out if I want to start studying for a Master's in Physics or not. None of the courses I can take will be easy in conjunction with a full time job. I may end up preferring not to take any official obligation and spend time studying the things I like by myself.

We'll see how the next year will come along...

Tuesday, June 9, 2009

New Computer

I'm writing this on a new computer I got yesterday. It's called Fit PC2, and it's really really small, and pretty green as well.

Not as cool as a new mac, but nice none-the-less. It's ridiculous how small these things have gotten.

Sunday, June 7, 2009

Better World Books

For the last couple of months I've been ordering my books from BetterWorldBooks.com. It's an online book store with a soul. All the books I order are shiped in carbon free packages (if you exclude the air plane that delivers the package). In addition, the company diverts funds to help fund literacy around the world.

The nice part is that it isn't expensive either. Their prices usually compete with Amazon, especially considering that shipping is $3.97 around the world (free for the US). That alone would probably make it worthwhile for people outside of the states (yes, there are a couple of us out here).

They're also really nice. I occasionally get free treats, such a chocolate bars or tea. It's just fun. Alas, they give me nothing for writing this post :-).

Thursday, May 7, 2009

Book updates

I've updates my current reading list page, and even added short reviews for books I finished reading. Right now this includes everything I read, including novels and history books. Most are computer related in some way, though.

The reading list is accessible from the menu to right, at the top.

First Donation

Today I donated money to an open-source project for the first time. And it felt good.

I've decided that paying for free open-source projects you use and find helpful is a good way to go. Money was more of a problem during my university days, and I think it's a nice model to use good software when you need it, and pay for it when you can.

If you're wondering, the project is Review Board, a code-review web 2.0 application. I've been playing with it at work for a couple of days, and it's really nice. A few glitches during the installation, but it's at the RC stage, which means that it's stable, but glitches are still expected. It also means it's a nice time to give the developers a kindly push in the right direction.

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...