Re: I need everyones opinon!
| From: | (Philip Hallstrom) | Date: | Thu, 09 Aug 2001 15:55:53 +0000 |
| Subject: | Re: I need everyones opinon! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-62000@lists.php.net to get a copy of this message | ||
I think it is a good idea for class names, but not for function names as
he points out below...
So in the example below you'd want:
class PH_A ....
class PH_B ....
Since my initials are PH... and that's probably going to be unique or at
least more unique than just "A" and "B" so it will be easier to
integrate with other classes.
-philip
In article <OAEEKIKEIHKOPGHNDHJJOELHDNAA.neil.kimber@flytxt.com>,
Neil Kimber <neil.kimber@flytxt.com> wrote:
>
>Not sure I fully understand you. I'm assuming that you mean that you prefix
>each member method with a particular string that relates to the class.
>By doing this you lose a key strength of OOP. Namely the ability to write
>polymorphic code.
>
>In effect, you would not be able to do the following:
>
>class A
> {
> function print()
> {
> print("A");
> }
> }
>
>class B
> {
> function print()
> {
> print("B");
> }
> }
>
>
>$arrObjects[1]= new A();
>$arrObjects[2]= new B();
>
>foreach ($arrObjects as $key->$value)
> {
> $value->print(); // This is the polymorphic piece - the object type is
>decided at run-time
> }
>
>
>If you methods were called A_print() and B_print() then you would not be
>able to build generic code as above.
>
>
>
>-----Original Message-----
>From: Scott Mebberson [mailto:scott@redbluedesign.com]
>Sent: 09 August 2001 08:20
>To: php-general@lists.php.net
>Subject: I need everyones opinon!
>
>
>Hi Guys,
>
>When naming classes and function's within the class(and even
>functions(probably more so?)) do you use a common string infront of
>everything? For example HM_function_name()
>
>The reason I am asking is because what if you want to easily intergrate a
>class/function with lots of other classes/function and then you find out
>there is two with the same name?
>
>Any thoughts on this would be good!
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net