Re: Useful Function Names

Joe Stewart <[email protected]> Sun, 19 Oct 2003 07:39:29 +0200
Newsgroups gmane.comp.cms.phpslash.devel
Message-ID <[email protected]>
On Sat, Oct 18, 2003 at 03:43:14PM -0400, Mike Gifford wrote:
> Howdy Joe,
> 
> On Fri, 2003-10-17 at 10:17, Joe Stewart wrote:
> > On Thu, Oct 16, 2003 at 09:23:50AM -0400, Mike Gifford wrote:
> > > One of our developers wasn't too keen on the function names "clean" and
> > > "dirty" in class/functions.inc
> > > In a future release could these be extended so that they are more
> > > descriptive?  cleanUserHTML perhaps?  He'd just like to have as much
> > > meaning built into it as possible.
> > yes.  I saw a note about name collision with getHeader in the BE cvs too.
> 
> It's hard to think of descriptive names some times.  You know what you
> mean and what you want the function to do..  If you could do that it
> would be great.  We'll certainly adopt it.
>

been trying to use psl prefixes of late.

> > > Also in class/slashPerm.class:have_perm() - If single letter variable
> > > names could be avoided or at least commented that would be good. 
> > > Realize this is just a modified version of phplib, but it's always
> > > easier to understand the code when it is written in human. 
> > If it's just the $i integer increments, I'm not too worried about this.  This has been programming convention for a long time.
> 
> There are some $j's in there too..  I'm not all that concerned with
> it..  Teh $i, $ii & $iii, $v, $k conventions are pretty normal.  Wasn't
> sure what $j was referring to though.
> 

old fortran guy.  j is another integer increment.

I see the code in question.  Yes, it needs documenting and rewriting.  k
and v are the key and value.

> > As far as foreach loops instead of for loops.  This has been done as code
> > is worked on and was one of the design goals.
> 
> Yup.  Damn, I was hoping that http://www.phpslash.org was back up so I
> could look at your developers guide so I could just refer folks there
> (as we've done in the past).
> 

http://phpslash.sourceforge.net

This is why I don't use the rooturl.  Both domains served with one setup.

> > Also don't use:
> > for ($i = '0' ; $i < count($allSections_ary) ; $i++) {
> > since the count function is call for each loop.  Instead calculate the
> > count before the loop.
> 
> Interesting..  I didn't realize that..  That might be worth going back
> and cleaning up to boost performance.
> 

I haven't noticed it actually helping significantly.  But better practice.

> > But in general, move to foreach as development continues.  One thing this
> > can do is generate more warnings instead of less in at least one instance.
> 
> Good..
> 
> > Also getting rid of the warnings by defining variables before their use
> > definitely slows down the code measurably.  But I have found a few bugs in
> > the code fixing.
> 
> Yeah..  I figured that there must be a trade off for adding in the extra
> code/variables...  I do think it is easier for folks who are used to
> having the warnings/notices enabled to have an environment that isn't
> flooded with harmless ones..  I've had a couple folks complain about it
> this year.  
> 

Anybody getting them with 0.7.2, either submit a bug or patch please.

Joe

> Mike
> -- 
> Mike Gifford, OpenConcept Consulting
> Free Software for Social Change -> http://www.openconcept.ca
> Beads of Hope Campaign - http://uc.openconcept.ca/petition.php
> Nonconformity is the highest evolutionary attainment of social animals -
> Aldo Leopold
> 


-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise 
Linux in the Boardroom; in the Front Office; & in the Server Room 
http://www.enterpriselinuxforum.com