PDA

View Full Version : Coding Standards


2gooder
August 22nd, 2005, 10:12 PM
Hello everyone,

<rant>

I recently started learning Ruby so that I could use the Ruby on Rails platform. One of the first things I did was review the Ruby coding standards so that I didn't break the norm. One problem I had was the fact that it is considered good form to indent using 2 spaces rather than a tab. This doesn't sound like a big deal, but this actually really bothers me. If you are interested in my reasoning, I like tab indents becuase they allow the tab size to be set on a per developer basis, so anyone can have their indents what ever size they like and it doesn't affect anyone else. Also, this means more key strokes of the backspace key in most editors when you need to break out of an indentation. Most importantly though, this means I have to change the settings on my editor every time I move from Ruby to another language I write that uses tabs, like Java, C# and XML. It wouldn't be such a big deal for me to just write everything using tabs instead of spaces, but the Rails framework creates all of its code using spaces, so if I use tabs and then edit the code that Rails created everything just turns into a real mess.

So can anyone tell me why the Ruby people have decided on spaces?

</rant>

Thanks,
Simon

rob
August 23rd, 2005, 01:29 AM
I don't think its just Ruby people in general. There are alot of open source projects that exist for example where the main author insists on spaces instead of tabs.

Personally, I like to set tab width to 2 but then set the editor to expand spaces. This way, I ge the convenience of a tab, but the standard (or so it seems) of spaces.

bluetechnx
August 23rd, 2005, 09:01 PM
spaces are nicer I find because often if tabs are used I find that printing throws off the pagination. (Gosh thats an ugly sentence) I think spaces are in general the way to go...

rob
August 24th, 2005, 10:14 PM
Spaces Vs. Tabs
Windows Vs. Linux
Coke Vs. Pepsi

When will it end? :)

steve_d555
August 24th, 2005, 10:15 PM
Spaces Vs. Tabs
Windows Vs. Linux
Coke Vs. Pepsi

When will it end? :)
When Stewie takes over the world :p

rob
August 25th, 2005, 05:21 PM
On a serious note, I wonder if the Spaces over Tabs preferences has something to do with a larger percentage of Ruby developers using MacOS.

And on that issue, why is that? :) I can't figure it out.

psidefect
August 30th, 2005, 01:31 PM
Why not just find and replace the spaces with tabs?

Any decent editor should be able to do that in no time.