|
Thank you for the links and the advice, but it is misplaced. I know and use Perl. I also dread having to do so. These two statements are related. "There's more than one way to do it" is, for me, a negative, at least in the Perl implementation of it; while there are cases where multiple ways to do the same thing is great (for example, C#'s foreach versus the IEnumerable extension method that takes a delegate/lambda), I don't think that's the case here. The pathological decisions toward terseness are, in my experience, the root cause of one guy's Perl being unreadable to the next; this may be a cynical statement, but (said with tongue firmly in cheek) when you give a programming language capable of expressing significant logic with one character, the guy who uses vim will do so, and damn the next guy who has to pick it up and work with it later. Say what you will about something like Java--and oh man, have I said all of it--but the language does tend toward readability (at the cost of boilerplate); it's relatively hard to write correct code that will elicit WTFs from the next guy who has to maintain it. In my experience, WTFs are somewhat par for the course with inherited Perl. (I find Python to generally encourage the Right Thing as well, though it's easier to write monstrosities in that, too, than I would really like. C#, for me, hits the sweet spot, but doesn't exactly work so well as a scripting language.) None of this should be construed to say that you cannot write clean Perl. Surely you can, and I've certainly encountered some of it. But I think "there's more than one way to do it" is more of a crutch for "write byte vomit, it'll just work" than you'd like to admit. |
I think the issue you encounter is a combination of isolation (the more involved you are in the community, the more you are exposed to best-practices and idiomatic Perl) and the quality of some of the older Perl documentation and books. In some of these older documents there was an emphasis put on "cleverness through TIMTOWTDI" which really had a damaging effect on some people (read: the people whose code you have inherited).
Perl is an extremely flexible language, which in the right hands can be very powerful. However, as Uncle Ben said, with great power comes great responsibility. I personally would rather my language require a little more self discipline from me 90% of the time, so that in the remaining 10% of the time I can hack some really crazy shit to get the job done.