On Wed, Aug 12, 2009 at 8:31 AM, Andrew Garrettagarrett@wikimedia.org wrote:
On 12/08/2009, at 1:16 AM, Chad wrote:
On the whole "new code" front. Can we all /please/ remember that we're writing PHP5 here. Visibility on all new functions and variables should also be a must.
I honestly don't think this is that important. We should err on the side of public, not private or protected.
Very frequently, I've had to change visibility on functions because somebody hasn't anticipated a case where a class function might be usefully called from outside that class.
-- Andrew Garrett agarrett@wikimedia.org http://werdn.us/
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
When writing maintenance, I tried to make very concious decisions about what visibility to put on each method. For clearly defined public interfaces, I made the methods public. Some of the setup functions don't need accessing and I probably don't want children implementing them, so I made them private. I think making careful decisions when coding can lead to well-written classes with proper visibility. If a particular method/variable needs to become public at a later point, it can easily be changed.
My main point is not so much "make things private" but at least look like we're writing code in the last 4 years.
-Chad