coding standards
- Jonah
- Joomla! Explorer
- Posts: 299
- Joined: Thu Aug 18, 2005 6:02 pm
- Contact:
coding standards
According to http://help.joomla.org/content/view/826/125/ Joomla! uses PEAR standards, including a 4 space no tab indentation.
However, both Joomla! 1.0.x and 1.5.x use tabs throughout.
I'm assuming the documentation should be changed?
Personally, prefer tabs anyway because of document weight and user friendliness (you can change tabs to be however long you want in your editor).
Jonah
However, both Joomla! 1.0.x and 1.5.x use tabs throughout.
I'm assuming the documentation should be changed?
Personally, prefer tabs anyway because of document weight and user friendliness (you can change tabs to be however long you want in your editor).
Jonah
trinitywebhosting.com - Free Joomla! websites for churches and non-profits.
- nibra
- Joomla! Guru
- Posts: 588
- Joined: Wed Nov 16, 2005 2:02 am
- Location: Breklum - Nordfriesland
- Contact:
Re: coding standards
Yes, that is the way it should be.lamad wrote: According to http://help.joomla.org/content/view/826/125/ Joomla! uses PEAR standards, including a 4 space no tab indentation.
If it is so (I don't see tabs, since my editor corrects them to spaces seemlessly), the code should be cleaned up, not the documentation.lamad wrote: However, both Joomla! 1.0.x and 1.5.x use tabs throughout.
I'm assuming the documentation should be changed?
That is a very old discussion. It usually ends up with space indentation peferred, because the interpretation of spaces is the same on any any system in any editor, not so tabs.lamad wrote: Personally, prefer tabs anyway because of document weight and user friendliness (you can change tabs to be however long you want in your editor).
Niels
- Jonah
- Joomla! Explorer
- Posts: 299
- Joined: Thu Aug 18, 2005 6:02 pm
- Contact:
Re: coding standards
Ok, we're talking the entire codebase here.nibra wrote: If it is so (I don't see tabs, since my editor corrects them to spaces seemlessly), the code should be cleaned up, not the documentation.
Can any core or dev group members comment on this? I'm not trying to push one standard or the other, but rather have the inconsistency between documentation and reality fixed.
trinitywebhosting.com - Free Joomla! websites for churches and non-profits.
- nibra
- Joomla! Guru
- Posts: 588
- Joined: Wed Nov 16, 2005 2:02 am
- Location: Breklum - Nordfriesland
- Contact:
Re: coding standards
I don't consider this being a big issue. The code style guide is not a documentation of what is, but of what should be. Any discrepancy here do not hurt. But you're right, on the long term, this should be corrected. Since most editors allow autoconversion from tabs to spaces, I suggest, that any dev sets the preferences of his editor accordingly, so any file gets corrected when touched. This way, the code will adhere to the style guide in this point very fast. In any case, this violation of the style guide does not require immediate interception.
- RobS
- Joomla! Ace
- Posts: 1366
- Joined: Mon Dec 05, 2005 10:17 am
- Location: New Orleans, LA, USA
- Contact:
Re: coding standards
I believe most of the developers are currently using tabs. As far as I know, the style guide was mostly abandoned when the S&G (Standards & Guidelines) WG was dissolved. I will flag this for Wilco to look at it and he can do whatever he thinks appropriate.
Rob Schley - Open Source Matters
Webimagery - http://www.webimagery.net/ - Professional Consulting Services
JXtended - http://www.jxtended.com/ - Free and Commercial Joomla! Extensions
Webimagery - http://www.webimagery.net/ - Professional Consulting Services
JXtended - http://www.jxtended.com/ - Free and Commercial Joomla! Extensions
- louis.landry
- Joomla! Ace
- Posts: 1380
- Joined: Wed Aug 17, 2005 11:03 pm
- Location: San Jose, California
- Contact:
Re: coding standards
This is all being revised at the following url: http://dev.joomla.org/component/option, ... ds:coding/
Louis
Louis
Joomla Platform Maintainer
A hacker does for love what others would not do for money.
A hacker does for love what others would not do for money.
- Jonah
- Joomla! Explorer
- Posts: 299
- Joined: Thu Aug 18, 2005 6:02 pm
- Contact:
Re: coding standards
Ya, except it should be the more popular java variation of K&R, not the brace on next line version. :P Anyway, I'll stop now since K&R are quoted as saying "The position of braces is less important"...
trinitywebhosting.com - Free Joomla! websites for churches and non-profits.
- instance
- Joomla! Explorer
- Posts: 302
- Joined: Mon Nov 13, 2006 11:31 am
- Location: Toronto, Canada
Re: coding standards
Our de facto standard is worse than that. It's actually something close to "brace at end of current line if subsequent code block is round(2 + rand(0,1)) lines or less; otherwise brace on next line".lamad wrote: Ya, except it should be the more popular java variation of K&R, not the brace on next line version. :P Anyway, I'll stop now since K&R are quoted as saying "The position of braces is less important"...
I have looked extensively at the possibility of automatically formatting the code base, and there is no inexpensive tool that I have found which is capable of doing it successfully. I have evaluated several, and I suspect the expensive tools won't do it either. "Re-grep Bison" followed by "write real-world code formatting tool" are on my to-do list, but the current estimated completion date is >2050, well past my estimated lifespan.
This is particularly irritating since I am having trouble convincing Eclipse to support spaces in one project and tabs in the next.
==> Please do not PM me for support issues. <==
Alan Langford -- Joomla Security Strike Team, Extension Developer, Hosting Guy
Biz: http://www.abivia.net
Blog: http://www.ambitonline.com/nextrelease
Alan Langford -- Joomla Security Strike Team, Extension Developer, Hosting Guy
Biz: http://www.abivia.net
Blog: http://www.ambitonline.com/nextrelease
- CirTap
- Joomla! Explorer
- Posts: 418
- Joined: Mon Dec 12, 2005 5:34 pm
Re: coding standards
then pull out the sledge hammer: http://www.eclipse.org/dash/index.phpinstance wrote: This is particularly irritating since I am having trouble convincing Eclipse to support spaces in one project and tabs in the next.
CirTap
You can have programs written fast, well, and cheap, but you only get to pick 2 ...
"I love deadlines. I like the whooshing sound they make as they fly by." Douglas Adams
"I love deadlines. I like the whooshing sound they make as they fly by." Douglas Adams
-
- Joomla! Explorer
- Posts: 347
- Joined: Wed Sep 27, 2006 11:55 pm
Re: coding standards
The complete source code of version 1.5 should be converted using spaces for indentation! This ist not a huge problem.
- moijafcor
- Joomla! Enthusiast
- Posts: 218
- Joined: Thu Mar 02, 2006 9:41 am
- Location: Santo Domingo, Dominican Republic
- Contact:
Re: coding standards
So far I know PEAR claim on spaces is because potential CVS server inconsistencies. It is still a good reason these days given actual SVN performance?
Nicht mehr!
Los acentos en castellano omitidos intencionalmente. | Les accents et les signes en français omis intentionnellement.
http://bio.moisesjafet.com
Los acentos en castellano omitidos intencionalmente. | Les accents et les signes en français omis intentionnellement.
http://bio.moisesjafet.com