Re: [PHP] "public static" or "static public"?
I suppose it comes down to preference of the programmer, since there is no standardized rule for it, people adapt it as they find it convenient at the time. On Mon, Jan 31, 2011 at 1:52 PM, David Harkness wrote: > On Mon, Jan 31, 2011 at 3:51 AM, Richard Quadling >wrote: > > > I've just done a quick scan of all my methods ... > > > > I just did the same scan on my code, and the clear majority was > >private abstract final function > > YMMV > > David > -- Mujtaba
Re: [PHP] "public static" or "static public"?
On Mon, Jan 31, 2011 at 3:51 AM, Richard Quadling wrote: > I've just done a quick scan of all my methods ... > I just did the same scan on my code, and the clear majority was private abstract final function YMMV David
RE: [PHP] "public static" or "static public"?
From: Richard Quadling > On 28 January 2011 17:15, Colin Guthrie wrote: >> OK, so it's a Friday hence a random debate >> >> What is preferred for class methods? >> >> class foo >> { >> static public function bar(){} >> >> public static function wibble(){} >> } >> >> ?? >> >> All methods are valid, but are some more valid than others? :p >> >> Checking ZF: >> >> [colin@jimmy Zend (working)]$ cgrep "public static function" . |wc -l >> 755 >> [colin@jimmy Zend (working)]$ cgrep "static public function" . |wc -l >> 60 >> >> It's clear which is preferred there, but still not absolutely consistent >> (I didn't bother checking differently scoped methods). >> >> >> I personally prefer scope first then "static", but others may have valid >> reasons/arguments for preferring the other way. >> >> WDYT? >> > > Arrange these 3 words in the "correct" linguistic. > > shirt, large, green. > > Hopefully, all native English speakers will say > > large green shirt. > > We just do. > > I wonder if the same is true for ... > > final public static function > > I've just done a quick scan of all my methods ... > > 5 abstract protected function > 2 abstract public function > 2 final protected function > 11final public function > 1 final public static function > 1 final static public function > 2 private final function > 12private function > 8 private static function > 120 protected function > 5 public final function > 125 public function > 11public static function > 3 static function > 4 static private function > 7 static protected function > 16static public function > > This is code that is 6 years old. As you can see I'm completely inconsistent. > > If there was some evidence that one order is preferable to another - > pretty much ANY metric would do - then I'd probably adopt it. > > But I don't know if it makes ANY difference. > > OOI. I did the same analysis for Zend Framework (not the most recent, > but a good a representative analysis as any I suppose). > > 1 abstract function > 40abstract protected function > 153 abstract public function > 1 final private function > 1 final protected function > 9 final public function > 2 final public static function > 150 private function > 37private static function > 1 protected abstract function > 1507 protected function > 63protected static function > 5 public abstract function > 2 public final function > 11956 public function > 701 public static function > 1 static function > 1 static private function > 10static protected function > 60static public function > > So, as mixed up as my own. But it is good to know that at least the attributes are commutative. I was never sure about that. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] "public static" or "static public"?
On 28 January 2011 17:15, Colin Guthrie wrote: > OK, so it's a Friday hence a random debate > > > What is preferred for class methods? > > class foo > { > static public function bar(){} > > public static function wibble(){} > } > > ?? > > All methods are valid, but are some more valid than others? :p > > Checking ZF: > > [colin@jimmy Zend (working)]$ cgrep "public static function" . |wc -l > 755 > [colin@jimmy Zend (working)]$ cgrep "static public function" . |wc -l > 60 > > It's clear which is preferred there, but still not absolutely consistent > (I didn't bother checking differently scoped methods). > > > I personally prefer scope first then "static", but others may have valid > reasons/arguments for preferring the other way. > > WDYT? > > Col > > > > -- > > Colin Guthrie > gmane(at)colin.guthr.ie > http://colin.guthr.ie/ > > Day Job: > Tribalogic Limited [http://www.tribalogic.net/] > Open Source: > Mageia Contributor [http://www.mageia.org/] > PulseAudio Hacker [http://www.pulseaudio.org/] > Trac Hacker [http://trac.edgewall.org/] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Arrange these 3 words in the "correct" linguistic. shirt, large, green. Hopefully, all native English speakers will say large green shirt. We just do. I wonder if the same is true for ... final public static function I've just done a quick scan of all my methods ... 5 abstract protected function 2 abstract public function 2 final protected function 11 final public function 1 final public static function 1 final static public function 2 private final function 12 private function 8 private static function 120 protected function 5 public final function 125 public function 11 public static function 3 static function 4 static private function 7 static protected function 16 static public function This is code that is 6 years old. As you can see I'm completely inconsistent. If there was some evidence that one order is preferable to another - pretty much ANY metric would do - then I'd probably adopt it. But I don't know if it makes ANY difference. OOI. I did the same analysis for Zend Framework (not the most recent, but a good a representative analysis as any I suppose). 1 abstract function 40 abstract protected function 153 abstract public function 1 final private function 1 final protected function 9 final public function 2 final public static function 150 private function 37 private static function 1 protected abstract function 1507protected function 63 protected static function 5 public abstract function 2 public final function 11956 public function 701 public static function 1 static function 1 static private function 10 static protected function 60 static public function So, as mixed up as my own. Richard. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] "public static" or "static public"?
On Fri, Jan 28, 2011 at 10:35 AM, Mujtaba Arshad wrote: > Having learned java before even knowing what php was (yeah I'm a noob in > both) I prefer scope static function. I learned Java first, too, and also prefer the scope first. I place a scope on every method, so I'd rather the first word always be the scope rather than sometimes scope, sometimes static. I also think of it as a "static function" that happens to be "public." Finally, I prefer to group static members at the top of the class to differentiate them as a separate API for the class itself.
Re: [PHP] "public static" or "static public"?
Having learned java before even knowing what php was (yeah I'm a noob in both) I prefer scope static function. On Fri, Jan 28, 2011 at 12:20 PM, Fernando wrote: > I personally like scope static fucntion. Coming from C# it just makes more > sense to me. > > JF. > > > On 28/01/2011 12:15, Colin Guthrie wrote: > >> OK, so it's a Friday hence a random debate >> >> >> What is preferred for class methods? >> >> class foo >> { >> static public function bar(){} >> >> public static function wibble(){} >> } >> >> ?? >> >> All methods are valid, but are some more valid than others? :p >> >> Checking ZF: >> >> [colin@jimmy Zend (working)]$ cgrep "public static function" . |wc -l >> 755 >> [colin@jimmy Zend (working)]$ cgrep "static public function" . |wc -l >> 60 >> >> It's clear which is preferred there, but still not absolutely consistent >> (I didn't bother checking differently scoped methods). >> >> >> I personally prefer scope first then "static", but others may have valid >> reasons/arguments for preferring the other way. >> >> WDYT? >> >> Col >> >> >> >> -- Mujtaba
Re: [PHP] "public static" or "static public"?
I personally like scope static fucntion. Coming from C# it just makes more sense to me. JF. On 28/01/2011 12:15, Colin Guthrie wrote: OK, so it's a Friday hence a random debate What is preferred for class methods? class foo { static public function bar(){} public static function wibble(){} } ?? All methods are valid, but are some more valid than others? :p Checking ZF: [colin@jimmy Zend (working)]$ cgrep "public static function" . |wc -l 755 [colin@jimmy Zend (working)]$ cgrep "static public function" . |wc -l 60 It's clear which is preferred there, but still not absolutely consistent (I didn't bother checking differently scoped methods). I personally prefer scope first then "static", but others may have valid reasons/arguments for preferring the other way. WDYT? Col
[PHP] "public static" or "static public"?
OK, so it's a Friday hence a random debate What is preferred for class methods? class foo { static public function bar(){} public static function wibble(){} } ?? All methods are valid, but are some more valid than others? :p Checking ZF: [colin@jimmy Zend (working)]$ cgrep "public static function" . |wc -l 755 [colin@jimmy Zend (working)]$ cgrep "static public function" . |wc -l 60 It's clear which is preferred there, but still not absolutely consistent (I didn't bother checking differently scoped methods). I personally prefer scope first then "static", but others may have valid reasons/arguments for preferring the other way. WDYT? Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php