Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] [sympa-commits] sympa[11063] trunk/src/lib/Sympa/Message.pm: [dev] pass required values as parameters, instead of accessing configuration directly

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Guillaume Rousse <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] [sympa-commits] sympa[11063] trunk/src/lib/Sympa/Message.pm: [dev] pass required values as parameters, instead of accessing configuration directly
  • Date: Wed, 25 Jun 2014 11:18:20 +0200

Le 25/06/2014 10:42, IKEDA Soji a écrit :
Guillaume,

Can a method like Site->set_parameter() solve the problem you are
encountered?
As stated in my original answer, the problem I see is direct access to the application configuration from a message object. Changing anything on Site class side won't help here.

Simple components (messages, lists, spools, etc...) should not access the configuration themselves, because that makes them dependant of current configuration API. That is usually referred as "strong coupling", and makes changing parts of Sympa code difficult.

It also make those components able to read whatever information they need, without declaring it explicitely (so long for explicit interfaces), and even potentially change this configuration silently (so long for encapsulation). Giving more privileges than needed to a specific component also violates defensive programation principles.

The simple solution to both issue is just to restrict configuration access to the application core, and provide all relevants information to software components either at instanciation time, either when calling specific methods.
--
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