From: Andreas A. <a.a...@th...> - 2001-07-08 18:55:05
|
Hi Alex, > well, looks like private vars will be supported, so a naming standard is > relevant. Well for better readabiliy of course. But since private member vars are only in the scope of the class they belong to (with engine 2.0) and every attempt to access them will fail in an fatal error, the idea is to define as much variables as possible as private and use accessors to get/set them (maybe to perform additional checks). So class variables exposed to the public are reduced to a minium. >> But there should be an convention that classvars should only be accessed by >> getVarname(), setVarname() methods. So this implies all that all varnames >> without an accessor are private ones. > Hmm, I don't know if I agree with that. > What does it get you? i.e. why not, $ClassName->var ? > is there a reason to create a method name to match each public class var? Currently, not an objective reason ;-) Personally I feel better to access variables with get/set routines from outside the class and with $this->varname from the inside. But maybe with Engine 2.0 this could be an issue. If you switch some vars to private and you call them from outside the class with $ClassName->var this will cause an fatal error. >> - multiple Inheritances* >> - private member vars* >> - static member vars >> - exception handling (throw, try, catch) > no shit? No shit, I have a Zend Engine 2.0 Overview flyer here. And Peter pointet out the complete doc. > in any case, doesn't look like varnames are a big controversy :) No they are not. An they should not be. It was just a thought on this topic. Andi |