Reply New Topic
2009/12/13 14:33:59
#1
Offline
Home away from home

Time for a decision: Tabs or Spaces

We have had lengthy exchanges on the development and now as 1.3 is upon us, we need to make a decision - is indentation to be formatted as tabs or spaces?

_________________
Christian Web Resources
Facebook

2009/12/13 15:24:09
#2
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

I thought zend specifications insisted on 4 spaces for indentation? Tabs are not allowed at all correct?


2009/12/13 15:32:49
#3
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

We aren't committing code to Zend

_________________
Christian Web Resources
Facebook

2009/12/13 16:15:54
#4
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

Well, yes I appreciatte that - I just thought it was already decided that we would conform to zend specifications.

Either way - it doesn't really effect me too much - so I will leave the voting for those that it does. :)


2009/12/13 18:29:52
#5
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

Well, we agreed to adopt the Zend framework for adding new functionality, but we didn't agree on the Zend coding standards.

Everyone has had the opportunity to voice their opinions on this in the mailing list. I am only calling for a vote.

_________________
Christian Web Resources
Facebook

2009/12/13 22:42:41
#6
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

Tabs please. Unless you enjoy hitting that backspace key several hundred times a day more than you need to!


2009/12/13 23:45:17
#7
Offline
Just can not stay away

Re: Time for a decision: Tabs or Spaces

IMHO we should look to see what is or has become popular and then rule on it, if Zend become the way to go with php, and we go the other route, how will it affect us in the next few versions?
there will always be pros and cons to every thing, regardless what we do, but it help if we look and see what trends are good now so we know what roads to take before its to late to turn back.

I personally have used tabs over spaces, but thats me. :thumbup:

_________________

2009/12/13 23:53:22
#8
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

Tabs for php, spaces for templates. That's what I did until now.

_________________
the german icms website : www.impresscms.de

2009/12/14 1:07:03
#9
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

MadFish, I have Dreamweaver configured for Spaces and the Tab key keeps behaving the same way as Tabs in Code view as it behaved when it was configured for Tabs (I changed it two years ago to write a Drupal module). It only changes the way the data is saved, not your keyboard's behavior. If this doesn't happen in your editor, maybe you should look your configuration.

_________________
If you can't understand what I'm saying, you're not geek enough
ISegura.es

2009/12/14 5:12:39
#10
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

@Northern - this just isn't about what is popular, but optimal. To find out how it will affect us, do what I did - format a file both ways and measure the differences (file size, memory use, load time). You'll then understand why I voted for tabs.

_________________
Christian Web Resources
Facebook

2009/12/14 6:36:25
#11
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

spaces. it's consistent then and it's necessary Zend Coding standards anyway.

besides with spaces, no matter where you copy/paste, the formatting will always be identical, even on forums.

when i view texts on my phone and the code uses tabs and not spaces, it throws the code all over the screen and not formatted and takes a while just getting to the line you require, same when you copy/paste into a forum, if tabs are used it throws the layout out, with spaces you see it exactly as you paste it. if spaces are used, no matter what you open the file in, the formatting will be identical!! no weird layouts, and no formatting differences when people save & commit back to SVN.

_________________
Live as if you were to die tomorrow, Learn as if you were to live forever

The beauty of a living thing is not the atoms that go into it, but the way those atoms are put together!

2009/12/14 12:33:56
#12
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

Quote:

To find out how it will affect us, do what I did - format a file both ways and measure the differences (file size, memory use, load time). You'll then understand why I voted for tabs.


This is exactly my opinion. The filesize makes a real difference. Since we're doing optimizations in 1.3, using tabs instead of spaces is almost a must.

@Vaughan: We're not developing ImpressCMS on a mobile phone, do we? This should really be one of the last arguments to come up with. Also the argument for copy & past to forums: Not relevant for the performance of the CMS.

I definitly vote for tabs.

_________________
the german icms website : www.impresscms.de

2009/12/24 20:34:09
#13
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

The votes are in and the decision is made - we will use tabs and not spaces for indenting our code. Please set your editor preferences for this and be sure you are checking your whitespace before committing any new code.

The code in svn.impresscms.org/core/tasks/impresscms_1.3-optimization is already formatted using tabs, if you want to check it out.

_________________
Christian Web Resources
Facebook

2009/12/24 20:57:15
#14
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

sure, u might not use a phone, but i'd say 90% of my viewing at moment is mainly done via my phone.

