[RFC & Patch][Implemented] Coding Guidelines
[RFC & Patch][Implemented] Coding Guidelines
Information about the RFC on the wiki: http://wiki.phpbb.com/PhpBB4/RFC/Coding_Guidelines
The current document can be found on github in my coding-guidelines branch: http://github.com/naderman/phpbb/blob/c ... s.markdown A small tool for converting the document to HTML can be found in the develop/ directory.
Please discuss! If you want to contribut changes, you can post a patch (created with git format-patch) here. Alternatively you can fork the official repository on github yourself: http://github.com/phpbb/phpbb You can then add naderman/phpbb as an additional remote, pull the branch from it, make your changes, and let me know to pull them back into my repository.
The current document can be found on github in my coding-guidelines branch: http://github.com/naderman/phpbb/blob/c ... s.markdown A small tool for converting the document to HTML can be found in the develop/ directory.
Please discuss! If you want to contribut changes, you can post a patch (created with git format-patch) here. Alternatively you can fork the official repository on github yourself: http://github.com/phpbb/phpbb You can then add naderman/phpbb as an additional remote, pull the branch from it, make your changes, and let me know to pull them back into my repository.
Re: [RFC & Patch] Coding Guidelines
The only thing I don't like is spaces instead of tabs. I just hate looking at someone else's mess who didn't use tabs.
Re: [RFC & Patch] Coding Guidelines
If you can update your post Naderman, its http://github.com/phpbb/phpbb
Tabbing -> Spacing
Question: Why will phpBB 4 be using SPACES instead of TABS?
Answer: So the code always looks the same regardless of what width you have your tabs set to.
Having their tabs set to a width of 2 or 8 often caused people to indent incorrectly with tabs.
Tabs also don't work very will in the middle of a line when trying to line up variable assignments for example.
Answer: So the code always looks the same regardless of what width you have your tabs set to.
Having their tabs set to a width of 2 or 8 often caused people to indent incorrectly with tabs.
Tabs also don't work very will in the middle of a line when trying to line up variable assignments for example.
Re: [RFC & Patch] Coding Guidelines
Looks good to me as well aside from one minor thing (which Dog Cow already mentioned) -- the use of spaces instead of tabs. To be honest I don't understand the rationale here -- correct me if I'm wrong the purpose is so the code looks visually identical (or close) regardless of one's text editor settings. Even if that is the case, one will still likely need to configure their text editor to use spaces as tabs, which seems to defeat the purpose.
If nothing else, in most other projects I've seen, tabs seem to be the de facto standard. Changing it seems more like it would cause more annoyance than benefit.
Other than that, looks good -- reads well, clear, and above all, makes sense. Good work.
If nothing else, in most other projects I've seen, tabs seem to be the de facto standard. Changing it seems more like it would cause more annoyance than benefit.
Other than that, looks good -- reads well, clear, and above all, makes sense. Good work.
My phpbb.com account
Note that any of my opinions expressed in RFC topics are my own and not necessarily representative of the opinion of the phpBB Team.
Note that any of my opinions expressed in RFC topics are my own and not necessarily representative of the opinion of the phpBB Team.
Re: [RFC & Patch] Coding Guidelines
I actually like spaces. it bothers me when I open up a file and it's obvious my tab widths are different from the target width, making the mess unreadable.
As for having trouble getting people to use spaces instead, a hook could be setup that would automatically convert tabs to spaces. Problem solved.
Looks pretty solid. My only complaint is you used php instead of PHP and html instead of HTML sometimes .
As for having trouble getting people to use spaces instead, a hook could be setup that would automatically convert tabs to spaces. Problem solved.
Looks pretty solid. My only complaint is you used php instead of PHP and html instead of HTML sometimes .
- onehundredandtwo
- Registered User
- Posts: 33
- Joined: Mon Feb 02, 2009 6:55 am
Re: [RFC & Patch] Coding Guidelines
I don't like the CamelCase (instead of camel_case). The variable without camel-case looks a lot cleaner to me.
Code: Select all
$my_var
$myVar
Need help preventing spam? Read Preventing spam in phpBB 3.0.6 and above
Re: [RFC & Patch] Coding Guidelines
It would be nice if rather than just stating what you like or don't you could give some rational arguments as to why one or ther other is better otherwise I don't think there is reason for change.
- bantu
- 3.0 Release Manager
- Posts: 557
- Joined: Thu Sep 07, 2006 11:22 am
- Location: Karlsruhe, Germany
- Contact:
Re: [RFC & Patch] Coding Guidelines
I'd like to suggest to add a rule that the last line of a text file should end with "\n".
Example
Changingtowill list the $someVar-Line as modified in the repository, which should not be.
It should befrom the beginning, so you can easily add
Example
Changing
Code: Select all
..."\n"
$someVar = false;
Code: Select all
..."\n"
$someVar = false;"\n"
$someOtherVar = false;
It should be
Code: Select all
..."\n"
$someVar = false;"\n"
Code: Select all
$someOtherVar = false;"\n"