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.
| [reply] |
Re: Which is best book to start learning Object Oriented Perl?
by Your Mother (Archbishop) 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.
| [reply] |
|
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. :)
| [reply] |
|
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.
| [reply] |
|
|
|
|
|
|
| [reply] |
|
|
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. | [reply] |
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. | [reply] |
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
|
| [reply] |
Re: Which is best book to start learning Object Oriented Perl?
by karlgoethebier (Abbot) on Apr 27, 2018 at 08:33 UTC
|
| [reply] [d/l] |
Re: Which is best book to start learning Object Oriented Perl?
by LanX (Saint) 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.
| [reply] |
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.
| [reply] |
|
| [reply] |
|
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.
| [reply] |
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. | [reply] |