Re: [PHP] Tabs or Spaces?
Ryan King wrote: I agree. I can't imagine that having more whitespace characters in a script will significantly effect the performance of said script. I would guess that there would always be more significant issues to deal with in regards to performance- php compiling and optimizing SQL queries being chief in my mind. Its silly and inefficient (work-wise) to optimize the small issues in programming. Just remember, "Premature optimization is the root of all evil." (Knuth) Wait... I'm writing an extension to remove spaces and convert double quotes to single and use echo instead of print... are you saying that's silly? Bah! -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tabs or Spaces?
On Nov 21, 2004, at 5:09 PM, Chris Shiflett wrote: --- Ryan King <[EMAIL PROTECTED]> wrote: However, when indenting with 3 spaces instead of a single tab, then your code-size WILL increase, and will include 3x more "space content" than it used to :) Who cares? Just to point out the obvious, if you're not using a compiler cache, size does matter. Of course, if you're to the point where the difference is important to you, you're to the point where you should figure out how to use APC or something. :-) I agree. I can't imagine that having more whitespace characters in a script will significantly effect the performance of said script. I would guess that there would always be more significant issues to deal with in regards to performance- php compiling and optimizing SQL queries being chief in my mind. Its silly and inefficient (work-wise) to optimize the small issues in programming. Just remember, "Premature optimization is the root of all evil." (Knuth) -ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Tabs or Spaces?
Hello Chris, Sunday, November 21, 2004, 11:09:42 PM, you wrote: CS> Just to point out the obvious, if you're not using a compiler CS> cache, size does matter. Of course, if you're to the point where CS> the difference is important to you, you're to the point where you CS> should figure out how to use APC or something. :-) Equally, if you don't actually share your code with anyone (and the vast majority of us do not!) then it doesn't matter one bit what you do either :) Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services "I am not young enough to know everything." - Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tabs or Spaces?
Chris Shiflett wrote: --- Ryan King <[EMAIL PROTECTED]> wrote: However, when indenting with 3 spaces instead of a single tab, then your code-size WILL increase, and will include 3x more "space content" than it used to :) Who cares? Just to point out the obvious, if you're not using a compiler cache, size does matter. Of course, if you're to the point where the difference is important to you, you're to the point where you should figure out how to use APC or something. :-) Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly HTTP Developer's Handbook - Sams Coming February 2005http://httphandbook.org/ true ;) just wanted to share it though (and yes, I too use 4 spaces) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tabs or Spaces?
--- Ryan King <[EMAIL PROTECTED]> wrote: > > However, when indenting with 3 spaces instead of a single tab, > > then your code-size WILL increase, and will include 3x more > > "space content" than it used to :) > > Who cares? Just to point out the obvious, if you're not using a compiler cache, size does matter. Of course, if you're to the point where the difference is important to you, you're to the point where you should figure out how to use APC or something. :-) Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly HTTP Developer's Handbook - Sams Coming February 2005http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tabs or Spaces?
Four spaces are used by a lot of open source projects, including Apache and PHP, so I've been trying to convert, myself. In general, spaces just make it easier to do multi-line formatting with exact precision, like this: if ($foo || $bar || $boo) { ... } If this statement was also nested, you can see where tabs might become a problem. With tabs, you can always make a habit of indenting any extra lines one more tab than the original, but that doesn't always line up so nicely (e.g., $bar may or may not be directly below $foo). You can also simply repeat the same number of tabs then switch to spaces for the alignment: if ($foo || $bar || $boo)) { But that just gets ugly. :-) If you ever have a difference of more than a single tab, the alignment can look radically different, so this should never be used, even if it makes things look nice with your personal tab settings. In general, any formatting that depends upon tab settings is going to look really ugly somewhere. Tabs are convenient, because they're a single character. You can backspace to quickly remove an indentation, and a single keystroke can be used to add an indentation. However, I've learned that a few simple editor settings combined with some adjustments to my editing habits can overcome these slight inconveniences. When I hit the tab key, four spaces appear, and I can use vertical selections to unindent things quickly regardless of whether the indentations use spaces or tabs. I bet some people have their editors configured to remove four spaces when you backspace, assuming the four characters to the left of the cursor are all spaces. If anyone has done this for vim, please share. :-) Anyway, those are some random thoughts from someone in the middle of converting from tabs to spaces. I've basically decided to switch for two reasons: improved precision over formatting and consistency with other major open source projects. This doesn't mean spaces are best for everyone, but that's my reasoning. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly HTTP Developer's Handbook - Sams Coming February 2005http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tabs or Spaces?
On Nov 21, 2004, at 4:30 PM, M. Sokolewicz wrote: Jon-Eirik Pettersen wrote: Daniel Schierbeck wrote: Hello there! There seems to be some tendency towards using spaces instead of tabs when indenting PHP code - personally i can't come up with any reason not to use tabs. I was just wondering if any of you freakees had some sort of explanation... One reason is that a space is a space and will allways be a space. A tab may be 5, 3 or whatever spaces depending on the editors configration. When more than one developer is developing on a project they will see the indenting differently when using tabs. that's indeed usually it. However, remember that both a space and a tab are actually only a single character, so if you're looking at the amount of space both take, it's exactly the same. However, when indenting with 3 spaces instead of a single tab, then your code-size WILL increase, and will include 3x more "space content" than it used to :) Who cares? -ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tabs or Spaces?
Jon-Eirik Pettersen wrote: Daniel Schierbeck wrote: Hello there! There seems to be some tendency towards using spaces instead of tabs when indenting PHP code - personally i can't come up with any reason not to use tabs. I was just wondering if any of you freakees had some sort of explanation... One reason is that a space is a space and will allways be a space. A tab may be 5, 3 or whatever spaces depending on the editors configration. When more than one developer is developing on a project they will see the indenting differently when using tabs. that's indeed usually it. However, remember that both a space and a tab are actually only a single character, so if you're looking at the amount of space both take, it's exactly the same. However, when indenting with 3 spaces instead of a single tab, then your code-size WILL increase, and will include 3x more "space content" than it used to :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tabs or Spaces?
Daniel Schierbeck wrote: Hello there! There seems to be some tendency towards using spaces instead of tabs when indenting PHP code - personally i can't come up with any reason not to use tabs. I was just wondering if any of you freakees had some sort of explanation... One reason is that a space is a space and will allways be a space. A tab may be 5, 3 or whatever spaces depending on the editors configration. When more than one developer is developing on a project they will see the indenting differently when using tabs. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Tabs or Spaces?
Hello there! There seems to be some tendency towards using spaces instead of tabs when indenting PHP code - personally i can't come up with any reason not to use tabs. I was just wondering if any of you freakees had some sort of explanation... -- Daniel Schierbeck Help spread Firefox (www.getfirefox.com): http://www.spreadfirefox.com/?q=user/register&r=6584 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php