37 ms·
Perl Myths Talk 2009
- skolor 17y agoAs someone recently getting into using Perl, the Guidelines and Tools Slide (#36) was amazingly useful. Its got a whole list of things I've wanted, but didn't think to go out and look for yet. (Primarily tools/books on writing good perl or testing it).
- draegtun 17y agoI didn't see it in the slides but it maybe Tim being a bit modest because he didn't mention NYTProf: * http://search.cpan.org/dist/Devel-NYTProf/ http://search.cpan.org/dist/Devel-NYTProf/ * http://blog.timbunce.org/2008/07/15/nytprof-v2-a-major-advance-in-perl-profilers/ http://blog.timbunce.org/2008/07/15/nytprof-v2-a-major-advan... For more testing stuff checkout the Perl5 wiki: http://www.perlfoundation.org/perl5/index.cgi?testing http://www.perlfoundation.org/perl5/index.cgi?testing
- skolor 17y agoHe mentioned Devel::*, and showed screenshots of NYTProf, but didn't mention it by name. Thanks for pointing it out.
- deleted 17y ago[deleted]
- jlc 17y agoInteresting. I know python and ruby. Now I'm wondering if it's worth my time to learn perl.
- berntb 17y agoIMHO, the best part with Perl is the community (CPAN is a result of that) -- and the worst part is the relentless trolling on web sites like this... Since Ruby/Python/Perl are really similar, I'd recommend that you learn something completely different instead. Disclaimer: I like Perl. What makes Perl fun for me is to a large part that the linguistics influence results in Perl breaking most "normal" laws for programming language design, but still works. I go to work smiling.
- jrockway 17y agoI don't think it's a lingusitics thing, rather, Perl was not designed to be limited like other popular languages were. Larry never sat down and said, "I am the only person that is possibly smart enough to understand this concept, so I am not going to add it to the language". (Java and PHP's designers did. Look what that got them...)
- berntb 17y ago>>Perl was not designed to be limited like other popular languages were. That was a design decision, not influence from natural languages? Fun.
- akl 17y agoI'll differ from berntb - you should learn Perl exactly because it's fairly similar to those languages you already know, and the effort required to do so will be minimal. You may not end up using it all that frequently, but an hour or two seeing how another programming language does something is usually interesting perspective, imo.
- mahmud 17y agoIf you know python and ruby, learn something that I will actually improve/change your programming: Scheme, ML, Prolog, Smalltalk, Common Lisp, Haskell, Mozart/Oz, or Forth. Python and Ruby are not that different, and neither is that different from Perl.
- mechanical_fish 17y agoYou left out Javascript and C, which are even more obvious low-hanging fruit, though not necessarily as mind-expanding.
- berntb 17y agoThe first time in my life I bought a book for looks, was when I saw how thin "JavaScript: The Good Parts" was. :-) Disclaimer: I quite like JavaScript.
- jrockway 17y agoJavascript is essentially a less-functional version of Python, Perl, and Ruby -- but with many annoying bugs. (Variable scoping, for one.) If you want to learn about prototype-based OO systems, fine, but there's a reason that only JavaScript (and Self) use prototype-based OO :P C should be learned so that you are not tempted to ever use it for anything important.
- Goladus 17y agoSo perl is not hard to read because there's a book about best practices, and optional libraries that enforce coding styles? I respectfully disagree. Reading perl requires understanding a significant amount of perl-specific trivia for any given block of code, that's why it is hard to read. http://shootout.alioth.debian.org/ http://shootout.alioth.debian.org/ Binary trees problem. Perl: sub item_check { my ($tree) = @_; return $tree->[2] unless (defined $tree->[0]); return $tree->[2] + item_check($tree->[0]) - item_check($tree->[1]); } Lua: local function ItemCheck(tree) if tree == 3 then return tree[1] + ItemCheck(tree[2]) - ItemCheck(tree[3]) else return tree[1] end end These demonstrate the REALITY of what it's like reading perl code vs. other languages. Count the number of different symbols you must know in order to understand the perl code, versus the number of symbols you must know to understand the lua code. Anyone familiar with functions, variables, and standard control flow will be able to read the lua with no problem. If you look at other code snippets, like Javascript and C#, you'd amend the comment to say that anyone familiar with methods and object-oriented programming will be able to read the code with no problem. With perl, you have to know perl. You have to know perl's control flow ("unless"), you have to know perl references(->), you have to know perl's parameter passing semantics and the meaning of @_, and you have to know perl's variable prefixes. That's why perl is hard to read. That's why people who use perl all the time don't understand why it drives everyone else crazy. They have all that crap in their heads already. You never smell your own bad breath. Style guides don't fix this problem.
- chromatic 17y ago> Anyone familiar with functions and standard control flow will be able to read the lua with no problem. Who cares? Why does that matter? Do you really hire or recruit people to work on your projects merely on the basis of reading code with no problem? I care a lot more about being able to understand the problem domain and maintain the code than merely being able to read it by way of familiarity with an Algol-derived language with class-based OO support and dynamic typing. > With perl, you have to know perl. ... just like every other programming language ever written. (Oops! Lua's array indices customarily start at one; good luck with those fencepost errors by people who can merely read the Lua code but don't know Lua.)
- bkovitz 17y agoThe debunking of the myth of unreadability omitted something of concern to me: How much Perl code "in the wild" uses those best practices? I have no doubt that Perl can be written in a disciplined and reasonable manner, readable to people familiar with its idioms, and not especially bug-prone. I cringe every time I come across Perl code because I've never actually come across any real Perl that's written that way. Or maybe I have, but I've always gotten discouraged with the language before mastering enough of the syntax to master the idioms, so I can't really tell. This is not a problem with Python. It's easy to learn to read Python, and I have yet to come across really bad Python in practice. Good coding seems to flow easily from the way the language is made.
- chromatic 17y ago> How much Perl code "in the wild" uses those best practices? Not enough. Consider this, though: how much Perl code "in the wild" is the result of programming novices who learned just enough Perl to do a job without actually having to learn how to program or how to write Perl code well or how to write maintainable code? I suspect that it's far more than you might think. If that's true, then the complaint is that Perl is too easy to write.