Re: Code Style Fanaticism

2007-10-03 Thread Sonic Baker
Sorry to butt in but,

If the bakery code is intelligently to recognise different styles then would
it be much of a job to automatically reformat the submitted code rather than
have the user do it? Couldn't it call the indent program via the command
line?

Just wondering cause I also prefer the nesting-scope-obvious opening
bracket position.

Cheers,

Sonic

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Code Style Fanaticism

2007-09-26 Thread Dérico Filho

Hi!


I just read the Coding standards for Cake, I guess CakePHP take the
words of the prophets KR + tab.

That's OK... It's been around for 30 or 40 years... I like it.

BTW, Jeff, perhaps you should look also look on this matter as a
Convention over configuration point of view...

If you want to stick to CakePHP, you'd better follow even the style
conventions, imho.


Dérico Filho


On 25 set, 13:53, Brent Rieck [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
  Man I guess I'm really not getting my point across.  This will be my
  last try, I promise :)

 Code formatting debates are religious debates, there's no point in
 having them and no matter what you say you'll never change anyone's
 opinion.

 Indent provides a way around (or through?) these stupid debates so you
 can do something more fun.

 Yes, the Cake people could just use indent on submitted code too.

 But no, I don't think the language on their submission instruction pages
 is scary or a stumbling block.  The lack of complete documentation is a
 *much* larger stumbling block in my opinion.

 --Brent


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Code Style Fanaticism

2007-09-25 Thread [EMAIL PROTECTED]

Brent,

Thanks for the advice, I've been on *nix for what seems like forever,
and I've known and used indent before.  But I'm sure others will be
able to use the advice as well.

Man I guess I'm really not getting my point across.  This will be my
last try, I promise :)

I mean the submission pages (admitedly for the bakery and not the
mailing list or other aspects of the Cake PHP world), has language
that gave me pause due to an error in the posting software.  And if I
hadn't had some time to reformat, and look around, I might not have
posted.  But you see, I'm a stuborn coder.  And I knew I had something
pretty 'Ok' to share.  Not earth-shattering, but also not represented
by the existing code base.

My point is, not all people are familiar with the indent program, not
all people have the time to re-indent by hand, and the verbage on the
submission page looks forbidding, this is in contrast to the fact that
the documentation seems to ignore the CakePHP style guidelines,
particularly as concerns opening bracket position.  (Though also
Trinary If and a few parenthesis positions)

So the question is, Don't you think that the language as presented
might be a stumbling block for those who might otherwise submit
code?  I ask this in light of the fact that other places on the
pages, the Bakery says that authors get a chance to learn and grow by
working with experienced cakers.  To me, and apparently that's only to
me :) , that seems like a dichotomy, saying one thing and doing
another.  Do what I say, not what I do.   :)

Ah well, I'll asume that if it's this hard to make the point, then I
didn't really have a solid worthwhile point to make.  I'll take my
peice of cake, sit in the corner and stop trying to change the
world :)

Jeff

On Sep 24, 11:14 pm, Brent Rieck [EMAIL PROTECTED] wrote:
 Jeff Brown wrote:
  So , am I confused?  Is there some dichotomy?  Would my code have been
  accepted with the nesting-scope-obvious opening bracket position?

 If you're on a unix-like machine look into the indent program, the
 code formatting problem was solved in 1976.  If you're on windows I'm
 sure there's some equivalent tool out there (or the cygwin stuff may
 have it included).

 With indent, once you've figured out the set program options to render
 the code how you like to work with it and the set of options to render
 it how whomever you're submitting to likes to see it, it'll take
 fractions of seconds to reformat the code to and from either and
 everybody will be happy.

 --Brent


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Code Style Fanaticism

2007-09-25 Thread Brent Rieck

[EMAIL PROTECTED] wrote:
 Man I guess I'm really not getting my point across.  This will be my
 last try, I promise :)

Code formatting debates are religious debates, there's no point in 
having them and no matter what you say you'll never change anyone's 
opinion.

Indent provides a way around (or through?) these stupid debates so you 
can do something more fun.

Yes, the Cake people could just use indent on submitted code too.

But no, I don't think the language on their submission instruction pages 
is scary or a stumbling block.  The lack of complete documentation is a 
*much* larger stumbling block in my opinion.

--Brent


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Code Style Fanaticism

2007-09-24 Thread Joshua Benner





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 cake-php@googlegroups.com  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  -~--~~~~--~~--~--~---





Re: Code Style Fanaticism

2007-09-24 Thread Chris Hartjes

On 9/24/07, Jeff Brown [EMAIL PROTECTED] wrote:
  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.

Well, coding standards are like team chemistry in professional
sports:  they only matter when something goes wrong.

