use Moose talk in beijing workshop 2008
-
Upload
guest28275 -
Category
Technology
-
view
968 -
download
1
description
Transcript of use Moose talk in beijing workshop 2008
OutlineIntroduction
Seeing is believingMouse
The End
Mooooooooooooooooose
November 08, 2008
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
IntroductionWhat’s Moose?
Seeing is believingLet’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
MouseWhat’s Mouse?Why?Mouse is not enough in future?
The End
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Moose?
What Moose is not
I NOT a cow
I NOT contain any melamine
I NOT Perl 6
I NOT just a toy
I NOT a new object system
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Moose?
What Moose is not
I NOT a cow
I NOT contain any melamine
I NOT Perl 6
I NOT just a toy
I NOT a new object system
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Moose?
What Moose is not
I NOT a cow
I NOT contain any melamine
I NOT Perl 6
I NOT just a toy
I NOT a new object system
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Moose?
What Moose is not
I NOT a cow
I NOT contain any melamine
I NOT Perl 6
I NOT just a toy
I NOT a new object system
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Moose?
What Moose is not
I NOT a cow
I NOT contain any melamine
I NOT Perl 6
I NOT just a toy
I NOT a new object system
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Moose?
Google knows something about Moose
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Moose?
Interested in that animal?
Let’s talk about that animallater
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Moose?
What Moose here really is
I an extension of the existing objectsystem of Perl 5
I very much inspired by Perl 6I built on top of Class::MOP(
Welcome to Meta world! )I postmodern( just like Perl ;)I ready to use
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Moose?
What Moose here really is
I an extension of the existing objectsystem of Perl 5
I very much inspired by Perl 6
I built on top of Class::MOP(Welcome to Meta world! )
I postmodern( just like Perl ;)I ready to use
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Moose?
What Moose here really is
I an extension of the existing objectsystem of Perl 5
I very much inspired by Perl 6I built on top of Class::MOP(
Welcome to Meta world! )
I postmodern( just like Perl ;)I ready to use
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Moose?
What Moose here really is
I an extension of the existing objectsystem of Perl 5
I very much inspired by Perl 6I built on top of Class::MOP(
Welcome to Meta world! )I postmodern( just like Perl ;)
I ready to use
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Moose?
What Moose here really is
I an extension of the existing objectsystem of Perl 5
I very much inspired by Perl 6I built on top of Class::MOP(
Welcome to Meta world! )I postmodern( just like Perl ;)I ready to use
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Moose?
Official Definition
Moose is a postmodern object systemfor Perl 5 that takes the tedium outof writing object-oriented Perl. Itborrows all the best features fromPerl 6, CLOS (LISP), Smalltalk, Java,BETA, OCaml, Ruby and more, whilestill keeping true to its Perl 5 roots.
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
The Request
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
What we normally OOP
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
If we have Moose . . .
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
You may point out. . .
You skipped use strict; and usewarnings; on purpose to reduce
lines!
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
So, I’m telling you. . .
Well, I skipped those two linesbecause Moose does that for
me.
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
Thanks, Moose!
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
use ’has’ to install attributes
has $name|@$names => %options
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
%options
I is ( ’ro|rw’ )
I isa ( type constraints )
I does ( $role )
I required ( 1|0 )
I default
I predicate ( method name to check for initialization )
I clearer ( method name to uninitialize )
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
%options
I is ( ’ro|rw’ )
I isa ( type constraints )
I does ( $role )
I required ( 1|0 )
I default
I predicate ( method name to check for initialization )
I clearer ( method name to uninitialize )
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
%options
I is ( ’ro|rw’ )
I isa ( type constraints )
I does ( $role )
I required ( 1|0 )
I default
I predicate ( method name to check for initialization )
I clearer ( method name to uninitialize )
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
%options
I is ( ’ro|rw’ )
I isa ( type constraints )
I does ( $role )
I required ( 1|0 )
I default
I predicate ( method name to check for initialization )
I clearer ( method name to uninitialize )
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
%options
I is ( ’ro|rw’ )
I isa ( type constraints )
I does ( $role )
I required ( 1|0 )
I default
I predicate ( method name to check for initialization )
I clearer ( method name to uninitialize )
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
%options
I is ( ’ro|rw’ )
I isa ( type constraints )
I does ( $role )
I required ( 1|0 )
I default
I predicate ( method name to check for initialization )
I clearer ( method name to uninitialize )
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
%options
I is ( ’ro|rw’ )
I isa ( type constraints )
I does ( $role )
I required ( 1|0 )
I default
I predicate ( method name to check for initialization )
I clearer ( method name to uninitialize )
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
is
I ro
I rw
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
is
I ro
I rw
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
is
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
isa - type
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
isa - type
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
does - Role
Let’s talk about Roles later
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
required
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
default
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
predicate and clearer
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
Code Reuse
From S12: Classes are primarily incharge of object management, andonly secondarily in charge of softwarereuse. In Perl 6, roles take over thejob of managing software reuse.
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
What’s a Role?
From S12: Depending on how youcare to look at it, a role is like apartial class, or an interface withdefault implementation, or a set ofgeneric methods and their associateddata, or a class closed at compiletime.
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
use ’with’ to apply Roles
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
I before
I after
I around
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
I before
I after
I around
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
I before
I after
I around
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
I override/super
I augment/inner
I . . .
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
I override/super
I augment/inner
I . . .
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
I override/super
I augment/inner
I . . .
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Let’s Compare!Attributes - hasRoles - withMethod ModifiersOther Methods
an easy way to speed up Moose
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Mouse?Why?Mouse is not enough in future?
Mouse is a lightweighted Moose. Itprovides a subset of Moose’sfunctionality.
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Mouse?Why?Mouse is not enough in future?
the compile time penalty
Though significant progress has beenmade over the years, the compiletime penalty is a non-starter for someapplications.
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
What’s Mouse?Why?Mouse is not enough in future?
It’s easy to do
s/Mouse/Moose/g;
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Less is better sometimes
I less code
I less tests
I less bugs
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Less is better sometimes
I less code
I less tests
I less bugs
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Less is better sometimes
I less code
I less tests
I less bugs
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
So. . .
Let’s Moose from now on
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Until. . .
Perl 6 is finished
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
More Info
I
http://www.iinteractive.com/moose
I #moose on irc.perl.org
I subscribe to [email protected]
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
More Info
I
http://www.iinteractive.com/moose
I #moose on irc.perl.org
I subscribe to [email protected]
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
More Info
I
http://www.iinteractive.com/moose
I #moose on irc.perl.org
I subscribe to [email protected]
[email protected] Mooooooooooooooooose
OutlineIntroduction
Seeing is believingMouse
The End
Thanks!
Any Questions?
[email protected] Mooooooooooooooooose