I cannot speak to the problems you had with getting your code posted,
but the Cake standards are basically PEAR standards... which have been
around for a long time, I think.
I believe in a large coding community it is important to have these
standards. One isn't necessarily right making another wrong, it's just
style and preference... and consistency. I think that's the spirit in
which Cake has put forward these code standards.
Jeff Brown wrote:
Dear list
I just started working with cake last week, I like what I see. So
I wanted to contribute. I began by taking an easy, simple and
very clear Helper module, based on code I've used in 10 or 12 apps
before, though not built for the cake or even a mvc hierarchy.
I signed up in the bakery and submitted an article detailing the simple
and useful little bit. After I saw that the article wasn't even
visible to me after the submit, I looked to see if I was doing
something wrong. I mean the article didn't even show up under my
'My Account' page.
After a careful reading of the 'The
Bakery Article Guidelines' http://bakery.cakephp.org/pages/guidelines
And in particular the one paragraph on 'Coding
Guidelines' with it's link to: https://trac.cakephp.org/wiki/Developement/CodingStandards
I came to the conclusion that the Cake 'team' was full of code nazis,
or at least one such was in charge of the articles.
Don't get me wrong, I have coded to a standard that is as clear
(although I honestly find it clearer than the listed style).
But as many religions on code styling have swayed the programing world
every few years, I've stuck to a best-practices style that is
acceptable to corporate and private enterprises, is clear, concise and
full of comments. However, the verbage on this site seems to
suggest that no matter the value of my contribution, no matter the
clarity of my code, my article was to be ignored.
quote from http://bakery.cakephp.org/pages/guidelines
This is why all
articles submitted to The Bakery
must meet all requirements listed on this page.
Now, my personal and business coding style is not very far removed from
the listed one in almost all points. However, particularly
the section I find particularly odious is the control block section the
"standards" say:
http://trac.cakephp.org/wiki/Developement/CodingStandards#Controlstructures
However, I'll expand on the style to show my contention
Example:
class
MyHelper extends Helper {
function
myFunction($arg) {
if ((expr_1) || (expr_2 )) {
//
action_1;
} elseif (!(expr_3) && (expr_4)) {
//
action_2;
} else {
// default_action;
}
return true;
}
}
Where I would put:
class MyHelper
extends Helper
{
function
myFunction($args)
{
if ((expr_1) || (expr_2 ))
{
// action_1;
}
elseif ((!(expr_3))
&& (expr_4))
{
// action_2;
}
else
{
// default_action;
}
return true;
}
}
As you can see the issue I have is with the "nesting-scope-hiding"
opening bracket position, as I strongly prefer the
"nesting-scope-obvious" opening bracket position.
I tried subitting it again, just now, directly from the "My Account"
page, and this time it was accepted. Maybe the firt time was some
small bug in submitting from a different page (the Code->Helpers
link http://bakery.cakephp.org/articles/add/8
on page: http://bakery.cakephp.org/categories/view/3)?
Anyway, in my
actual summision (yet to be approved but hopefully available soon
at: http://bakery.cakephp.org/articles/view/color-helper-random),
I reformatted it to use the demanded style.
The whole reasong I'm writing this note to the list though is because
in closing all my windows down, I found multiple examples of code using
what I call the "nesting-scope-obvious" opening bracket position: where
opening brackets go on a line by themselves at exactly the same indent
as their control structure, and the closing brackets.
So , am I confused? Is there some dichotomy? Would my code
have been accepted with the "nesting-scope-obvious" opening bracket
position?
I think that in many cases, the style I advocate has saved me crucial
developing time. But if I must rewrite my code into this standard
in order to submit, then I will only submit very small things.
Could the coding style docs include the "nesting-scope-obvious" opening
bracket position, even if the other is prefered?
Jeff
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
|