in reply to Re^4: RFC: OO Perl using Moo/Moose book
in thread RFC: OO Perl using Moo/Moose book

Yeah I just mentioned it because you said "from the ground up"

Things like encapsulation and polymorphism are well explained.

And a new user should be aware that classes are just packages.

> when to use roles, when to use inheritance, when to use delegation, etc

You could use the dynamic of the monastery to discuss these concepts little by little.

> Python, Ruby, or Java 

Well are there any good Python or Ruby books on the topic?

I'd say orientation towards Java would cause too much conceptual problems.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

  • Comment on Re^5: RFC: OO Perl using Moo/Moose book

Replies are listed 'Best First'.
Re^6: RFC: OO Perl using Moo/Moose book
by tobyink (Canon) on Apr 27, 2019 at 09:36 UTC

    "Classes are just packages" pre-supposes a class-based paradigm. I want to put less emphasis on classes and more on objects. It's possible to create objects by composing roles on-the-fly, for example. And even though these objects are still backed by packages and stashes and stuff, you don't have to think of each class being a package and being defined in a module.

    This is stuff which is hard to do properly in languages like Java, but you can still use it to conceive how you design your program, and then "down translate" that into whatever programming language you're using. For example, something like roles/traits/mixins can be emulated in Java using a combination of interfaces and delegation.

      > "Classes are just packages" pre-supposes a class-based paradigm.

      so your definition of "Delegation" goes into the direction of the traditional JS model where objects "beget"° other objects?

      While this is certainly very important, I'd rather prefer a general book listing usual patterns for dynamic languages.

      It's very hard to discuss OO when the terminology is dominated by GoF book concepts from the static typing world.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      °) beget borrowed from Crockford's "JS the good parts" book

        By "delegation", I mean like handles in Moose/Moo.