The Artima Developer Community
Sponsored Link

PHP Buzz Forum
"protected $var", has won by far.

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Tobias Schlitt

Posts: 120
Nickname: dotxp
Registered: Sep, 2004

Tobias Schlitt is a geek, highly addicted to PHP.
"protected $var", has won by far. Posted: Sep 23, 2004 6:47 AM
Reply to this message Reply

This post originated from an RSS feed registered with PHP Buzz by Tobias Schlitt.
Original Post: "protected $var", has won by far.
Feed Title: Tobias Schlitt - Weblog
Feed URL: http://php-applications.de/lists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundapplications/blog/rss.php?category=1_PEAR&version=0.91
Feed Description: a passion for php
Latest PHP Buzz Posts
Latest PHP Buzz Posts by Tobias Schlitt
Latest Posts From Tobias Schlitt - Weblog

Advertisement

The PEAR community has decided on how to deal with protected attributes and methodes regarding the PEAR coding standards for PHP5. In the past private members of a class were prefixed by an underscore (_), the question now was, how to deal with protected members, since they're not private nor public.

The developers had to choose from the following versions:

A (+1 vote in PEPr)


<?php
class Foo {
    protected $somevar;
    protected function somefunc();
}
?>

B (-1 vote in PEPr)


<?php
class Foo {
    protected $_somevar;
    protected function _somefunc();
}
?>

The community decided very unique for the first variation, which is (IMHO) the more logical one, since protected members can become public once, when extending a class. The second variation would then cause to have public members which look like private members.

Currently I assume that in future private members of a class will stay being prefixed by underscores, for the reason of backwards compatibillity and readabillity. Even if private members are declared explicitly inside the code, the code can be understood much better, when they keep branded.

So long: A good decision for PEAR, but just a small sandcorn in the huge amount of pending decisions for PHP5 coding.

ffb

Read: "protected $var", has won by far.

Topic: 16 php|works has arrived! 11 Previous Topic   Next Topic Topic: Searching the Creative Commons

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use