[prev] [thread] [next] [lurker] [Date index for 2003/10/23]
On Wed, 22 Oct 2003, Piers Cawley wrote: > Why thank you. Generally my gut feeling is that every time I think > "Maybe I should add a comment here?" I'd be better off working out > what it is about the code that is hard to understand and rewriting it > so it's clear. This isn't always going to work. For example: sub delete { my $self = shift; my $obj_or_oid = shift; my $oid = ref($obj_or_oid) ? $obj_or_oid->PIXIE::oid : $obj_or_oid; $self->cache_delete($oid); $self->store->remove_from_store($oid); } This is perfectly clear up until we get to the bit we're deleting from the cache. It needs a comment to say *why* we have to delete from the cache. It's not the code isn't readable, it's that the reasoning behind the things hasn't been exposed. Mark. -- #!/usr/bin/perl -T use strict; use warnings; print q{Mark Fowler, mark@xxxxxxxxxxxxxx.xxx, http://twoshortplanks.com/};There's stuff above here
Generated at 13:56 on 01 Jul 2004 by mariachi 0.52