Tab/spaces issue

I’m updating code from cvs every few days and have noticed that there is a lot of changes tied to whitespaces. It seems that renanse uses only spaces and mojomonkey uses tabs at start of lines. Effect is that instead of one line change, almost entire file is changed. It totally kills any possibility of checking history of code, besides looking at commit comments, as everything is marked as a change. Then mojomonkey comes back and changes it to tabs and then renanse put spaces again…



Can one standard be agree upon ? Or at least, please do not commit changes if you see that you will modify entire file - it probably means something gone wrong.



Mojo - you probably just need to make a statement and everybody will stick to it, case closed.

Renanse uses JBuilder, while mojo, i believe, uses Eclipse.



JBuilder emulates Tab presses as spaces. So its not really anyone’s fault.



But I do agree that we should set a standard.



DP

I run into the same problem at work all the time. I agree that it’s kind of a pain.



I’m an ‘all spaces’ man, myself. That way, it looks consistent no matter where it’s viewed. (Whereas some tabs are set to 4 spaces, some to 8.)



As a side note… Almost all editing software can emulate tabs with spaces nowadays, so it’s usually an easy fix to go that route.





–K

Actually - the best result is using 1 tab - ALWAYS.

Then people can just adjust their spacer to whatever they want.



Using spaces all over the place is silly, since it doesn’t allow people to have different indents.

"Matzon" wrote:
Actually - the best result is using 1 tab - ALWAYS.
Then people can just adjust their spacer to whatever they want.
Unless you browse sources on somebody's else machine in Notepad and tabs get expanded to 8 characters, which moves some code way to right side of screen.

Generally I don't care about solution, as long as it is consistent and it is not a linux kernel way. They have accepted 4spaces, 1 tab, 1tab+4spaces, 2tabs, 2tabs+4spaces etc indent levels - which is braindead IMHO.
Unless you browse sources on somebody's else machine in Notepad and tabs get expanded to 8 characters, which moves some code way to right side of screen.

Well, thats really an issue with the editor at hand... and it is hardly the common case

The entire, singular purpose of the existance of a tab key is to tab newlines.

Actually - the best result is using 1 tab - ALWAYS.
Then people can just adjust their spacer to whatever they want.


I don't get that actually.. When you need to indent twice (which is by far the most common scenario, yes?) you have to tab, then hit the space bar X times instead of just hitting tab twice. Plus, all the editors that I've seen that do auto-indent do one or the other, but not a combination of tabs and spaces. (Then again, I try to avoid complex IDEs because I feel like they get in my way.) If you set the tabs to really be 4 spaces, other people will never have any problems viewing the code.

Also.. Everybody using spaces means you never have to adjust your editor.. it just looks the same everywhere. It's not like you're increasing the size of the compiled code by using 4 whitespace characters instead of 1.

Personally, I don't find that the amount of indentation is nearly as much of a problem as inconsistent formatting within a single file. (Except when people only use -2- spaces per indent. Why would anybody ever do that to themselves?)



But anyway.. it's not a problem at all as long as it's consistent. As anal as it is, maybe we should set up a standard code beautifier and run all checked-in code through it?


--K
Also.. Everybody using spaces means you never have to adjust your editor.. it just looks the same everywhere. It's not like you're increasing the size of the compiled code by using 4 whitespace characters instead of 1.
Well thats exactly the problem with spaces!
Who says I want 4 spaces per tab? - I might want 2, and you want 4.
If we all use 1 tab, and set our editor to represent tabs with 4 or 2 spaces we're all happy campers.
I don't want all code to look the same on all computers. I want it to look like *I* want it! And I suppose you want the same - thus 1 tab is the simplest solution.

First step to resolving the consistency problem is code is submitted to me now, I format it, then commit it. (There’s still a lot of code in that hasn’t be retro-formatted). I use Eclipse and the Java Formatting, tabs are on, but it’s a simple matter to switch to spaces (it’s a check box). If I switch to spaces it will be 4 spaces per tab.



Devs making the quick bug fixes need to just be carefull not to reformat the code before committing.



Is tabs or spaces desired? It’s truely makes no difference to me, as there is no noticable difference in Eclipse.

I personally like spaces but could deal with tabs.

Also, I think it’s a decision for those of us who develop jME. No offense to those on here that don’t.

<votes tab>

Ok, 1 tab 1 spaces… we need a tie breaker…

Most everything is in tabs right now. If we went to spaces, wouldn’t that require changing a lot of classes?

Tis true.

Almost all of the code likely needs reformatting in some spot or another. shrug



Like I said before, I don’t really mind one way or the other, but until I switch IDEs (which won’t be for another few months) I’m guessing some of my code will not be exactly perfect on the indentation… You can turn on tabs in jbuilder, but the braces stop matching up for some really dumb reason.

Does the Code Standerds say somthing about this?

Four spaces should be used as the unit of indentation. The exact construction of the indentation (spaces vs. tabs) is unspecified. Tabs must be set exactly every 8 spaces (not 4).