Shortcut for chapter specific information

Wednesday, May 11, 2011

Spend time to learn

I used to think to work for a company, the best way is to spend all your working hours on work. 

Wrong! Spend 20% of time to learn.  Learning the right thing such as data structure and algorithm will only make you faster.   Here is an example.

I know an experienced C but a rather outdated perl programmer.  He is taking a managerial role so even if his code is slightly sloppy no one can touch him.   Most of the time his coding is ok.  But there is an obvious sign that he hadn't look at the basic of perl for long time.

There was a table which requires 3 layers of tree.   But since the programmer doesn't know easy it is for perl to implement such a tree using multi-level hash.  So he clumsily put both layer 2 and layer 3 of the key as keys of a hash.

As a result, every time he needs to use the table, he will need to use a special routine to read the single level hash.   That require identify whether the key has the characteristics of layer 2 and layer 3.  (Don't ask.)

When I asked him why he did such kind of programming, he argue with me with his managerial position that I shouldn't say a thing.   As a result, the code persists.   Of course, everything rotten from there......

The same programmer also doesn't know things such as using map, grep instead of foreach in perl.   The former can usually reduce code length by 80% and it's usually easier to read and maintain.

If the programmer happens to any books such as "Intermediate Perl".  There won't be such problems. This simple example show how important learning is for a programmer.  Everyone would fall from grace.  Once your mind stale, your skill stale.  That's just the way it is. 

No comments:

Post a Comment