NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Code smell heuristic (Score:2)
Thanks for the heuristic! I never realized that before! I think this will help improve my coding.
(If there's a larger source where you picked that up, I'd be benefitted by a pointer.)
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re: (Score:2)
Thought I've later found that others point this out, I doubt how I learned this [perl.org] will help you :)
Re: (Score:2)
I figured a concrete example would help. Imagine this awful method from some Catalyst code I was working on:
Re: (Score:1)
Re: (Score:2)
In this case, it's done via a customer selecting a URL, so it's up to the customer to decide what they want and we don't have to.
A better example would be with Java:
In regular Perl (no modules), it sometimes gets mistakenly rewritten as this:
Re: (Score:1)
Look at the method names. Do they really focus on what the methods do? Where is the axis of duplication? (hint: group by)
Re: (Score:2)
This was a tiny example and merely a first-pass refactor. If you look at the actual code I checked in, you'll see it's much cleaner.
Re: (Score:1)
Re: (Score:1)
Too much work (Score:2)
Re: (Score:2)
The conditional is a point I make in my OO guidelines writeup [perlmonks.org] on PM. It's bad practice. I make the same point here, too [perl.org]. So yes, I do agree with you, but I plead mea culpa of posting a bad example to explain good code ;)
Re: (Score:1)