-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Gabor,
Coming back from my holidays, there are tons of mails waiting to be answered.
Sorry for the delay - I try to follow up where needed. Otherwise just ping me.
- -------- Original Message --------
From: "Kiss Gabor [Bitman]" <[EMAIL PROTECTED]>
To: Peter Haag <[EMAIL PROTECTED]>
Subject: [Nfsen-discuss] passing named parameters
Date: Wed Aug 16 2006 11:59:53 GMT+0200 (CEST)
> Dear Peter,
>
> I suggest to change the parameter passing of library routines like
> NfSenRRD::SetupRRD.
>
> Now caller have set up several trivial params in fixed order:
> NfSenRRD::SetupRRD("$NfConf::PROFILESTATDIR/live", $new_source,
> $tstart - 300, 0);
>
> Now I plan to add Holt-Winters forecasting into RRDs and probably
> I'd will have other developments. This may make some parameter lists
> long and messy therefore easy to get it wrong.
>
> Hash-line named parameters are more readable:
>
> NfSenRRD::SetupRRD(
> path => "$NfConf::PROFILESTATDIR/live",
> db => $new_source,
> start => $tstart - 300,
> # No 'force => 0' required because this is the default value
> hw => 1, # add Holt-Winters
> alpha => 0.4,
> # Other optional parameters here
> );
>
> Then function's head could look like this:
>
> sub SetupRRD {
> my %args = @_;
> my $path = $args{path};
> my $db = $args{db};
> my $start = $args{start};
> my $hw = $args{hw}; # undef (=false) if missing
> my $force = $args{force}; # undef (=false) if missing
> my $alpha = $args{alpha} || 0.3;
> my $beta = $args{beta} || 0.002;
> my $gamma = $args{gamma} || 0.05;
>
> What is your opinion?
In general, I'm open to any better coding, but I want to avoid any cluttering
of the code. Changing the the way of calling subroutines in just one or two
subroutines within all the library code in
libexec does not make much sense to me, as it only confuses code reading. At
least the entire module need to be changed. If this is just because of a few
more parameters in a call, then I doubt, if
it's worth the effort. However, for other good reason, I'm open to consider a
change. Maybe a change by module over time could be done and is worth
considering.
- Peter
>
> Regards
>
> Gabor
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Nfsen-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/nfsen-discuss
>
- --
_______ SWITCH - The Swiss Education and Research Network ______
Peter Haag, Security Engineer, Member of SWITCH CERT
PGP fingerprint: D9 31 D5 83 03 95 68 BA FB 84 CA 94 AB FC 5D D7
SWITCH, Limmatquai 138, CH-8001 Zurich, Switzerland
E-mail: [EMAIL PROTECTED] Web: http://www.switch.ch/security
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
iQCVAwUBRQViO/5AbZRALNr/AQISngP+IJsm6DRCx5Bt7yreQkbrTni8wPteLBEP
pj/uiBwrfpoQJMez/tiUu+U1bpRyChbKqiOS/+Of35ZKrkwSYvV+MrML4g0prnZT
xawvp5j35u2p/PaCZuV9i2+2EhxklxWrAs/FwwQ8ewBC2q918FIRwVLyWYwI06/z
QeSsHwmAmm0=
=S2ya
-----END PGP SIGNATURE-----
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nfsen-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nfsen-discuss