http://qs321.pair.com?node_id=916404


in reply to Re^14: Processing Two XML Files in Parallel
in thread Processing Two XML Files in Parallel

That is a horribly poor comparison. You simplify for an 8-year old because he is probably unable to comprehend the real answer. A beginning Perl programmer is presumably and adult and shouldn't need the simplification. They will benefit more from being shown the right way to do things from the start.

Plus, your solution was not a simplification, but the wrong way to solve the problem. See the hundreds of posts detailing why you shouldn't use regular expressions to parse XML.

I would much rather the beginner have to work a little harder to learn the right way, than to be stuck six months down the line when everything blows up because someone added an attribute to the XML. or even a newline

And actually, I would not even call ikegami's solution harder to understand. Sure, it requires you to actually read a PerlDoc to understand it,but how lazy (the bad kind, not Perl Lazy) do you have to be for that to be the issue? And there is no reason why the user couldn't learn by replying with follow up questions about the code and the idioms used; thereby learning more and creating robust code.

With your method, the beginner gets a fragile one-off that reinforces a bad methodology. With ikegami's he learns a valuable tool that can help him solve more complex problems safely and easily

Your comment elswehere in the thread is telling:

Why oh why, do you need all that complexity to do a simple task? WHY???? I refuse to learn how to write code which has to be that verbose, without some sort of damn good reason! ... What ever happened to keep it simple?

your good reason is robustness and reliability. Keep it simple is secondary to do it right.



-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."