April 2010 Archives

tabs vs spaces?

| 11 Comments
A tabstop can be set to 1, 2, 4, 8 or 100 characters. Spaces cannot. If you set every tab to 1 character, you still see the intended indentation of the author.

So why as a community or (dare I say Planet?) Do we use spaces? Or even the worst of all defaults: tabs + spaces at the same time

If setting your tabstop was EASY and TRIVIAL in emacs or vi then I suspect the world would be moving towards tabs and away from spaces. I do not see any advantages of spaces over tabs, instead I see a LOT of advantages of Tabs over spaces, and if tabs became the standard, I suspect the options would become even better.

The ONLY time I could advocate spaces and tabs together would be something like the following:
      if(somecondition &&
         some_other_condition &&
         a_third_condition){
Ironically, I couldn't paste in tab characters into the text field for the above effect. 

I will now put on my flame proof suit and wait near the garden hose.

If anyone is wondering I use emacs which by default uses tabs+spaces which is the worst of both worlds

well designed code

Has anyone here had to make a major code quality sacrifice to meet a deadline or get code working under pressure? How many of you had a chance to go back and fix that code before passing the code to someone else?

In the past six weeks I have been on both sides of the table. I hope to be able to say that most of the code I passed along isn't too bad, and the dragons in it are well known. I also should point out that the dragons are not too bad in the code I am now working on. 

In either case, write good code now since you might not ever get a chance to go back to it again. 

The best ways to do this are to adopt coding standards and start following them. Do not switch from project to project, but keep them consistent. Adopt a set of rules for Perl::Tidy and Perl::Critic. If you do this you will be well on your way to writing code that is readable to the poor  saps that inherit your code base. 

And in the end, Karma might decide to give you a well maintained codebase too.

Perls of wisdom

I don't have any this week. Last weeks sorting question was last minute and gave lots of interesting conversation.

If you are looking for good perl conversation, look at last week's post, and you can get more out of that than anything I could write this week.

Sorting interview question

| 8 Comments
I have been busy with my new position, so I haven't been able to put as much time and thought into my blog posts.

I have question that was asked of me on my job interview:

You have an array of items, each element matches the following pattern:
 /^[a-zA-Z]+[0-9]+$/
You want to sort the array both alphabetically and numerically:

ie 'abc123' comes after 'abc2' because 2<123 when compared numerically.

How would you do this?

Can you do it in one line code? Mine wasn't but I still got the job, However I have seen it in one line of code.


Rule of threes

The Rule of threes has been an interesting set of rules for my life lately. Having just moved positions from The University where I had been in the position for three years, to the new job where I have now been for three weeks.

I am now qualified to draw conclusions about my new workmates as I have been with them for three weeks. So far this is what i think:

The perl code is not too bad. It was written with the intent of being readable. They have coding standards and they follow them. I may not agree with everything they standardized, but I follow them. I would much rather follow a standard I didn't agree with, than to have no standards at all. The code has a bit of tangle, but still not too bad.

The work ethic -- I am not really qualified to comment to much yet. I have noticed that they come in late, but they stay late too, so still not bad, just now how *I* operate. That's ok.

The organization of the work is really nice. I am being given single tickets in groups of three or four to work on. This is the first job that had a ticketing system that we actually used. Because of this, I am finding myself much more focused, and not distracted by the other tasks that need to get done. IE: do the current ticket *THEN* move on and work on that other problem.

The management is OK. My direct manager is a "get it done" person, which is probably why we have the ticketing system. He also wasn't with the project from the start, and therefore I believe that he would do some things very differently than the former VP of Engineering (You have probably heard of the former VP of engineering and his infamous worm)

I might not be able to keep this journal past this week as I am no longer employed by umn.edu, but because I was a student, I might be able to keep the blog. we will see.

If I am unable to continue on this blog, I will move to olegmperl.livejournal.com. Otherwise I will stay here.

About this Archive

This page is an archive of entries from April 2010 listed from newest to oldest.

March 2010 is the previous archive.

May 2010 is the next archive.

Find recent content on the main index or look in the archives to find all content.