RE: [PEAR-QA] CS questions

From: Date: Sun, 23 Nov 2003 14:37:05 +0000
Subject: RE: [PEAR-QA] CS questions
References: 1  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-228@lists.php.net to get a copy of this message
> From: Klaus Guenther [mailto:klaus@capitalfocus.org] > Sent: Sunday, November 23, 2003 3:33 PM > From: "Lukas Smith" <smith@backendmedia.com> > > However we also have the golden rule that Class names should cleanly map > to > > Installdirs by mapping "_" to "/". > > > > Now this would imply that 2) is actually a CS violation! > > Yes, I think so. However, we shouldn't clutter the root directory too > much. > And anyway, why is the LiveUser cvs directory called Perm_LiveUser? > Doesn't > that indicate that LiveUser.php should be installed as Perm/LiveUser.php? > Iirc, LU used to be in the perm directory, but now has a top-level > directory. Don't know if that's really a good thing. Because if we accept > another authentification/permission package, it would also be top level? > Personally I'm not sure that's a good thing. Only categories should have > top-level directories (of course, DB is both a package and a category at > the > same time, and should stay in the same place for legacy reasons). Yeah true. Which would also mean that LiveUser would have to fix it's class names and prepend them with a 'Perm_'. > > II) I have another questions: > > Is a classname like "DB_mysql" allowed? Or should this really be > DB_Mysql? > > In that case the file should also be called Mysql.php and not mysql.php? > > Should we even care? > > Yes, it should indeed be capitalized. See > http://pear.php.net/manual/en/standards.naming.php Keeping this > standard > prevents typos from clogging up our list ("How come > include('DB/Mysql.php') > doesn't work?") Of course, windows users won't have this problem, but it's > a > good thing to keep things uniform. Yes .. especially with autoload coming up with php5. > > III) Finally another question: > > How about variable names? > > We have a few people that use studlyCaps even for variable names. > > Other people simply use underscores to separate words. Should be find a > > standard here? Should be not even care? > > In my understanding, variable names fall under the same CS as function > names -- studlyCaps. That's what I've used in all my packages, too. It > makes > it much easier to read the classes if CS is uniform. However, I see in the > manual that there is no mention of variable naming standards. And the > example for global variables doesn't use it either, though imho, global > variables should follow the class naming pattern. > http://pear.php.net/manual/en/standards.naming.php I think half of PEAR does it one way and half the other :-/ > > IV) ok now really the last one: > > Whatever happened to the CS that true, false and null should be > lowercased? > > I seem to remember that this was a CS requirement (which I really hate > too) > > that was featured in the manual. Now that I changed everything for MDB > 2.x > I > > cant seem to find it in the manual anymore. > > Well yes, I remember it being in the manual, too. Do you know what > happened > to it, Martin? Regards, Lukas

« previous php.pear.qa (#228) next »