Now, I can appreciate that you think your own coding standard is
better than what CakePHP is advocating, and that's fine.  But if you
want to contribute things, then there are some rules that need to be
followed.  I remember my first contribution to CakePHP was ripped
apart and reformatted by PhpNut.  Didn't like my tab stops in my
editor or something, but that's his right as the lead developer.

Childish?  Maybe.  Given the level of arguments I've seen about tabs
vs. spaces and 4 spaces to a tab vs. 8 spaces I have decided that
adhering to a code standard for a project is just another level of
self-discipline that you choose to adhere to or suffer the
consequences of your peers.

If your only reason to not submit to the bakery because you feel that
the core development team is (to use your own words) full of code
nazis, well, I think it says more about you than the coding standard
itself.  As one of the chosen few who can peek at articles before they
are approved, I see nothing wrong with your submission.  But then
again I'm not a code nazi.

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation
http://www.cakedevelopment.com

My motto for 2007:  Just build it, damnit!

@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Code Style Fanaticism

2007-09-24 Thread John David Anderson (_psychic_)


On Sep 24, 2007, at 2:16 PM, Chris Hartjes wrote:


 On 9/24/07, Jeff Brown [EMAIL PROTECTED] wrote:
  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.

 Well, coding standards are like team chemistry in professional
 sports:  they only matter when something goes wrong.

 Now, I can appreciate that you think your own coding standard is
 better than what CakePHP is advocating, and that's fine.  But if you
 want to contribute things, then there are some rules that need to be
 followed.  I remember my first contribution to CakePHP was ripped
 apart and reformatted by PhpNut.  Didn't like my tab stops in my
 editor or something, but that's his right as the lead developer.

More than right vs. wrong, its simply a matter of consistency. Having  
all the code examples in Bakery articles look exactly the same makes  
things easier to digest, imho.

-- John

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Code Style Fanaticism

2007-09-24 Thread [EMAIL PROTECTED]

Chris,

On rereading my message, I think my use of 'code nazis' was too
harsh.  (Although I was trying to make light of it somewhat, And I did
refer to myself as a code-nazi as well in one of my pre-submit
versions of my note, but I seem to have cut that out...  :)

What I was trying to get across, is that the verbage on the summision
page looks exceedingly strict, more strict than it seems it really is,
since other articles ARE there with my prefered intenting style.

I get what you mean about 'Team Spirit' and agree whole-heartedly,
which is why I maintain my standards, and have done so at every
company and personal project I've worked on for years.  Again, I'm not
saying having the style is wrong.  Because I think it's right.  I'm
saying having the note on the site almost kept me from submitting the
article, when the first try failed.  I decided to post with the
rewrite, only because It was so small.

For example, even adding the word recommended in one or two places
would be acceptable.

I mean, if I'm getting some code from the Bakery for use in an
application I'm writing, I'll certainly take it as is.  I'm not going
to go reformat it, unless, as you mention, I run into some trouble.



Joshua,

I first looked at PHP in 1997, using it to build and modify a very
small application.  As the syntax is very similar to the C/C++ body of
languages, I applied my standards to it with great success.  This was
all prior to PEAR comming around, and more importantly before the PEAR
standards were even vocallized.

I'd thought about mentioning it in my first note, but didn't. I'm not
going to try and change every php project in the world.  I'm not even
trying to change every cake project in the world.  I just think you
can read either code style equally, why declare that all other won't
even be considered?

Just looking to prevent others out there from not submitting code
based on that warning.

Peace,

Jeff







On Sep 24, 2:16 pm, Chris Hartjes [EMAIL PROTECTED] wrote:
 On 9/24/07, Jeff Brown [EMAIL PROTECTED] wrote:

   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.

 Well, coding standards are like team chemistry in professional
 sports:  they only matter when something goes wrong.

 Now, I can appreciate that you think your own coding standard is
 better than what CakePHP is advocating, and that's fine.  But if you
 want to contribute things, then there are some rules that need to be
 followed.  I remember my first contribution to CakePHP was ripped
 apart and reformatted by PhpNut.  Didn't like my tab stops in my
 editor or something, but that's his right as the lead developer.

 Childish?  Maybe.  Given the level of arguments I've seen about tabs
 vs. spaces and 4 spaces to a tab vs. 8 spaces I have decided that
 adhering to a code standard for a project is just another level of
 self-discipline that you choose to adhere to or suffer the
 consequences of your peers.

 If your only reason to not submit to the bakery because you feel that
 the core development team is (to use your own words) full of code
 nazis, well, I think it says more about you than the coding standard
 itself.  As one of the chosen few who can peek at articles before they
 are approved, I see nothing wrong with your submission.  But then
 again I'm not a code nazi.

 --
 Chris Hartjes
 Senior Developer
 Cake Development Corporationhttp://www.cakedevelopment.com

 My motto for 2007:  Just build it, damnit!

 @TheKeyboard -http://www.littlehart.net/atthekeyboard


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---