Small wording for re MX::NonMoose
[gitmo/moose-presentations.git] / moose-class / slides / index.html
index 7351420..b3f57f6 100644 (file)
@@ -52,7 +52,17 @@ img#me05 {top: 43px;left: 36px;}
 
 <div class="slide">
   <h1>Introduction to Moose</h1>
-  <h2><a href="git://git.moose.perl.org/moose-presentations.git"><tt>git://git.moose.perl.org/moose-presentations.git</tt></a></h2>
+  <h2>Dave Rolsky</h2>
+</div>
+
+<div class="slide">
+  <h1>Introduce Yourselves</h1>
+
+  <ul>
+    <li>Your name</li>
+    <li>What you do with Perl</li>
+    <li>Why you're here today (optional)</li>
+  </ul>
 </div>
 
 <div class="slide">
@@ -61,7 +71,8 @@ img#me05 {top: 43px;left: 36px;}
   <ul>
     <li><strong>Declarative</strong> OO sugar</li>
     <li>Introspectable</li>
-    <li>Extensible (MooseX::* on CPAN)</li>
+    <li>Extensible (202 MooseX::* on CPAN)</li>
+    <li>Community approved (1200+ downstream dependents on CPAN)</li>
   </ul>
 </div>
 
@@ -144,7 +155,7 @@ img#me05 {top: 43px;left: 36px;}
   <pre><code>package Person;
 use Moose;
 
-<span class="highlight">has first_name =&gt; ( is =&gt; 'rw' );</span></code></pre>
+<span class="highlight">has first_name =&gt; ( is =&gt; 'ro' );</span></code></pre>
 
 </div>
 
@@ -208,7 +219,7 @@ use Moose;
   <ul>
     <li>AKA advice</li>
     <li>&quot;<strong>Before</strong> foo(), do this first&quot;</li>
-    <li>&quot;Do this <strong>after</strong> foo()</li>
+    <li>&quot;Do this <strong>after</strong> foo()&quot;</li>
     <li>&quot;Put this code <strong>around</strong> foo()&quot;</li>
   </ul>
 </div>
@@ -265,7 +276,7 @@ has weight =&gt; (
 );
 
 # kaboom
-Person-&gt;new( weight =&gt; 'fat' );</code></pre>
+Person-&gt;new( weight =&gt; 'heavy' );</code></pre>
 </div>
 
 <div class="slide">
@@ -290,8 +301,8 @@ has blog_uri =&gt; (
     <span class="highlight">handles =&gt; { 'blog_host' =&gt; 'host' },</span>
 );
 
-<span class="highlight">$person->blog_host;</span>
-# really calls $person->blog_uri->host</code></pre>
+<span class="highlight">$person-&gt;blog_host;</span>
+# really calls $person-&gt;blog_uri-&gt;host</code></pre>
 </div>
 
 <div class="slide">
