Subject: Developers of Sympa
List archive
- From: Guillaume Rousse <address@concealed>
- To: address@concealed
- Subject: Re: [sympa-developpers] Working on repository
- Date: Mon, 17 Feb 2014 16:29:36 +0100
Le 11/02/2014 01:49, IKEDA Soji a écrit :
[..]
You may consider using stub module. For example,That's exactly what I refered as 'still testable, but undesirable', for the reasons explained previously.
---- stub/Conf.pm -----------------------------------
package Conf;
our %Conf = (tmpdir => '/path/to/tmp', piddir => '/path/to/piddir');
---------------------------------------
or when Site module is available,
---- stub/Site.pm -----------------------------------
package Site;
use constant tmpdir => '/path/to/tmp', piddir => '/path/to/piddir';
---------------------------------------
Then run "PERLLIB=stub:src/lib perl sometest.t".
It will pass only the required values, it will not rely on another
modules, and values will be entirely contollable regardless to
configurations. In short, it will serve purpose for unit test.
You can't argue for encapsulation on the one hand, and consider global variable as desirable on the other hand. Especially without any other reason as minimizing changes.
Mandatory parameter(s) are put on the beginning of argument listWhich introduce yet another style, mixing named and positional parameters...
as unnamed values, then optional parameter(s) follow as named
values.
sub foo {
my $a = shift;
my $b = shift;
my %params = @_;
do_something($a, $b, $params{'c'});
}
So basically, we have three different style for parameters:
A) positional parameters
sub foo {
my ($a, $b, $c) = @_;
}
foo($a, $b, $c);
B) named parameters
sub foo {
my (%params) = @_;
}
foo(arg1 => $a, arg2 => $b, option => $c);
C) mixed parameters
sub foo {
my ($a, $b, %params) = @_;
}
foo($a, $b, option => $c);
I guess everyone here will agree than enforcing consistent style is desirable. Can we have a quick poll on prefered style among other developpers ?
I'm strongly in favor of B, as the most self-describing one. Then A (simplest), then C.
(I've already written on use of "shift" and won't repeat it.)>
Additional note: if options were passed as hashref, it possiblyA class is relevant if there is an underlying semantic, not just to
suggest that some kind of object would be passed instead. You
would possibly be better to consider another way of refactoring
(for example, I created a new "User" class).
group an arbitrary list of options.
[..]
I don't think mixing discussion will help at this point.Furthermore, though this is the issue once discussed,I'd rather assert than those kind of 'feature' were introduced to
removing connection pooling feature from SDM just because it is
complex will obiviously unstabilize Sympa (indeed, it will become
merely unusable). To "cleanup" unneccessary things is not same as
to remove what one does not understand.
workaround flaky design, but I'd prefer to keep this interesting
discussion for a more suitable moment.
Okey, it would be discussed on some other time, but as I have
written, it seems required feature to handle database connection
safely: I'd like you to reread past discussion.
--
Guillaume Rousse
INRIA, Direction des systèmes d'information
Domaine de Voluceau
Rocquencourt - BP 105
78153 Le Chesnay
Tel: 01 39 63 58 31
Attachment:
smime.p7s
Description: Signature cryptographique S/MIME
-
Re: [sympa-developpers] Working on repository,
David Verdin, 02/05/2014
- Re: [sympa-developpers] Working on repository, Marc Chantreux, 02/05/2014
-
Re: [sympa-developpers] Working on repository,
IKEDA Soji, 02/05/2014
-
Re: [sympa-developpers] Working on repository,
David Verdin, 02/05/2014
-
Re: [sympa-developpers] Working on repository,
IKEDA Soji, 02/06/2014
-
Re: [sympa-developpers] Working on repository,
Guillaume Rousse, 02/10/2014
-
Re: [sympa-developpers] Working on repository,
IKEDA Soji, 02/11/2014
-
Re: [sympa-developpers] Working on repository,
Guillaume Rousse, 02/17/2014
- Re: [sympa-developpers] Working on repository, IKEDA Soji, 02/18/2014
- Re: [sympa-developpers] Working on repository, Guillaume Rousse, 02/24/2014
- Re: [sympa-developpers] Working on repository, David Verdin, 02/25/2014
- Re: [sympa-developpers] Working on repository, IKEDA Soji, 02/25/2014
- Re: [sympa-developpers] Working on repository, Guillaume Rousse, 02/26/2014
- Re: [sympa-developpers] Working on repository, Guillaume Rousse, 02/26/2014
- Re: [sympa-developpers] Working on repository, David Verdin, 02/26/2014
- [sympa-developpers] subroutine template was Re: Working on repository, IKEDA Soji, 02/27/2014
-
Re: [sympa-developpers] Working on repository,
Guillaume Rousse, 02/17/2014
-
Re: [sympa-developpers] Working on repository,
IKEDA Soji, 02/11/2014
-
Re: [sympa-developpers] Working on repository,
Guillaume Rousse, 02/10/2014
-
Re: [sympa-developpers] Working on repository,
IKEDA Soji, 02/06/2014
-
Re: [sympa-developpers] Working on repository,
David Verdin, 02/05/2014
Archive powered by MHonArc 2.6.19+.