Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] RFC: attribute management

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Guillaume Rousse <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] RFC: attribute management
  • Date: Tue, 30 Jul 2013 16:09:43 +0200

Le 30/07/2013 14:45, IKEDA Soji a écrit :
Hi,

Anyway, I had a chance to express my position. If someone thinks
"get_" prefix helps understanding by coders, I can not prevent it.
That's rather an attempt to use a constant 'action_object' naming pattern over method names, all over the code. Especially when you have ambiguous words:
- $robot->update_db_field_types
- $robot->get_update_db_field_types
The first one is ambigous, the second isn't.

Use of AUTOLOAD is another issue: It is not a "magic". Dynamic
methods are ordinary things on some programming languages. I
simply used it to implement methods lookalike "attributes".
Just because it exists does not means it is a good idea to use it. See for instance the 'grep test' discussion:
http://jamie-wong.com/2013/07/12/grep-test/

The article is interesting, because it's not just 'thou should never use dynamic code generation', but 'be careful when using it, it may hinder maintainance'.

Another similar case is the usage of source filters, such as for instance the Switch module:
https://metacpan.org/release/Switch

Altough sometimes seen a convenient way to enhance code readability, it is also known to introduces subtle side-effects. I wonder for instance how does it interfer with perl debugger.

In both case, this is a matter of balance between pros and cons.

My point here is than I don't see any added values for:
$robot->web_archive_spam_protection
$robot->spam_protection
$robot->color_5
etc...

Over:
$robot->get_parameter('web_archive_spam_protection')
$robot->get_parameter('spam_protection')
$robot->get_parameter('color_5')

I even think the first one is less self-explanatory, and reduces the visibility of the rest of Sympa::Robot API. Even if it was not implemented through AUTOLOAD...

--
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




Archive powered by MHonArc 2.6.19+.

Top of Page