Joomla! Discussion Forums



It is currently Thu Nov 26, 2009 7:43 am (All times are UTC )

 




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: coding standards
Posted: Wed Mar 28, 2007 6:56 pm 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Thu Aug 18, 2005 6:02 pm
Posts: 297
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.


Top
  E-mail  
 
 Post subject: Re: coding standards
Posted: Wed Mar 28, 2007 9:22 pm 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Wed Nov 16, 2005 2:02 am
Posts: 459
Location: Breklum - Nordfriesland
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


Top
   
 
 Post subject: Re: coding standards
Posted: Wed Mar 28, 2007 9:45 pm 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Thu Aug 18, 2005 6:02 pm
Posts: 297
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.


Top
  E-mail  
 
 Post subject: Re: coding standards
Posted: Wed Mar 28, 2007 10:07 pm 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Wed Nov 16, 2005 2:02 am
Posts: 459
Location: Breklum - Nordfriesland
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.


Top
   
 
 Post subject: Re: coding standards
Posted: Thu Mar 29, 2007 6:29 am 
User avatar
Joomla! Ace
Joomla! Ace
Offline

Joined: Mon Dec 05, 2005 10:17 am
Posts: 1318
Location: New Orleans, LA, USA
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


Top
  E-mail  
 
 Post subject: Re: coding standards
Posted: Thu Mar 29, 2007 9:43 pm 
User avatar
Joomla! Ace
Joomla! Ace
Offline

Joined: Wed Aug 17, 2005 11:03 pm
Posts: 1356
Location: New Orleans, Louisiana
This is all being revised at the following url: http://dev.joomla.org/component/option, ... ds:coding/

Louis

_________________
Development Working Group Coordinator
http://webimagery.net - Consulting
http://jxtended.com - Solutions for Joomla! 1.5
A hacker does for love what others would not do for money.


Top
  E-mail  
 
 Post subject: Re: coding standards
Posted: Fri Mar 30, 2007 1:45 pm 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Thu Aug 18, 2005 6:02 pm
Posts: 297
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.


Top
  E-mail  
 
 Post subject: Re: coding standards
Posted: Wed Apr 11, 2007 12:25 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Mon Nov 13, 2006 11:31 am
Posts: 181
Location: Toronto, Canada
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 -- Development Team, Bug Squad, Security Strike Team, Extension Developer
Biz: http://www.abivia.net
Blog: http://www.ambitonline.com/nextrelease


Top
  E-mail  
 
 Post subject: Re: coding standards
Posted: Fri Jul 20, 2007 12:27 pm 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Mon Dec 12, 2005 5:34 pm
Posts: 410
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


Top
   
 
 Post subject: Re: coding standards
Posted: Sun Jul 22, 2007 7:15 pm 
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Wed Sep 27, 2006 11:55 pm
Posts: 344
The complete source code of version 1.5 should be converted using spaces for indentation! This ist not a huge problem.


Top
  E-mail  
 
 Post subject: Re: coding standards
Posted: Sun Sep 02, 2007 6:25 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Thu Mar 02, 2006 9:41 am
Posts: 216
Location: Santo Domingo, Dominican Republic
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


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group