Greg London wrote: > I've pasted an OO version and the closure version of my script below. > They're nearly identical. they both take about the same amount of > lines of code.
Nice that you fleshed out the examples a bit further. > Meh. I don't blame that on perl's lack of "builtin" OO. > The problem is I'm not thinking of this script as an OO script. > Given how short the script is... But that's my point. The default, especially with a short script, becomes procedural. I certainly don't advocate dogmatic use of OO. There are lots of cases where procedural stuff is more appropriate. It just seems that we naturally gravitate to procedural in Perl, until we hit some threshold, and then say, "oh, I ought to be using OO for this." In other languages, where OO is fully integrated, you start out thinking in OO terms, and then possibly simplify to procedural, if that's what really works best for the problem. Never underestimate the impact of convenience - even if the differences are subtle - on what a person will choose when weighing options. > Perl's "bolt-on" version of classes can fix this > about as easily as perl's closure stuff can fix it. The closure version doesn't "scale." You can't stick it in a library and call it from multiple places without stepping on things. The natural response is, well that doesn't matter for this trivial use case. But if the coding effort is about the same either way, then why not write it in the first place in a way that could easily be cut-and-pasted into its own library later? It's because of the impression (at least for those of us coding Perl since the 80's) that there is extra effort required for the OO approach, even if in actuality, as you demonstrated, there isn't much difference at all. -Tom -- Tom Metro Venture Logic, Newton, MA, USA "Enterprise solutions through open source." Professional Profile: http://tmetro.venturelogic.com/ _______________________________________________ Boston-pm mailing list [email protected] http://mail.pm.org/mailman/listinfo/boston-pm

