coding standards

User avatar
Jonah
Joomla! Explorer
Joomla! Explorer
Posts: 299
Joined: Thu Aug 18, 2005 6:02 pm
Contact:

coding standards

Postby Jonah » Wed Mar 28, 2007 6:56 pm

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
trinitywebhosting.com - Free Joomla! websites for churches and non-profits.

User avatar
nibra
Joomla! Guru
Joomla! Guru
Posts: 588
Joined: Wed Nov 16, 2005 2:02 am
Location: Breklum - Nordfriesland
Contact:

Re: coding standards

Postby nibra » Wed Mar 28, 2007 9:22 pm

lamad wrote:According to http://help.joomla.org/content/view/826/125/ Joomla! uses PEAR standards, including a 4 space no tab indentation.


Yes, that is the way it should be.

lamad wrote:However, both Joomla! 1.0.x and 1.5.x use tabs throughout.
I'm assuming the documentation should be changed?


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:Personally, prefer tabs anyway because of document weight and user friendliness (you can change tabs to be however long you want in your editor).


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.

Niels

User avatar
Jonah
Joomla! Explorer
Joomla! Explorer
Posts: 299
Joined: Thu Aug 18, 2005 6:02 pm
Contact:

Re: coding standards

Postby Jonah » Wed Mar 28, 2007 9:45 pm

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.


Ok, we're talking the entire codebase here.  ;)

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.

User avatar
nibra
Joomla! Guru
Joomla! Guru
Posts: 588
Joined: Wed Nov 16, 2005 2:02 am
Location: Breklum - Nordfriesland
Contact:

Re: coding standards

Postby nibra » Wed Mar 28, 2007 10:07 pm

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.

User avatar
RobS
Joomla! Ace
Joomla! Ace
Posts: 1367
Joined: Mon Dec 05, 2005 10:17 am
Location: New Orleans, LA, USA
Contact:

Re: coding standards

Postby RobS » Thu Mar 29, 2007 6:29 am

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

User avatar
louis.landry
Joomla! Ace
Joomla! Ace
Posts: 1388
Joined: Wed Aug 17, 2005 11:03 pm
Location: San Jose, California
Contact:

Re: coding standards

Postby louis.landry » Thu Mar 29, 2007 9:43 pm

This is all being revised at the following url: http://dev.joomla.org/component/option, ... ds:coding/

Louis
Joomla Platform Maintainer
A hacker does for love what others would not do for money.

User avatar
Jonah
Joomla! Explorer
Joomla! Explorer
Posts: 299
Joined: Thu Aug 18, 2005 6:02 pm
Contact:

Re: coding standards

Postby Jonah » Fri Mar 30, 2007 1:45 pm

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.

User avatar
instance
Joomla! Explorer
Joomla! Explorer
Posts: 302
Joined: Mon Nov 13, 2006 11:31 am
Location: Toronto, Canada

Re: coding standards

Postby instance » Wed Apr 11, 2007 12:25 am

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"...


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".

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

User avatar
CirTap
Joomla! Explorer
Joomla! Explorer
Posts: 418
Joined: Mon Dec 12, 2005 5:34 pm

Re: coding standards

Postby CirTap » Fri Jul 20, 2007 12:27 pm

instance wrote:This is particularly irritating since I am having trouble convincing Eclipse to support spaces in one project and tabs in the next.

then pull out the sledge hammer: http://www.eclipse.org/dash/index.php

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

StarShaper
Joomla! Explorer
Joomla! Explorer
Posts: 347
Joined: Wed Sep 27, 2006 11:55 pm

Re: coding standards

Postby StarShaper » Sun Jul 22, 2007 7:15 pm

The complete source code of version 1.5 should be converted using spaces for indentation! This ist not a huge problem.

User avatar
moijafcor
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 218
Joined: Thu Mar 02, 2006 9:41 am
Location: Santo Domingo, Dominican Republic
Contact:

Re: coding standards

Postby moijafcor » Sun Sep 02, 2007 6:25 pm

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


Return to “Quality and Testing - Locked and Archived”

Who is online

Users browsing this forum: No registered users and 1 guest