Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Programming patterns

by Anonymous Monk
on Jun 22, 2012 at 14:45 UTC ( #977854=note: print w/replies, xml ) Need Help??


in reply to Programming patterns

How about a summery of what you do understand?

I parse his statement as

So this is usually fine
sub method { $self->do_this if $self->query(); ...
So this is usually wrong (conditional on $that
sub method { ... if $that->query(); ...
?? sub method { $self->do_this if $that->query(); ...
?? sub method { $that->do_this if $that->query(); ...
This is a huge red flag ( ?? encapsulation violation ?? )
sub method { ... if $that->attribute() eq ...
???? sub method { ... if $self->attribute() eq ...

Re-reading chromatic's post, chromatic's $item is probably cawley's $that

The point is kinda obvious, simple
Always try /call the method you want ( $item->do_this )
But let it/that method fail based on its own state ( $self->dirty instead of $item->dirty )

In other words, let everybody check their own underpants for ticks, no peeking :)

I think I get it, but as usual chromatic's entry leaves you wanting more. FWIW, I'm not that well versed in OOP.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://977854]
help
Chatterbox?
[Corion]: Hi marto! I hope all is well!
[marto]: Corion, pretty much. How are things? You were at LPW?
[Corion]: marto: Yep, but I didn't make it up north, sorry ;)

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2016-12-07 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (125 votes). Check out past polls.