Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: replace conditionals with polymorphism

by revdiablo (Prior)
on Feb 09, 2009 at 16:55 UTC ( #742484=note: print w/ replies, xml ) Need Help??


in reply to replace conditionals with polymorphism

This may be a good exercise, but I'm not so convinced it's the best thing to do in practice. You now have 5 classes, each with a single method? That seems a little contrived. I would stick with the switch statement.

Update: I guess you said the same thing later in your post; I should have read it more carefully. I'd still like to reinforce your feeling with my own. I wouldn't bother solving all the problems you listed.


Comment on Re: replace conditionals with polymorphism

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (18)
As of 2015-07-01 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (6 votes), past polls