Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: OO style question: how much information to hide?

by webfiend (Vicar)
on Jun 11, 2003 at 00:54 UTC ( #264924=note: print w/replies, xml ) Need Help??

in reply to OO style question: how much information to hide?

The explicit delete ... if ... seems more readable to me, in a narrative sense. Somebody else taking a casual glance at the other chunk might be concerned that time was being spent deleting attributes from end tags. It wouldn't take them long to discover the truth of the matter, but it's still something in the back of their head.

On the other hand, perhaps you want a method besides as_is() for printing purposes? Maybe something like this:

sub cleaned_up { my $self = shift; $self->del_attr('font') if $self->is_start_tag; return $self->as_is; } ... print $token->cleaned_up;

Of course, this example could be modified for the realities of style and ... well ... reality :-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://264924]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2016-10-25 10:15 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (315 votes). Check out past polls.