it doesn't do tabs very well. so if i see something with a screwed up layout that is hard to follow, i usually don't bother. and everytime i've seen tabs used, it has been different everytime i open up the file in an editor. i guess we'll be the odd ones out compared to the rest of the projects, so devs who want to develop for icms that use the traditional and preferred method of spaces, will have to keep changing their tabs/indents when they are editing icms code. bit of a ballache imo.

_________________
Live as if you were to die tomorrow, Learn as if you were to live forever

The beauty of a living thing is not the atoms that go into it, but the way those atoms are put together!

2009/12/24 21:35:22
#15
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

Quote:

The votes are in and the decision is made - we will use tabs and not spaces for indenting our code.


If we find out we made the wrong decision, will the decision be possible to change?
Then we can take 1.3 as a learning curve for tabs / spaces.


2009/12/25 7:55:57
#16
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

actually the difference in whitespace in files affecting the overall performance of the core is negligible at worst.

for instance, i'd say the largest file in the core at moment is HTMLPurifier.standalone.php and that file is huge, and compared with the other version that is not contained in 1 package and instead smaller filesizes, actually made things more resource intensive, and slower.

if filesize and those extra spaces really are bothering you so much then why do we bother at all, why don't we just scan through files and remove all whitespace completely so that it's all on one line and further decrease the filesize even more? the answer to that is to make things EASIER for developers to FOLLOW!!

it's give & take but asking developers & even new developers that have probably gotten used to using spaces for all those years to suddenly use tabs isn't a good attraction for them!

we supposed to be moving towards zend, and if we want to be a zend affiliated product, we really need to adhere to their coding standards and not do the complete opposite.

the fact that now every time i want to edit a file belonging to ICMs as opposed to all the other different works i help out with, i now have to go into my editors settings and change it to tabs instead of spaces means more hassle for me because every other project or whatever i help out with uses spaces.

i learnt one way of doing it from the start, and now we're going against the norm.

and yes i do write a lot of my code using my PHONE!!! & i certainly read more code using my phone than i do my own pc these days, the ones i can't read because the tabs are all over the place usually get ignored.

sometimes i wish the word democracy was never used on this site. because where software projects are concerned, democracy sucks BIG TIME.

_________________
Live as if you were to die tomorrow, Learn as if you were to live forever

The beauty of a living thing is not the atoms that go into it, but the way those atoms are put together!

2009/12/25 9:23:47
#17
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

I agree with Vaughan, filesize decrease and performance gain is no match for a code that looks alike in any editor. I find it strange to see discussions around microseconds gain (use of (int) vs intval()) or tabs vs spaces) and see you using $obj->toArray() wich often calls module.textsanitizer to render text areas that are not going to be displayed.

I voted spaces, I voted Zend standards, I voted the way experts do it.

More strange then seeing you discussing this, is to see you are doing it now, after 2 years of code committing.

_________________
VIL3/trabisdementia

2009/12/25 11:17:03
#18
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

Quote:


trabis wrote:

I voted spaces, I voted Zend standards it.



Apparently the poll expiration date does not prevent people from voting afterwards...

Quote:


More strange then seeing you discussing this, is to see you are doing it now, after 2 years of code committing.



Seems like your project just established its own standards, after what - 9 years?

Seriously, you complain about the lack of decision making, but when one does get made, you complain because you don't like it.

What next?

What I find rather amusing is the deeply held opinions that were etched on stone tablets when the code editors were vi and dosedit. Now we have phones capable of browsing the web, IDEs capable of maintaining separate preferences for each project or workspace and we are still driven by archaic practices without ever considering something else might just be worth trying.

Well, I won't be standing in anyone's way.

_________________
Christian Web Resources
Facebook

2009/12/25 12:12:44
#19
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

Whatever is best - is fine by me.


2009/12/25 14:48:29
#20
Offline
Home away from home

Re: Time for a decision: Tabs or Spaces

all i'm saying is that most of the developers i know use spaces for tabs, zend use it, and probably more. it's an already established standard. asking others to keep changing their tabs from spaces just seems not right, that and people are forgetful at times anyway.

@Trabis, the reason we're discussing now though is because it's become increasingly chaotic at times with SVN, where some editors are set with different settings, some use DOS line ends, some use unix, and it makes diffing a much longer process. so we need to all start adhering to a set standard. That & we're trying to use the forum more instead of reliance on the mailing list.

_________________
Live as if you were to die tomorrow, Learn as if you were to live forever

The beauty of a living thing is not the atoms that go into it, but the way those atoms are put together!

Reply New Topic extras
 Previous Topic   Next Topic
You can view topic.
You can start a new topic.
You can reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You can post without approval.