moved slides to slides
Dave Rolsky [Sun, 7 Jun 2009 18:51:54 +0000 (13:51 -0500)]
17 files changed:
moose-class/slides/index.html [moved from moose-class/index.html with 89% similarity]
moose-class/slides/outline [moved from moose-class/outline with 100% similarity]
moose-class/slides/ui/bg-shade.png [moved from moose-class/ui/bg-shade.png with 100% similarity]
moose-class/slides/ui/custom.css [moved from moose-class/ui/custom.css with 95% similarity]
moose-class/slides/ui/default/blank.gif [moved from moose-class/ui/default/blank.gif with 100% similarity]
moose-class/slides/ui/default/bodybg.gif [moved from moose-class/ui/default/bodybg.gif with 100% similarity]
moose-class/slides/ui/default/framing.css [moved from moose-class/ui/default/framing.css with 100% similarity]
moose-class/slides/ui/default/iepngfix.htc [moved from moose-class/ui/default/iepngfix.htc with 100% similarity]
moose-class/slides/ui/default/notes.css [moved from moose-class/ui/default/notes.css with 100% similarity]
moose-class/slides/ui/default/opera.css [moved from moose-class/ui/default/opera.css with 100% similarity]
moose-class/slides/ui/default/outline.css [moved from moose-class/ui/default/outline.css with 100% similarity]
moose-class/slides/ui/default/pretty.css [moved from moose-class/ui/default/pretty.css with 100% similarity]
moose-class/slides/ui/default/print.css [moved from moose-class/ui/default/print.css with 100% similarity]
moose-class/slides/ui/default/s5-core.css [moved from moose-class/ui/default/s5-core.css with 100% similarity]
moose-class/slides/ui/default/slides.css [moved from moose-class/ui/default/slides.css with 100% similarity]
moose-class/slides/ui/default/slides.js [moved from moose-class/ui/default/slides.js with 100% similarity]
moose-class/slides/ui/s5-notes.html [moved from moose-class/ui/s5-notes.html with 100% similarity]

similarity index 89%
rename from moose-class/index.html
rename to moose-class/slides/index.html
index d860eb0..dcae330 100644 (file)
@@ -836,6 +836,7 @@ use Moose;</code></pre>
 
   <ul>
     <li><code>Moose.pm</code> provides declarative sugar</li>
+    <li>Turns on <code>strict</code> and <code>warnings</code></li>
     <li>Creates metaclasses for your class: <code>Person-&gt;meta</code></li>
     <li>Moose classes automatically inherit from <code>Moose::Object</code></li>
   </ul>
@@ -872,14 +873,14 @@ use Moose;
 
   <h2 class="wrong">WRONG</h2>
 
-  <pre><code>package BadEmployee;
+  <pre><code>package EvilEmployee;
 use Moose;
 extends 'Person';
 extends 'Thief';</pre></code>
 
   <h2 class="right">RIGHT</h2>
 
-  <pre><code>package BadEmployee;
+  <pre><code>package EvilEmployee;
 use Moose;
 extends 'Person', 'Thief';</pre></code>
 </div>
@@ -904,6 +905,90 @@ extends 'LWP';</pre></code>
 </div>  
 
 <div class="slide">
+  <h1><code>overrides</code> and <code>super</code></h1>
+
+  <ul>
+    <li><code>overrides</code> is another method modifier</li>
+    <li>An alternative to Perl's <code>SUPER::</code></li>
+  </ul>
+</div>
+
+<div class="slide">
+  <h1><code>overrides</code> and <code>super</code></h1>
+
+  <pre><code>package Employee;
+use Moose;
+
+<span class="incremental current">extends 'Person';</span>
+
+<span class="incremental">overrides</span> work =&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>
+
+<div class="slide">
+  <h1>Caveat <code>super</code></h1>
+
+  <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>
+  </ul>
+</div>
+
+<div class="slide">
+  <h1>Attributes (Part 1)</h1>
+
+  <ul>
+    <li><code>has 'foo'</code></li>
+    <li>Use <code>is =&gt; 'ro'</code> or <code>is =&gt; 'rw'</code></li>
+    <li>Attributes without "is" have no accessors</li>
+  </ul>
+</div>
+
+<div class="slide">
+  <h1>Read-write attributes</h1>
+
+  <pre><code>package Person;
+use Moose;
+
+has 'first_name' =&gt; ( <span class="highlight">is =&gt; 'rw'</span> );
+
+my $person =
+    Person-&gt;new( first_name =&gt; 'Dave' );
+
+$person-&gt;first_name('Stevan');
+print $person-&gt;first_name; # Stevan</code></pre>
+
+</div>
+
+<div class="slide">
+  <h1>Read-only attributes</h1>
+
+  <pre><code>package Person;
+use Moose;
+
+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>
+
+</div>
+
+<div class="slide">
+  <h1>There is More to Come</h1>
+
+  <ul>
+    <li>Attributes have a <em>lot</em> of features</li>
+  </ul>
+</div>
+
+<div class="slide">
   <h1>Cleaning Up Moose Droppings</h1>
 
   <pre><code>package Person;
@@ -953,5 +1038,26 @@ use Moose;
 <span class="highlight">__PACKAGE__->meta->make_immutable;</span></code></pre>
 </div>
 
+<div class="slide">
+  <h1>What <code>make_immutable</code> does</h1>
+
+  <ul>
+    <li>Magic</li>
+    <li>Uses <code>eval</code> to "inline" a constructor</li>
+    <li>Memoizes a lot of meta-information</li>
+    <li>Makes loading your class slower</li>
+    <li>Makes object creation <em>much</em> faster</li>
+  </ul>
+</div>
+
+<div class="slide">
+  <h1>When to Immutabilize?</h1>
+
+  <ul>
+    <li><em>Almost</em> always</li>
+    <li>Startup time vs execution time</li>
+  </ul>
+</div>
+
 </body>
 </html>
similarity index 95%
rename from moose-class/ui/custom.css
rename to moose-class/slides/ui/custom.css
index 2840f55..fc54819 100644 (file)
@@ -17,6 +17,10 @@ div#header, div#footer {
     color: black;
 }
 
+.slide h1 {
+    text-transform: none;
+}
+
 span.date, span.uri {
     font-size: 80%;
 }
@@ -44,7 +48,7 @@ img.for-slide {
 
 .slide pre {
     font-size: 100%;
-    line-height: 130%;
+    line-height: 110%;
 }
 
 .highlight {
@@ -55,9 +59,6 @@ img.for-slide {
     font-size: 33%;
 }
 
-.slide pre code {
-}
-
 .slide table.side-by-side tr {
     vertical-align: top;
 }