From: alex b. <en...@tu...> - 2001-05-13 18:21:21
|
> Cool. Great work. But think the code conventions are a bit confusing (to > me). For example. The mehtod names are named like: "Set_Name". The > uppercase/lowercase thing seperates engough, so why add a "_"? and why start > with a capital letter (classnames already start with a capital letter). To > me it's more smooth to name functions that way: > > public: setName(); ( $obj->setName() vs. $obj->Set_Name() ) > private: _setName(); > > or that way: > > set_name(); > _set_name(); > > You alread do: $_my_variable_name vs. $_myvariablename. That should be in > line with the other naming conventions. I'm actually open to changing those, assuming there is a general consensus here on what they _should_be. > Also the global vairable naming. Varibale names starting with a _ are > global. On the other hand methods starting with a _ should be considered as > private!? Could be a bit confusing - ok its another context but not very > linear, in my mind. The private method thing is a standard. The reason for the global standard (and yeah, I thought of that, i.e. it might be a little strange) is because you can put: /index.php?.foo=hello and get in php: $_foo which is quite useful, because you have a good way of always identifying what came in frmo the user, as opposed to "internal" variables. It's _very_ important to have a variable naming domain that identifies user input, in my opinion. > At the this is not really as important as other topics. It's important the > the conventions (no matter in what form they are applied) are constantly > used. > > So what does the community think? Right, funnily enough it's almost more important that there _is_ a standard :) But again, for those of you with suggestions, etc please speak up. Some of the code it written, but I'm happy to change it. Also, in the near future, I will push the r2 core cvs out to binarycloud.com, where I will continue development pubically. For those interested in participating, I'll set up accuonts for pserver. There will be a running install of binarycloud r2 w/MySQL on that box. > -- > BTW: I'm working on a set of code standards for our internal projects. They > are heavyly based on PEAR and the Java Code Standards which I think are a > good base to work with. We "ported" them to PHP. You can download them here: > http://www.thyrell.de/info/downloads/CodeGuide.pdf heh, your app framework is called storm - which is the name of the binarycloud admin interface. I also see why you find the $_global_variable_name standard yucky, because you have it defined just the opposite in your docs. This is one of the few things I consider to be quite important, actually: some simple, easily identifyable "this is coming from the outside" naming convention. I have used .var with good results, it's easier to track the security of a codebase. _alex |