J
jhumanski
At my place of employment, a philosophical discussion is going on
within the development group. Say you have the following package
definition:
package MyPackage;
use strict;
....
sub new {
my $class = shift;
my $self = bless {}, $class;
$self->_init();
return $self;
}
sub _init {
my $self = shift;
foreach my $property ('func1', 'func2', 'func3', 'func4') {
$self->$property();
}
}
sub func1 {...}
sub func2 {...}
sub func3 {...}
sub func4 {...}
In this example, the private method _init is invoking package methods
using symbolic references.
Many in the development team don't have a problem with this. They
consider it a clean and extendible solution. While they recognize
that symbolic references in general are bad, they justify this
solution by stating that the use of the symbolic references is
controlled and, hence, with little risk.
I am in the minority. I am looking for justification (other than the
standard mantra that symbolic references are bad) that this practice
should be discouraged. I have googled this topic but have not found
any specific examples that state why this practice is bad.
I am looking for this group's opinion. Any examples that demonstrate
why this is bad (or good) practice are appreciated.
within the development group. Say you have the following package
definition:
package MyPackage;
use strict;
....
sub new {
my $class = shift;
my $self = bless {}, $class;
$self->_init();
return $self;
}
sub _init {
my $self = shift;
foreach my $property ('func1', 'func2', 'func3', 'func4') {
$self->$property();
}
}
sub func1 {...}
sub func2 {...}
sub func3 {...}
sub func4 {...}
In this example, the private method _init is invoking package methods
using symbolic references.
Many in the development team don't have a problem with this. They
consider it a clean and extendible solution. While they recognize
that symbolic references in general are bad, they justify this
solution by stating that the use of the symbolic references is
controlled and, hence, with little risk.
I am in the minority. I am looking for justification (other than the
standard mantra that symbolic references are bad) that this practice
should be discouraged. I have googled this topic but have not found
any specific examples that state why this practice is bad.
I am looking for this group's opinion. Any examples that demonstrate
why this is bad (or good) practice are appreciated.