[Koha-devel] koha code cleaning bug?

Sébastien Nadeau Sebastien.Nadeau at bibl.ulaval.ca
Mon Sep 29 16:26:28 CEST 2008


Hi Marc,

I understand your point better now.

I think this is the kind of stylistic improvement that must be done.

But about the iterator variable, here's what Damian Conway says in his 'Perl Best Practices' great book:

	"From a readability standpoint, $_ is a terrible name for a variable, especially for an iterator variable. It conveys nothing about the nature or purpose of the values it stores, except that they're currently being iterated in the innermost enclosing loop."

He then gives examples to show how things can go down rapidly. I tend to agree with that because as the code evolves, the inner content of the block may change and sooner or later an explicit iterator variable will be needed.

I would even go as far as to say that it should be established as a coding rule for everyone in an important project like this one.

Sébastien


 

> -----Message d'origine-----
> De : koha-devel-bounces at lists.koha.org 
> [mailto:koha-devel-bounces at lists.koha.org] De la part de Marc 
> Chantreux
> Envoyé : 29 septembre 2008 10:02
> À : koha-devel at lists.koha.org
> Objet : Re: [Koha-devel] koha code cleaning bug?
> 
> On Mon, Sep 29, 2008 at 09:36:21AM -0400, Sébastien Nadeau wrote:
> > Hi Marc,
> 
> hello, 
> 
> If i paid attention to this code: 
> 
> - i used File::Spec::splitdir to create the directories using 
> mkdir builtin.
> - i tested if the $authorityserverdir exists before the loop (no need
>   to test the existence of all of them if the parent one does 
> not exist)
> - i read the coding style to see what about $_. I'm a fan of it
>   because i immediately read is as "the main variable of the loop".
>   I only use it in little, unnested loops.
> 
> I didn't: this was just an example to ask the koha people if 
> such a cleanning work is welcome. 
> 
> > I hope I'm not looking too pretentious for my first post.
> 
> even if i disagree with you, it's good to have other points 
> of view in mind. 
> 
> regards
> 
> --
> Marc Chantreux
> http://www.biblibre.com
> Expert en Logiciels Libres pour l'info-doc 
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha.org
> http://lists.koha.org/mailman/listinfo/koha-devel
> 



More information about the Koha-devel mailing list