Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Which is best book to start learning Object Oriented Perl?

by Perl300 (Friar)
on Apr 26, 2018 at 21:48 UTC ( #1213645=perlquestion: print w/replies, xml ) Need Help??

Perl300 has asked for the wisdom of the Perl Monks concerning the following question:

I know Perl at intermediate level but has never used Object Oriented Perl (or any other Object Oriented Language).

So, which book is best for me to start learning Object Oriented Perl?

I am evaluating "Object Oriented Perl" by Damian Conway and "Modern Perl 4th Edition" by Chromatic.

Which one would you recommend? If someone has used one of these books (or in best case both) then your inputs will be greatly valuable for me to decode.

Note: For now I have started with Damian's book as it covers basics of how object oriented way works in Perl. But I know I'll eventually go through Chromatic's "Modern Perl" as well as it is the modern and recommended way. Like using Moose. Even Randall recommended "Modern Perl" in one of his recent interview that I read on LinkedIn this month.

  • Comment on Which is best book to start learning Object Oriented Perl?

Replies are listed 'Best First'.
Re: Which is best book to start learning Object Oriented Perl?
by davido (Cardinal) on Apr 26, 2018 at 23:17 UTC

    Chromatic's book teaches the modern way of doing it. Damien's book teaches the primary methods used prior to Moose and Moo. Learning both is useful.

    These books will teach you how to implement object oriented programming in Perl, but learning the principles of object oriented programming is sort of another step in the process. Eventually you'll probably also want to pick up and study OO design at a higher level, not specific to just Perl. Then bring back those principles to your Perl programming.


    Dave

Re: Which is best book to start learning Object Oriented Perl?
by Your Mother (Bishop) on Apr 26, 2018 at 23:27 UTC

    What davido++ said. FWIW, Conway 's book was a pro-Perl revelation for me and it will open your eyes to possibilities, not just frameworks, even though little of what it presents will be of direct use today.

      Well, that depends. The concepts discussed are useful, even if only to understand there's this big world of possibility out there, and available if needed. I still find myself using pre-Moose style object oriented code at work. But even in a Moose world, one can become more flexible in how they think of their design if they have more understanding of the lower level concepts. ...and more understanding of the higher level concepts. I guess in the end, there's no end to improving familiarity with useful concepts. :)


      Dave

        While I agree with both your posts, I would add that chromatic's book explains how to do it the modern way (Moose), but does not say very much about object orientation in general. Damian's book, while somewhat obsolete in terms of the technology used, says much more about object orientation in general, its principles and why. In that sense, Damian's book comes closer to teaching object orientation.
        For instance I'm sometimes blessing non hash references for various effects, something I learned from Damian's book.

        I think using anything but a hash would be weird for a moose disciple, and will never be needed in 90% of the Perl user base.

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Wikisyntax for the Monastery

Re: Which is best book to start learning Object Oriented Perl?
by morgon (Priest) on Apr 27, 2018 at 17:27 UTC
    "Object Oriented Perl" is definitely a bit outdated but it is nevertheless one of the best books ever written about Perl.

    It will not only teach you things you probably don't really need to know, but it will also keep you entertained.

    I guarantee you won't regret reading it, if you do I'll get you "Dive into Python" for free.

Re: Which is best book to start learning Object Oriented Perl?
by virtualsue (Vicar) on Apr 27, 2018 at 12:58 UTC
    In addition to the books already mentioned, Intermediate Perl by Tom Phoenix, Brian Foy & Randall Schwartz may be useful to you.
Re: Which is best book to start learning Object Oriented Perl? (its a book without "Perl" in the title)
by Anonymous Monk on Apr 27, 2018 at 03:19 UTC
Re: Which is best book to start learning Object Oriented Perl?
by LanX (Cardinal) on Apr 27, 2018 at 17:45 UTC
    I'd say get both and challenge us here on a regular basis about new aspects.

    There is no single canonical way to use OOP and no book covering all design principles (at least for Perl).

    I also find OOP often misused, take care to have a good grasp of how modular programming works before diving into OOP.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Wikisyntax for the Monastery

Re: Which is best book to start learning Object Oriented Perl?
by karlgoethebier (Abbot) on Apr 27, 2018 at 08:33 UTC

    The inevitable addendum. See also the OP.

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Re: Which is best book to start learning Object Oriented Perl?
by Perl300 (Friar) on Apr 27, 2018 at 15:35 UTC

    Thank you all for valuable inputs. I have tried to learn Object Oriented Programming a few times but never did it to my satisfaction. I tried learning only concepts first without any programming language associated, but I couldn't grasp much beyond definitions of objects, classes, methods, inheritance, polymorphism, encapsulation, data hiding etc

    So this time I thought may be learning OOP using a language I am familiar with would be better :-)

    I'll continue my quest and post on PM when I think I have learned something.

      So, assuming you're already mildly familiar with Perl, but don't know what OOP in general is, I whole-heartily recommend you to read the over-cited book "Object Oriented Perl" by Damian Conway. That book is not only a very good book about Perl's OOP concepts and techniques, it's really one of the best book written about OOP in the CS field, and I've read many on the subject.

      That book is so good, that even if you're a beginner in Perl and don't know what a reference is, it is a self-contained manual on the subject, and by the second chapter will teach you all the concepts and language features necessary to start building Perl classes and more! It is that good!

      Also consider this: while the more Perl modern approach is to use one of the many OO frameworks/libs available (Moose,Mouse,Moo,etc..), consider that the core of those frameworks is built upon the tools and techniques available in Perl 5, which are clearly described in Damian's book.

      Knowing at least some of those things, you won't then be scared or disoriented when reading Moose's manual about refs or blessing, or packages. And you will also able to interpret to some extent error and debug messages when things will inevitably go wrong for some reason.

      You can of course start today making Perl classes using Moose and referring to its manual, but to put to use it (and maybe starting to use some OO software patterns) you'd have some general OO knowledge, and that book will give also that.

Re: Which is best book to start learning Object Oriented Perl?
by Anonymous Monk on Apr 27, 2018 at 12:56 UTC
    It's very important to understand how Perl implemented its "object-oriented" features – what bless actually does, what the "arrow" operator does in various contexts, and so on. Perl-5 is a language that evolved over a long period of time to become what it now is, and it did so without losing backward compatibility with itself. (Perl-6 is not, but Perl-6 never went anywhere and never will.) The Perl Gods never went back into the compiler and added a bunch of new syntax diagrams. If you compare it to "object-oriented" languages that were designed from the ground up to be that way, you'll find that it is not a very close comparison at all. "Object-oriented Perl" really is a very different thing. Moose is implemented in classic Perl – it is not a compiler feature – and can be switched-on use Moose and switched-off no Moose in mid-flight.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1213645]
Front-paged by stevieb
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2020-11-25 14:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?