in reply to Re^2: Law of Demeter and Class::DBI
in thread Law of Demeter and Class::DBI
In Perl for example, you can directly access the underlying hash. Are you saying that this is a good way of doing things?
I'd say that's a bad way of doing things. This kind of code is tied to the underlying representation of the object and prevents you from reusing the code with other objects that would have had a compatible interface if you'd used getters and setters.
By the way, when I say getters and setters I include things like Class::Accessor::Lvalue which lets you do
which gives a simple interface while still allowing override of get and set behaviour.print $o->some_field; $o->some_field = 5;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Law of Demeter and Class::DBI
by jplindstrom (Monsignor) on Nov 19, 2004 at 22:09 UTC | |
by fergal (Chaplain) on Nov 20, 2004 at 00:51 UTC | |
by jplindstrom (Monsignor) on Nov 20, 2004 at 12:34 UTC | |
by diotalevi (Canon) on Nov 19, 2004 at 22:22 UTC | |
by fergal (Chaplain) on Nov 20, 2004 at 00:52 UTC |