@@ -299,7 +310,7 @@ has blog_uri =&gt; (
 
   <ul>
     <li>Moose creates <code>new()</code> for you</li>
-    <li>Provide an optional <code>BUIDARGS()</code> and <code>BUILD()</code></li>
+    <li>Provide an optional <code>BUILDARGS()</code> and <code>BUILD()</code></li>
   </ul>
 </div>
 
@@ -832,6 +843,16 @@ has last_name =&gt; (
 );</code></pre>
 </div>
 
+<div class="slide">
+    <h1>More Why Moose?</h1>
+
+    <ul>
+      <li>Less code == fewer bugs</li>
+      <li>Moose is well-tested, test your own code, not Moose</li>
+      <li>Focus on <strong>what</strong>, not <strong>how</strong></li>
+    </ul>
+</div>
+
 <div class="slide fake-slide0">
   <h1>Part 1: Moose Classes</h1>
 </div>
@@ -872,8 +893,8 @@ use Moose;</code></pre>
   <h1>BUILDARGS</h1>
 
   <ul>
-    <li>Takes <code>@_</code>, returns a hash reference of attribute names/value</li>
-    <li>Accepts a hash or hashref; throws otherwise</li>
+    <li>Processes <code>new</code>'s <code>@_</code>, returns a hash reference of attribute name/value pairs</li>
+    <li>Accepts a hash or hashref; errors otherwise</li>
     <li>Provide your own for other cases</li>
     <li><strong>Always</strong> call <code>$class-&gt;SUPER::BUILDARGS(@_)</code> as a fallback!</li>
   </ul>
@@ -929,13 +950,13 @@ sub BUILD {
 <div class="slide">
   <h1>Object Construction a la Moose</h1>
 
-  <pre><code>Person-&gt;new(@_)</code></pre>
+  <pre><code>Person-&gt;new(@args)</code></pre>
 
-  <ol>
-    <li>Calls <code>Person-&gt;BUILDARGS(@_)</code> to turn <code>@_</code> into a hashref</li>
+  <ol style="margin-top: 0">
+    <li>Calls <code>Person-&gt;BUILDARGS(@args)</code> to turn <code>@args</code> into a hashref</li>
     <li>Blesses a reference</li>
     <li>Populates attributes based on the hashref from #1</li>
-    <li>Calls <code>$new_object->BUILDALL($constructor_args)</code>
+    <li>Calls <code>$new_object-&gt;BUILDALL($constructor_args)</code>
         <br />... which calls all <code>BUILD</code> methods</li>    
     <li>Returns the object</li>
   </ol>
@@ -947,6 +968,7 @@ sub BUILD {
   <ul>
     <li>Technically it's a hash reference</li>
     <li><span class="wrong">If you <em>ever</em> treat it as one <strong>you are doing it wrong!</strong></span></li>
+    <li>Moose probably provides a feature to do what you need</li>
   </ul>
 </div>
 
@@ -956,6 +978,7 @@ sub BUILD {
   <ul>
     <li>Like <code>DESTROY</code>, but Moose makes sure all <code>DEMOLISH</code> methods in a hierarchy are called</li>
     <li>Called in normal inheritance order, children to parents</li>
+    <li><em>Never</em> called by you, only by Perl itself</li>
   </ul>
 </div>
 
@@ -964,6 +987,8 @@ sub BUILD {
 
   <ul>
     <li><code>extends</code> is sugar for declaring parent classes</li>
+    <li>Also ensures metaclass compatibility between parent and child</li>
+    <li>Do not <code>use base</code></li>
   </ul>
 
   <pre><code>package Employee;
@@ -1007,7 +1032,7 @@ extends 'LWP';</code></pre>
         <li>No <code>DEMOLISH()</code></li>
       </ul>
     </li>
-    <li>But see <code>MooseX::NonMoose</code> for a workaround</li>
+    <li>But <code>MooseX::NonMoose</code> fixes all of this</li>
   </ul>
 </div>  
 
@@ -1017,6 +1042,7 @@ extends 'LWP';</code></pre>
   <ul>
     <li><code>override</code> is another method modifier</li>
     <li>An alternative to Perl's <code>SUPER::</code></li>
+    <li><em>Declares</em> your intent to override a method</li>
   </ul>
 </div>
 
@@ -1028,13 +1054,13 @@ use Moose;
 
 <span class="current incremental">extends 'Person';</span>
 
-<span class="incremental">override</span> work =&gt; sub {
+<span class="incremental">override</span> <span class="incremental">work</span> <span class="incremental">=&gt; sub {
     my $self = shift;
 
     die "Pay me first"
         unless $self-&gt;got_paid;
-    <span class="incremental">super();</span>
-}<span class="incremental">;</span></code></pre>
+    super();
+}</span><span class="incremental">;</span></code></pre>
 </div>
 
 <div class="slide">
@@ -1043,7 +1069,8 @@ use Moose;
   <ul>
     <li>Mostly like <code>$self-&gt;SUPER::work(@_)</code></li>
     <li><strong>But</strong> cannot change <code>@_</code>!</li>
-    <li>Binds the parent's method at compile time</li>
+    <li>Binds the parent's method <strong>correctly</strong> at compile time</li>
+    <li>Parent determined by checking <code>Child-&gt;meta()-&gt;superclasses()</code></li>
   </ul>
 </div>
 
@@ -1084,8 +1111,7 @@ has first_name =&gt; ( <span class="highlight">is =&gt; 'ro'</span> );
 my $person =
     Person-&gt;new( first_name =&gt; 'Dave' );
 
-$person-&gt;first_name('Stevan');
-print $person-&gt;first_name; # Dave</code></pre>
+$person-&gt;first_name('Stevan'); # dies</code></pre>
 
 </div>
 
@@ -1104,7 +1130,7 @@ print $person-&gt;first_name; # Dave</code></pre>
 use Moose;
 
 # true
-Person->can('extends');</code></pre>
+Person-&gt;can('extends');</code></pre>
 
   <ul>
     <li>Not very hygienic</li>
@@ -1119,17 +1145,31 @@ use Moose;
 
 ...
 
-no Moose;
+<span class="highlight">no Moose;</span>
+
+# false
+Person-&gt;can('extends');</code></pre>
+</div>
+
+<div class="slide">
+  <h1>Cleaning Up Moose Droppings</h1>
+
+  <pre><code>package Person;
+use Moose;
+<span class="highlight">use namespace::autoclean;</span>
+
+...
 
 # false
-Person->can('extends');</code></pre>
+Person-&gt;can('extends');</code></pre>
 </div>
 
 <div class="slide">
   <h1>No Moose</h1>
 
   <ul>
-    <li><code>no Moose</code> at the end of a package is a best practice</li>
+    <li>Cleaning up is a best practice</li>
+    <li>Say <code>no Moose</code> at the end of a package</li>
     <li>Or <code>use namespace::autoclean</code> at the top</li>
     <li>Just do it</li>
   </ul>
@@ -1139,13 +1179,13 @@ Person->can('extends');</code></pre>
   <h1>Immutability</h1>
 
   <ul>
-    <li><span style="font-family: URW Chancery L; font-size: 140%">Stevan's Incantation of Fleet-Footedness</span></li>
+    <li><span style="font-family: URW Chancery L; font-size: 120%">Stevan's Incantation of Fleet-Footedness</span></li>
   </ul>
 
   <pre><code>package Person;
 use Moose;
 
-<span class="highlight">__PACKAGE__->meta->make_immutable;</span></code></pre>
+<span class="highlight">__PACKAGE__-&gt;meta-&gt;make_immutable;</span></code></pre>
 </div>
 
 <div class="slide">
@@ -1196,6 +1236,8 @@ use Moose;
 
 # perl install-moose (if needed)
 
+## Read the instructions in t/01-classes.t
+
 # perl bin/prove -lv t/01-classes.t
 
 # edit lib/Person.pm and lib/Employee.pm
@@ -1267,23 +1309,25 @@ sub print {
   <pre><code>package Person;
 use Moose;
 
-with 'HasPermissions';</code></pre>
+with 'Printable';</code></pre>
 </div>
 
 <div class="slide">
   <h1>Classes Consume Roles</h1>
 
-<pre><code>my $person = Person-&gt;new(
+<pre><code>package Person;
+
+sub as_string { $_[0]-&gt;first_name() }
+
+...
+
+my $person = Person-&gt;new(
     first_name   =&gt; 'Kenichi',
     last_name    =&gt; 'Asai',
     access_level =&gt; 42,
 );
 
-print $person-&gt;full_name
-    . ' has '
-    . $person-&gt;can_access(42)
-        ? 'great power'
-        : 'little power';</code></pre>
+$person-&gt;print();</code></pre>
 </div>
 
 <div class="slide">
@@ -1300,7 +1344,9 @@ print $person-&gt;full_name
 <pre><code>package Person;
 use Moose;
 
-<span class="highlight">with 'Printable';</span></code></pre>
+<span class="highlight">with 'Printable';</span>
+
+sub as_string { $_[0]-&gt;first_name() }</code></pre>
 </div>
 
 <div class="slide">
@@ -1311,6 +1357,8 @@ use Moose;
 
 <span class="delete">with 'Printable';</span>
 
+sub as_string { $_[0]-&gt;first_name() }
+
 <span class="highlight">has has_been_printed =&gt; ( is =&gt; 'rw'  );
 
 sub print {
@@ -1331,7 +1379,7 @@ sub print {
 
 # or ...
 
-Person-&gt;meta-&gt;does('Printable')</code></pre>
+Person-&gt;meta-&gt;does_role('Printable')</code></pre>
 
 </div>
 
@@ -1391,69 +1439,17 @@ use Moose;
 </div>
 
 <div class="slide">
-  <h1>Method Aliasing</h1>
-
-  <pre><code>package FragileDancer;
-use Moose;
-
-<span class="highlight">with 'IsFragile' =>
-         { -alias =>
-               { break => 'break_bone' } },
-     'CanBreakdance' =>
-         { -alias =>
-               { break => 'break_it_down' } };</span></code></pre>
-
-  <ul>
-    <li>Renames the roles' methods</li>
-    <li>Still conflicts, need to <code>exclude</code> as well</li>
-  </ul>
-</div>
-
-<div class="slide">
-  <h1>Method Exclusion</h1>
-
-  <pre><code>package FragileDancer;
-use Moose;
-
-<span class="highlight">with 'IsFragile' =>
-         { -alias =>
-               { break => 'break_bone' },
-           -excludes => 'break' },
-     'CanBreakdance' =>
-         { -alias =>
-               { break => 'break_dance' },
-           -excludes => 'break' };</span></code></pre>
-</div>
-
-<div class="slide">
-  <h1>And then ...</h1>
-
-  <pre><code>package FragileDancer;
-use Moose;
-
-sub break {
-    my $self = shift;
-
-    $self->break_dance;
-    if ( rand(1) &lt; 0.5 ) {
-        $self->break_bone;
-    }
-}</code></pre>
-</div>
-
-<div class="slide">
-  <h1>Still Full of Fail</h1>
+  <h1>Conflicts Are a Smell</h1>
 
   <ul>
-    <li>Roles are also about semantics!</li>
-    <li>We've fulfilled the letter and lost the spirit</li>
+    <li>Roles are about semantics!</li>
     <li>Roles have a <em>meaning</em></li>
-    <li>Think twice before blindly aliasing and excluding methods!</li>
+    <li>Method name conflicts smell like bad design</li>
   </ul>
 </div>
 
 <div class="slide">
-  <h1>Hot Role-on-Role Action</h1>
+  <h1>Roles With Roles</h1>
 
   <pre><code>package Comparable;
 use Moose::Role;
@@ -1462,7 +1458,7 @@ requires 'compare';</code></pre>
 </div>
 
 <div class="slide">
-  <h1>Hot Role-on-Role Action</h1>
+  <h1>Roles With Roles</h1>
 
   <pre><code>package TestsEquality;
 use Moose::Role;
@@ -1471,7 +1467,7 @@ with 'Comparable';
 
 sub is_equal {
     my $self = shift;
-    return $self->compare(@_) == 0;
+    return $self-&gt;compare(@_) == 0;
 }</code></pre>
 </div>
 
@@ -1486,36 +1482,8 @@ with 'TestsEquality';
 # Satisfies the Comparable role
 sub compare { ... }
 
-Integer->does('TestsEquality'); # true
-Integer->does('Comparable'); # also true!</code></pre>
-</div>
-
-<div class="slide">
-  <h1>Name Conflicts Between Roles</h1>
-
-  <pre><code>package HasSubProcess;
-use Moose::Role;
-
-<span class="highlight">sub execute { ... }</span>
-
-package Killer;
-use Moose::Role;
-
-with 'HasSubProcess';
-
-<span class="highlight">sub execute { ... }</span></code></pre>
-</div>
-
-<div class="slide">
-  <h1>Delayed Conflict</h1>
-
-  <pre><code>package StateOfTexas;
-with 'Killer';</code></pre>
-
-  <ul>
-    <li><code>StateOfTexas</code> must implement its own <code>execute</code></li>
-    <li>But loading the <code>Killer</code> role by itself does not cause an error</li>
-  </ul>
+Integer-&gt;does('TestsEquality'); # true
+Integer-&gt;does('Comparable'); # also true!</code></pre>
 </div>
 
 <div class="slide">
@@ -1541,7 +1509,7 @@ use Moose;
 
 <span class="incremental">with 'HasSize';
 
-has size => ( is => 'ro' );</span></code></pre>
+has size =&gt; ( is =&gt; 'ro' );</span></code></pre>
 </div>
 
 <div class="slide">
@@ -1555,7 +1523,7 @@ requires 'size';
 package Shirt;
 use Moose;
 
-has size => ( is => 'ro' );
+has size =&gt; ( is =&gt; 'ro' );
 
 with 'HasSize';</code></pre>
 </div>
@@ -1577,9 +1545,9 @@ with 'HasSize';</code></pre>
   <pre><code>package Comparison;
 use Moose;
 
-has [ 'left', 'right' ] => (
-    is   => 'ro',
-    <span class="highlight">does => 'Comparable',</span>
+has [ 'left', 'right' ] =&gt; (
+    is   =&gt; 'ro',
+    <span class="highlight">does =&gt; 'Comparable',</span>
 );
 </code></pre>
 
@@ -1594,7 +1562,7 @@ has [ 'left', 'right' ] => (
 
   <pre><code>use Moose::Util qw( apply_all_roles );
 
-my $fragile_person = Person->new( ... );
+my $fragile_person = Person-&gt;new( ... );
 apply_all_roles( $fragile_person,
                  'IsFragile' );</code></pre>
 
@@ -1668,8 +1636,6 @@ requires 'compare';
   <h1>Real Examples</h1>
 
   <ul>
-    <li>Column and ColumnAlias both <em>do</em> ColumnLike</li>
-    <li>ColumnLike things can be used in certain parts of queries</li>
     <li>All queries <em>do</em> HasWhereClause</li>
     <li>Select <em>does</em> Comparable and Selectable (for subselects)</li>
     <li>A where clause requires its components to <em>do</em> Comparable</li>
@@ -1731,6 +1697,15 @@ has 'is_ripped' =&gt; ( is =&gt; 'rw' );</code></pre>
 </div>
 
 <div class="slide">
+  <h1>Read-only vs Read-write</h1>
+
+  <ul>
+    <li>Read-only is preferred</li>
+    <li>Minimize state in your application</li>
+  </ul>
+</div>
+
+<div class="slide">
   <h1>Required-ness</h1>
 
   <ul>
@@ -1750,8 +1725,8 @@ has first_name =&gt; (
     <span class="current incremental">required =&gt; 1,</span>
 );
 
-<span class="incremental">Person->new( first_name =&gt; undef ); # ok
-Person->new(); # kaboom</span></code></pre>
+<span class="incremental">Person-&gt;new( first_name =&gt; undef ); # ok
+Person-&gt;new(); # kaboom</span></code></pre>
 </div>
 
 <div class="slide">
@@ -1759,7 +1734,7 @@ Person->new(); # kaboom</span></code></pre>
 
   <ul>
     <li>Attributes can have defaults</li>
-    <li>Simple non-referecne scalars (number, string)</li>
+    <li>Simple non-reference scalars (number, string)</li>
     <li>Subroutine reference</li>
     <li>A builder method</li>
   </ul>
@@ -1816,6 +1791,7 @@ use Moose;
 
 has bank =&gt; (
     is      =&gt; 'rw',
+    # THIS WILL NOT WORK
     <span class="wrong">default =&gt; Bank-&gt;new(
                    name =&gt; 'Spire FCU' ),</span>
 );</code></pre>
@@ -1838,25 +1814,11 @@ has packages =&gt; (
 </div>
 
 <div class="slide">
-  <h1>What if I Want to Share?</h1>
-
-  <pre><code>package Person;
-use Moose;
-
-my $highlander_bank =
-    Bank-&gt;new( name =&gt; 'Spire FCU' );
-
-has bank =&gt; (
-    is      =&gt; 'rw',
-    default =&gt; sub { $highlander_bank },
-);</code></pre>
-</div>
-
-<div class="slide">
   <h1>Builder</h1>
 
   <ul>
-    <li>A method <em>name</em> which returns the default</li>
+    <li>A method <em>name</em></li>
+    <li>When called, this method returns the default value</li>
   </ul>
 </div>
 
@@ -1874,7 +1836,7 @@ has bank =&gt; (
 sub _build_bank {
     my $self = shift;
     return Bank-&gt;new(
-        name => 'Spire FCU' );
+        name =&gt; 'Spire FCU' );
 }</code></pre>
 </div>
 
@@ -1930,7 +1892,8 @@ has bank =&gt; (
 use Moose;
 
 has shoe_size =&gt; (
-    is =&gt; 'ro',
+    is       =&gt; 'ro',
+    required =&gt; 1,
 );</code></pre>
 </div>
 
@@ -1940,7 +1903,7 @@ has shoe_size =&gt; (
   <pre><code>has shoes =&gt; (
     is      =&gt; 'ro',
     <span class="highlight">lazy    =&gt; 1,</span>
-    builder => '_build_shoes',
+    builder =&gt; '_build_shoes',
 );
 
 sub _build_shoes {
@@ -2013,16 +1976,16 @@ has account =&gt; (
   <pre><code>package Person;
 use Moose;
 
-has shoe_size => (
+has shoe_size =&gt; (
     is       =&gt; 'ro',
     <span class="highlight">init_arg =&gt; 'foot_size',</span>
 );
 
-Person->new( <span class="wrong">shoe_size =&gt; 13</span> );
+Person-&gt;new( <span class="wrong">shoe_size =&gt; 13</span> );
 
 my $person =
-    Person->new( <span class="right">foot_size =&gt; 13</span> );
-print $person->shoe_size;</code></pre>
+    Person-&gt;new( <span class="right">foot_size =&gt; 13</span> );
+print $person-&gt;shoe_size;</code></pre>
 </div>
 
 <div class="slide">
@@ -2031,12 +1994,12 @@ print $person->shoe_size;</code></pre>
 <pre><code>package Person;
 use Moose;
 
-has shoes => (
+has shoes =&gt; (
     is       =&gt; 'ro',
     <span class="highlight">init_arg =&gt; undef,</span>
 );
 
-Person->new( <span class="wrong">shoes =&gt; Shoes-&gt;new</span> );</code></pre>
+Person-&gt;new( <span class="wrong">shoes =&gt; Shoes-&gt;new</span> );</code></pre>
 </div>
 
 <div class="slide">
@@ -2055,15 +2018,7 @@ Person->new( <span class="wrong">shoes =&gt; Shoes-&gt;new</span> );</code></pre
 
   <ul>
     <li>By default, subclasses inherit attribute as-is</li>
-    <li>Can change some attribute parameters in subclasses
-      <ul>
-        <li>default</li>
-        <li>builder</li>
-        <li>required</li>
-        <li>lazy</li>
-        <li>others we've not yet covered</li>
-      </ul>
-    </li>
+    <li>Can change attribute parameters in subclasses</li>
   </ul>
 </div>   
 
@@ -2183,6 +2138,13 @@ has first_name =&gt; (
     <li>Attributes can have a <code>default</code> or <code>builder</code></li>
     <li>Attributes with a default or builder can be <code>lazy</code></li>
     <li>Attributes can have a <code>clearer</code> and/or <code>predicate</code></li>
+  </ul>
+</div>
+
+<div class="slide">
+  <h1>Basic Attributes Summary</h1>
+
+  <ul>
     <li>An attribute's constructor name can be changed with <code>init_arg</code></li>
     <li>A subclass can alter its parents' attributes</li>
     <li>Attribute accessor names can be changed</li>
@@ -2212,18 +2174,18 @@ Iterate til this passes all its tests</pre>
 
   <ul>
     <li>Apply to an existing method</li>
-    <li>... from a parent class, the current class, or a role</li>
+    <li>... that comes from a parent class, the current class, or a role</li>
     <li>Roles can provide modifiers that are applied at composition time</li>
   </ul>
 </div>
 
 <div class="slide">
-  <h1>What is a Method Modifier</h1>
+  <h1>What Are Method Modifiers For?</h1>
 
   <ul>
     <li>"Inject" behavior</li>
     <li>Add behavior to generated methods (accessors, delegations)</li>
-    <li>Provide roles which modify existing behavior</li>
+    <li>Added from a role, can modify existing behavior</li>
   </ul>
 </div>
 
@@ -2350,7 +2312,7 @@ after clear_password =&gt; sub {
         $self-&gt;$orig(
             $self-&gt;_munge_insert(@_) );
 
-    $new_user->_assign_uri;
+    $new_user-&gt;_assign_uri;
     return $new_user;
 };</code></pre>
 </div>
@@ -2359,7 +2321,7 @@ after clear_password =&gt; sub {
   <h1>Modifier Order</h1>
 
   <ul>
-    <li>Before runs order from last to first</li>
+    <li>Before runs in order from last to first</li>
     <li>After runs in order from first to last</li>
     <li>Around runs in order from last to first</li>
   </ul>
@@ -2409,59 +2371,6 @@ around run</span> =&gt; sub {
 </div>
 
 <div class="slide">
-  <h1>Augment and Inner</h1>
-
-  <ul>
-    <li>Inverted <code>super</code></li>
-    <li>From least- to most-specific</li>
-    <li>Grandparent to parent to child</li>
-    <li>Not allowed in roles</li>
-  </ul>
-</div>
-
-<div class="slide">
-  <h1>Augment and Inner</h1>
-
-  <pre><code>package Document;
-
-sub xml { '&lt;doc&gt;' . <span class="highlight">inner()</span> . '&lt;/doc&gt;' }
-
-package Report;
-extends 'Document';
-<span class="highlight">augment xml</span> =&gt;
-    sub { title() . <span class="highlight">inner()</span> . summary() };
-
-package TPSReport;
-extends 'Report';
-<span class="highlight">augment xml</span> =&gt;
-    sub { tps_xml() . <span class="highlight">inner()</span> };</code></pre>
-</div>
-
-<div class="slide">
-  <h1>Augment and Inner</h1>
-
-  <ul>
-    <li>When we call <code>$tps-&gt;xml</code> ...
-      <ul>
-        <li><code>Document-&gt;xml</code></li>
-        <li><code>Report-&gt;xml</code></li>
-        <li><code>TPSReport-&gt;xml</code></li>
-      </ul>
-    </li>
-  </ul>
-</div>
-
-<div class="slide">
-  <h1>Augment and Inner Usage</h1>
-
-  <ul>
-    <li>Call <code>inner()</code> to "fill in the blank"</li>
-    <li>Requires designing for subclassing</li>
-    <li>Call <code>inner()</code> in the terminal class, just in case</li>
-  </ul>
-</div>
-
-<div class="slide">
   <h1>Method Modifiers Summary</h1>
 
   <ul>
@@ -2487,21 +2396,7 @@ extends 'Report';
         <li>not call the original method at all (or call a <em>different</em> method)</li>
       </ul>
     </li>
-  </ul>
-</div>
-
-<div class="slide">
-  <h1>Method Modifiers Summary</h1>
-
-  <ul>
     <li>When using modifiers in a role, require the modified method</li>
-    <li>Use <code>augment</code> and <code>inner</code> to invert the normal subclassing flow ...
-      <ul>
-        <li>Least- to most-specific (parents to children)</li>
-        <li>Build in "insertability" (stick more stuff in the "middle")</li>
-      </ul>
-    </li>
-    <li>Always call <code>inner</code> in the most specific subclass to allow for future extension</li>
   </ul>
 </div>
 
@@ -2556,11 +2451,11 @@ Item
     Undef
     Defined
         Value
-           Num
-             Int
-           Str
-             ClassName
-             RoleName
+            Str
+                Num
+                    Int
+                ClassName
+                RoleName
 </pre>
 </div>
 
@@ -2570,6 +2465,7 @@ Item
 <pre>
 (Item)
     (Defined)
+        (Value)
         Ref
             ScalarRef
             ArrayRef[`a]
@@ -2577,7 +2473,7 @@ Item
             CodeRef
             RegexpRef
             GlobRef
-              FileHandle
+                FileHandle
             Object
 </pre>
 </div>
@@ -2586,15 +2482,12 @@ Item
   <h1>Bool</h1>
 
   <h2>True</h2>
-  <pre><code>1
-924.1
-'true'
-{}</code></pre>
+  <pre><code>1</code></pre>
 
   <h2>False</h2>
   <pre><code>0
-0.0
 '0'
+''
 undef</code></pre>
 
   <ul>
@@ -2608,6 +2501,7 @@ undef</code></pre>
   <ul>
     <li><code>Value</code> is true when <code>! ref $thing</code></li>
     <li><code>Value</code> and <code>Str</code> are effectively the same, but <code>Str</code> is more expressive</li>
+    <li><code>Num</code> is true when a <code>$scalar</code> looks like a number</li>
     <li>An overloaded object which numifies does not pass the <code>Num</code> constraint!</li>
     <li>Perl 5's overloading is hopelessly broken</li>
   </ul>
@@ -2708,9 +2602,11 @@ has start_date =&gt; (
   <h1>Subtype Shortcuts - <code>class_type</code></h1>
 
   <pre><code>use Moose::Util::TypeConstraints;
-class_type 'DateTime';
+class_type 'DateTime';</code></pre>
+
+<hr />
 
-subtype 'DateTime',
+<pre><code>subtype     'DateTime',
     as      'Object',
     where   { $_-&gt;isa('DateTime') },
     message { ... };</code></pre>
@@ -2720,10 +2616,12 @@ subtype 'DateTime',
   <h1>Subtype Shortcuts - <code>role_type</code></h1>
 
   <pre><code>use Moose::Util::TypeConstraints;
-role_type 'Printable';
+role_type 'Printable';</code></pre>
 
-subtype 'Printable',
-    as      'Object',
+<hr />
+
+<pre><code>subtype 'Printable',
+    as  'Object',
     where
         { Moose::Util::does_role(
               $_, 'Printable' ) },
@@ -2734,9 +2632,11 @@ subtype 'Printable',
   <h1>Subtype Shortcuts - <code>duck_type</code></h1>
 
   <pre><code>use Moose::Util::TypeConstraints;
-duck_type Car =&gt; qw( run break_down );
+duck_type Car =&gt; qw( run break_down );</code></pre>
+
+<hr />
 
-subtype 'Car',
+<pre><code>subtype 'Car',
     as      'Object',
     where   { all { $_-&gt;can($_) }
               qw( run break_down ) },
@@ -2747,12 +2647,14 @@ subtype 'Car',
   <h1>Subtype Shortcuts - <code>enum</code></h1>
 
   <pre><code>use Moose::Util::TypeConstraints;
-enum Color =&gt; qw( red blue green ) );
+enum Color =&gt; qw( red blue green );</code></pre>
 
-my %ok = map { $_ =&gt; 1 }
+<hr />
+
+<pre><code>my %ok = map { $_ =&gt; 1 }
              qw( red blue green );
 
-subtype 'Color'
+subtype     'Color'
     as      'Str',
     where   { $ok{$_} },
     message { ... };</code></pre>
@@ -2823,12 +2725,13 @@ coerce 'My::DateTime',
 <div class="slide">
   <h1>Coercion Examples</h1>
 
-  <pre><code>coerce 'ArrayRef[Int]',
+  <pre><code># BAD CODE - DO NOT COPY
+coerce 'ArrayRef[Int]',
     from 'Int',
     via  { [ $_ ] };</code></pre>
 
   <ul>
-    <li>Coerce instead of a union like <code style="white-space: nowrap">Int | ArrayRef[Int]</code></li>
+    <li>Instead of union - <code style="white-space: nowrap">Int | ArrayRef[Int]</code></li>
   </ul>
 </div>
 
@@ -2853,7 +2756,7 @@ has favorite_numbers =&gt; (
   <h1>More Droppings</h1>
 
   <ul>
-    <li><code>Moose::Util::TypeConstraint</code> also needs cleanup</li>
+    <li><code>Moose::Util::TypeConstraints</code> also needs cleanup</li>
   </ul>
 
   <pre><code>package Person;
@@ -2868,6 +2771,19 @@ no Moose;
 </div>
 
 <div class="slide">
+  <h1>Questions So Far?</h1>
+</div>  
+
+<div class="slide">
+  <h1>Exercises</h1>
+
+  <pre># cd exercises
+# perl bin/prove -lv t/05-types.t
+
+Iterate til this passes all its tests</pre>
+</div>
+
+<div class="slide">
   <h1>Typed Methods (Low-tech)</h1>
 
   <pre class="medium"><code>package Person;
@@ -2880,7 +2796,7 @@ sub work {
             \@_,
             tasks    =&gt;
                 { isa    =&gt; 'ArrayRef[Task]',
-                  coerce =&gt;1 },
+                  coerce =&gt; 1 },
             can_rest =&gt;
                 { isa     =&gt; 'Bool',
                   default =&gt; 0 },
@@ -2998,9 +2914,9 @@ coerce <span class="highlight">ArrayOfInt</span>
 
 use MyApp::Types qw( ArrayOfInt );
 
-has transaction_history => (
-    is  => 'rw',
-    isa => ArrayOfInt,
+has transaction_history =&gt; (
+    is  =&gt; 'rw',
+    isa =&gt; ArrayOfInt,
 );</code></pre>
 </div>
 
@@ -3010,7 +2926,7 @@ has transaction_history => (
   <ul>
     <li>Type names are exported functions, catches typos early</li>
     <li>Types must be pre-declared</li>
-    <li>Types are stored with namespaces internally, but externally are short</li>
+    <li>Types are stored with namespaces internally, but you use short names</li>
     <li>Import existing Moose types as functions from <code>MooseX::Types::Moose</code></li>
     <li>Still need string names for things like <code>ArrayRef['Email::Address']</code></li>
   </ul>
@@ -3023,7 +2939,7 @@ has transaction_history => (
     <li><span class="right">Catches typos at compile time</span></li>
     <li><span class="right">Automatic namespacing</span></li>
     <li><span class="wrong">One more thing to install and learn</span></li>
-    <li><span class="wrong">Every name gets types twice (declared and then defined)</span></li>
+    <li><span class="wrong">Every name is typed twice (declared and then defined)</span></li>
     <li><span class="wrong">Still stuck with strings when referring to class or role names</span></li>
     <li><span class="wrong">Coercion gotcha from earlier still applies to types exported from <code>MooseX::Types::Moose</code></span></li>
   </ul>
@@ -3044,15 +2960,6 @@ has transaction_history => (
   <h1>Questions?</h1>
 </div>  
 
-<div class="slide">
-  <h1>Exercises</h1>
-
-  <pre># cd exercises
-# perl bin/prove -lv t/05-types.t
-
-Iterate til this passes all its tests</pre>
-</div>
-
 <div class="slide fake-slide0">
   <h1>Part 6: Advanced Attributes</h1>
 </div>
@@ -3150,7 +3057,7 @@ $alice-&gt;friend($bob);</code></pre>
 
   <pre><code>after salary_level =&gt; {
     my $self = shift;
-    return unless @_;
+    <span class="highlight">return unless @_;</span>
     $self-&gt;clear_salary;
 };</code></pre>
 </div>
@@ -3162,11 +3069,22 @@ $alice-&gt;friend($bob);</code></pre>
 
   <pre><code>has salary_level =&gt; (
     is      =&gt; 'rw',
-    trigger =&gt; sub { $_[0]-&gt;clear_salary },
+    trigger =&gt;
+        sub { $_[0]-&gt;clear_salary },
 );</code></pre>
 </div>
 
 <div class="slide">
+  <h1>Trigger Arguments</h1>
+
+  <ul>
+    <li><code>$self</code></li>
+    <li><code>$new_value</code></li>
+    <li><code>$old_value</code> - if one exists</li>
+  </ul>
+</div>
+
+<div class="slide">
   <h1>Delegation</h1>
 
   <ul>
@@ -3182,7 +3100,7 @@ $alice-&gt;friend($bob);</code></pre>
 
 has lungs =&gt; (
     is      =&gt; 'ro',
-    isa     => 'Lungs',
+    isa     =&gt; 'Lungs',
     <span class="highlight">handles =&gt; [ 'inhale', 'exhale' ],</span>
 );</code></pre>
 
@@ -3223,6 +3141,7 @@ has lungs =&gt; (
   <h1>Array Reference</h1>
 
   <ul>
+    <li>1-to-1 mapping</li>
     <li>Takes each method name and creates a simple delegation from the delegating class to the delegatee attribute</li>
   </ul>
 </div>
@@ -3315,17 +3234,36 @@ has history =&gt; (
   <ul>
     <li>Delegate to <em>unblessed</em> Perl types</li>
     <li>Scalar, array or hash ref, etc</li>
+    <li>Treat Perl types as objects</li>
+    <li>Still uses <code>handles</code></li>
+    <li>Pretend that native Perl types have methods</li>
+  </ul>
+</div>
+
+<div class="slide">
+  <h1>Native Delegation - Array(Ref)</h1>
+
+  <ul>
+    <li>Methods include:
+      <ul>
+        <li><code>push</code></li>
+        <li><code>shift</code></li>
+        <li><code>elements</code> - returns all elements</li>
+        <li><code>count</code></li>
+        <li><code>is_empty</code></li>
+        <li>quite a few more</li>
+      </ul>
+    </li>
   </ul>
 </div>
 
 <div class="slide">
-  <h1>Native Delegation - Array</h1>
+  <h1>Native Delegation - Array(Ref)</h1>
 
   <pre><code>package Person;
 use Moose;
 has _favorite_numbers =&gt; (
     traits   =&gt; [ 'Array' ],
-    is       =&gt; 'ro',
     isa      =&gt; 'ArrayRef[Int]',
     default  =&gt; sub { [] },
     init_arg =&gt; undef,
@@ -3337,23 +3275,71 @@ has _favorite_numbers =&gt; (
 </div>
 
 <div class="slide">
-  <h1>Native Delegation - Counter</h1>
+  <h1>Native Delegation - Array(Ref)</h1>
+
+  <pre><code>my $person = Person-&gt;new();
+
+$person-&gt;add_favorite_number(7);
+$person-&gt;add_favorite_number(42);
+
+print "$_\n"
+    for $person-&gt;favorite_numbers;
+
+# 7
+# 42</code></pre>
+</div>
+
+<div class="slide">
+  <h1>Native Delegation</h1>
+
+  <ul>
+    <li>Native types are ...
+      <ul>
+        <li>Number - <code>add</code>, <code>mul</code>, ...</li>
+        <li>String - <code>append</code>, <code>chop</code>, ...</li>
+        <li>Counter - <code>inc</code>, <code>dec</code>, ...</li>
+        <li>Bool - <code>set</code>, <code>toggle</code>, ...</li>
+        <li>Hash - <code>get</code>, <code>set</code>, ...</li>
+        <li>Array - already saw it</li>
+        <li>Code - <code>execute</code> and <code>execute_method</code></li>
+      </ul>
+    </li>
+  </ul>
+</div>
+
+<div class="slide">
+  <h1>Curried Delegation</h1>
+
+  <ul>
+    <li>A delegation with some preset arguments</li>
+    <li>Works with object or Native delegation</li>
+  </ul>
+</div>
+
+<div class="slide">
+  <h1>Curried Delegation</h1>
 
-  <pre><code>package Stack;
+  <pre><code>package Person;
 use Moose;
-has depth =&gt; (
-    traits   =&gt; [ 'Counter' ],
-    is       =&gt; 'ro',
-    isa      =&gt; 'Int',
-    default  =&gt; 0,
-    init_arg =&gt; undef,
-    <span class="highlight">handles  =&gt;
-      { _inc_depth =&gt; 'inc',
-        _dec_depth =&gt; 'dec',
-      },</span>
+has account =&gt; (
+    is      =&gt; 'ro',
+    isa     =&gt; 'BankAccount',
+    handles =&gt; {
+        receive_100 =&gt;
+            <span class="highlight">[ 'deposit', 100 ]</span>,
+        give_100    =&gt;
+            <span class="highlight">[ 'withdraw', 100 ]</span>
+    },
 );</code></pre>
 </div>
 
+<div class="slide">
+  <h1>Curried Delegation</h1>
+
+  <pre><code>$person-&gt;receive_100;
+# really is
+$person-&gt;account-&gt;deposit(100);</code></pre>
+</div>
 
 <div class="slide">
   <h1>Traits and Metaclasses</h1>
@@ -3380,7 +3366,7 @@ has depth =&gt; (
   <h1>Traits and Metaclasses</h1>
 
   <ul>
-    <li>Can add/alter/remove attribute parameter (from <code>has</code>)</li>
+    <li>Can add/alter/remove an attribute parameter (from <code>has</code>)</li>
     <li>Can change behavior of created attribute</li>
   </ul>
 </div>
@@ -3438,6 +3424,7 @@ print <span class="highlight">Person-&gt;meta
     <li>Use <code>weak_ref</code> to avoid circular references</li>
     <li>Use trigger to do an action post-attribute write</li>
     <li>Use delegations to hide "internal" objects</li>
+    <li>Use native delegations to treat Perl types as objects</li>
     <li>Traits and metaclasses let you extend Moose's core attribute features</li>
   </ul>
 </div>
@@ -3456,20 +3443,228 @@ print <span class="highlight">Person-&gt;meta
 Iterate til this passes all its tests</pre>
 </div>
 
-<div class="slide fake-slide0">
-  <h1>Part 7: Introspection</h1>
+<div class="slide">
+  <h1>CYOA</h1>
+
+  <p>
+    If there is time, keep going ...
+  </p>
+
+  <p>
+    Otherwise, jump to slide 269 ...
+  </p>
 </div>
 
 <div class="slide fake-slide0">
-  <h1>Part 8: A Tour of MooseX</h1>
+  <h1>Bonus: A Brief Tour of MooseX</h1>
 </div>
 
-<div class="slide fake-slide0">
-  <h1>Part 9: Writing Moose Extensions</h1>
+<div class="slide">
+  <h1>Notable MX Modules on CPAN</h1>
+
+  <ul>
+    <li><strong>Not comprehensive</strong></li>
+    <li>188 MooseX distributions on CPAN as of 02/03/2011</li>
+    <li>Some of them are crap</li>
+  </ul>
 </div>
 
-<div class="slide fake-slide0">
-  <h1>The End</h1>
+<div class="slide">
+  <h1>Already Mentioned Several</h1>
+
+  <ul>
+    <li><code>MooseX::NonMoose</code> - best solution for subclassing non-Moose parents</li>
+    <li><code>MooseX::Declare</code> - <em>real</em> Perl 5 OO</li>
+    <li><code>MooseX::FollowPBP</code> and <code>MooseX::SemiAffordanceAccessor</code></li>
+    <li><code>MooseX::Params::Validate</code> and <code>MooseX::Method::Signatures</code></li>
+    <li><code>MooseX::Types</code></li>
+  </ul>
+</div>    
+
+<div class="slide">
+  <h1>MooseX::Declare</h1>
+
+<pre><code>use MooseX::Declare;
+use 5.12.0; # for say
+
+class Person {
+    has greeting =&gt;
+        ( is =&gt; 'ro', isa =&gt; 'Str' );
+
+    method speak {
+        say $self-&gt;greeting;
+    }
+}</code></pre>
+</div>
+
+<div class="slide">
+  <h1>MooseX::Declare</h1>
+
+  <ul>
+    <li>Still experimental-ish, but seeing more and more use</li>
+    <li><strong>Not</strong> a source filter!</li>
+    <li>Hooks into the Perl parser rather than filtering all your code</li>
+    <li>But not supported by <code>PPI</code>, <code>perltidy</code>, etc. (yet?)</li>
+  </ul>
+</div>
+
+<div class="slide">
+  <h1>MooseX::StrictConstructor</h1>
+
+  <ul>
+    <li>By default, unknown constructor arguments are ignored</li>
+    <li>MX::StrictConstructor turns these into an error</li>
+  </ul>
+</div>
+
+<div class="slide">
+  <h1>MooseX::StrictConstructor</h1>
+
+  <pre><code>package Person;
+
+use Moose;
+<span class="highlight">use MooseX::StrictConstructor;</span>
+
+has name =&gt; ( is =&gt; 'ro' );
+
+Person-&gt;new
+    ( na<span class="wrong">n</span>e =&gt; 'Ringo Shiina' ); # kaboom</code></pre>
+</div>
+
+<div class="slide">
+  <h1>MooseX::Traits</h1>
+
+  <ul>
+    <li>Combines object construction and role application</li>
+    <li>Makes it easy to create one-off customized objects</li>
+  </ul>
+</div>
+
+<div class="slide">
+  <h1>MooseX::Traits</h1>
+
+  <pre><code>package MyApp::Thingy;
+use Moose;
+
+<span class="highlight">with 'MooseX::Traits';</span>
+
+my $thing =
+    MyApp::Thingy-&gt;<span class="highlight">new_with_traits</span>
+        ( <span class="highlight">traits =&gt; [ 'Foo', 'Bar' ],</span>
+          size   =&gt; 42 );</code></pre>
+</div>
+
+<div class="slide">
+  <h1>MooseX::Getopt</h1>
+
+  <ul>
+    <li>Makes command-line interface programs easy!</li>
+    <li>Construct an object from CLI arguments</li>
+  </ul>
+</div>
+
+<div class="slide">
+  <h1>MooseX::Getopt</h1>
+
+  <pre><code>package App::CLI;
+use Moose;
+
+<span class="highlight">with 'MooseX::Getopt';</span>
+
+has file    =&gt;
+    ( is =&gt; 'ro', required =&gt; 1 );
+has filters =&gt;
+    ( is =&gt; 'ro', isa =&gt; 'ArrayRef[Str]' );
+
+sub run { ... }</code></pre>
+</div>
+
+<div class="slide">
+  <h1>MooseX::Getopt</h1>
+
+  <ul>
+    <li>Then call it like this:</li>
+  </ul>
+
+<pre><code>#!/usr/bin/perl
+
+use App::CLI;
+
+<span class="highlight">App::CLI-&gt;new_with_options()</span>-&gt;run();</code></pre>
+
+<pre>$ myapp-cli \
+   --file foo \
+   --filters compress \
+   --filters sanitize</pre>
+</div>
+
+<div class="slide">
+  <h1>MooseX::Clone</h1>
+
+  <pre><code>package Person;
+
+use Moose;
+<span class="highlight">with 'MooseX::Clone';</span>
+
+my $person = Person-&gt;new;
+my $clone  = <span class="highlight">$person-&gt;clone;</span></code></pre>
+</div>
+
+<div class="slide">
+  <h1>MooseX::NonMoose</h1>
+
+  <ul>
+    <li>Highly recommended for subclassing non-Moose parents</li>
+    <li>Gets all the little annoying details right</li>
+  </ul>
+</div>
+
+<div class="slide">
+  <h1>MooseX::Role::Parameterized</h1>
+
+  <pre><code>package HasCollection;
+<span class="current incremental">use MooseX::Role::Parameterized;</span>
+<span class="incremental">parameter type =&gt; ( isa     =&gt; 'Str',
+                    default =&gt; 'Item' );</span>
+<span class="incremental">role {
+    my $p = shift;
+
+    my $type =
+        'ArrayRef[' . $p-&gt;type() . ']';
+    has collection =&gt;
+        ( is  =&gt; 'ro',
+          isa =&gt; $type );
+};</span></code></pre>
+</div>
+
+<div class="slide">
+  <h1>MooseX::Role::Parameterized</h1>
+
+  <pre><code>package Person;
+
+use Moose;
+with HasCollection =&gt; { type =&gt; 'Int' };</code></pre>
+</div>
+
+<div class="slide">
+  <h1>Questions?</h1>
+</div>  
+
+<div class="slide">
+  <h1>Moose-using Modules</h1>
+
+  <p>
+    For further reading, a few modules which use Moose ...
+  </p>
+
+  <ul>
+    <li><a href="http://search.cpan.org/dist/Catalyst-Runtime">Catalyst</a></li>
+    <li><a href="http://search.cpan.org/dist/CHI">CHI</a></li>
+    <li><a href="http://search.cpan.org/dist/Devel-REPL">Devel::REPL</a></li>
+    <li><a href="http://search.cpan.org/dist/Email-Sender">Email::Sender</a></li>
+    <li><a href="http://search.cpan.org/dist/Fey">Fey</a></li>
+    <li><a href="http://search.cpan.org/dist/Net-Twitter">Net::Twitter</a></li>
+  </ul>
 </div>
 
 <div class="slide">
@@ -3482,10 +3677,14 @@ Iterate til this passes all its tests</pre>
     <li>mailing list - <a href="mailto:moose@perl.org">moose@perl.org</a></li>
     <li>Slides and exercises are in Moose's git repo:
         <br />
-        <span style="white-space: nowrap">git://jules.scsys.co.uk/gitmo/moose-presentations</span></li>
+        <span style="font-size:80%; white-space: nowrap">git://git.moose.perl.org/moose-presentations.git</span></li>
   </ul>
 </div>
 
+<div class="slide fake-slide0">
+  <h1>The End</h1>
+</div>
+
 </div> 
 </body>
 </html>