Keep It Simple, Stupid | |
PerlMonks |
Re^2: Refactoring technique?by BrowserUk (Patriarch) |
on Apr 24, 2015 at 13:56 UTC ( [id://1124534]=note: print w/replies, xml ) | Need Help?? |
Not sure what your question is. Just naming of parameters? Yes & no. Imagine you're the programmer charged with looking at this code (see the spoiler) a couple of years from now, and you're trying to make sense of $text1, $text2, & $text3 in context. If they have specific roles, find a name corresponding to that role. Again, take a look at the code in spoiler. Can you see a "name corresponding to that role"? <P.Or for a better sense of the scale of the problem:
The 3 parameters need to be substituted everywhere that x, y, or z are used within that block, but sometimes the first parameter will be the x component of all the things; sometimes the y; sometimes the z; and so on for the other two parameters. Within the context of 3D code x, y, z give some sense of what the thing you're dealing with is; text1, text2, text3 don't. Similarly, for u, v, w; but it's worse, because you intuitively think of them as being placeholders for x, y, z respectively, but they aren't. Or rather sometimes they will be but mostly they will be some other ordering. Similarly, if you use numbers -- say $xyz1, $xyz2, $xyz3 -- we tend to associate them to some ordering, even though we know that any one of the formal parameters could be any one of the actual parameters. Its just something that has recurringly given me pause for thought each time I've encountered it down the years and I've never really come up with a good solution/approach to the problem. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked
In Section
Seekers of Perl Wisdom
|
|