Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
581 lines (496 sloc) 10.9 KB
\documentclass[20pt]{beamer}
\usetheme{sugarfree}
\usepackage{graphicx}
\author{Steven! Ragnarök}
\title{Sugar-Free Ruby}
\subtitle{A Look at Object-First Teaching}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}[fragile]
\begin{center}
{\usebeamercolor[fg]{subtitle}\usebeamerfont{subtitle}Who is this guy?}
\vspace{1cm}\par
\insertauthor
\end{center}
\begin{ruby10pt}
contact = {
"GitHub" => "nuclearsandwich",
"Freenode" => "nuclearsandwich",
"Email" => "steven@nuclearsandwich.com",
"WWW" => "www.nuclearsandwich.com",
"Twitter" => "@nuclearsandwich"
}
\end{ruby10pt}
\par\begin{center}
''That guy with all the opinions''
\end{center}
\end{frame}
{\setbeamercolor{background canvas}{bg=basicallyblack}
\usebeamercolor[fg]{inverted text}
\begin{frame}
\par {\usebeamerfont{title} Teaching\\*Programming}\par
\vspace{3cm}\hfill
% {\usebeamerfont{subtitle}The challenge \\*}
\end{frame}
}
\begin{frame}
\frametitle{Why is teaching so damn hard?}
\begin{itemize}
\pause\item It's hard to remember learning to program
\pause\item It's hard to share knowledge instead of guard it
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Why is teaching so damn hard?}
In short: it takes a lot of self reflection to teach well.
\end{frame}
{\setbeamercolor{background canvas}{bg=basicallyblack}
\usebeamercolor[fg]{inverted text}
\begin{frame}
\par {\usebeamerfont{title} Teaching\\*Programming}\par
\vspace{3cm}\hfill
{\usebeamerfont{subtitle}It's getting better}
\end{frame}
}
\begin{frame}
\begin{beamercolorbox}{imagebox}
\vspace{5mm}\par
\centering\includegraphics[height=2cm]{coderdojo_logo}\par
\vspace{5mm}\par
\end{beamercolorbox}
Kids learn:
\begin{itemize}
\item Game Builder
\item Scratch
\item Python
\item Hackety-Hack / Shoes
\end{itemize}
\end{frame}
\begin{frame}
\par\usebeamerfont{title}Programming is fun
\end{frame}
\begin{frame}
\begin{beamercolorbox}{imagebox}
\vspace{2mm}\par
\centering\includegraphics[height=4cm]{railsbridge_logo}\par
\vspace{2mm}\par
\end{beamercolorbox}
\begin{itemize}
\item Workshops for Women
\item Kids Ruby
\item Workshops / Curriculum in other languages
\end{itemize}
\end{frame}
\begin{frame}
\par\usebeamerfont{title}Programming is hard\ldots\\*
\vspace{2cm}
But only this hard
\end{frame}
\begin{frame}
\frametitle{RailsBridge: Workshops for Women}
\begin{itemize}
\item Install all the things the night before
\item One full day
\item Focus on Ruby, Rails, or split based on experience
\end{itemize}
\end{frame}
{\setbeamercolor{background canvas}{bg=basicallyblack}
\usebeamercolor[fg]{inverted text}
\begin{frame}
\par {\usebeamerfont{title} Teaching Ruby}\par
\vspace{3cm}\hfill
{\usebeamerfont{subtitle}The challenge \\*}
\end{frame}
}
\begin{frame}
\frametitle{Why do you want to learn Ruby?}
\begin{itemize}
\pause{\item I hate my job and hear programmers make bank}
\pause{\item I know how to program but not Ruby}
\pause{\item I'm curious about programming}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Disclaimer}
\centering \includegraphics[width=4cm]{gorilla}\par
{\usebeamerfont{subtitle}
\only<1>{\hfill This point onward:\\*\hfill Open minds only}
\only<2>{\hfill Haters, the doors\\*\hfill are stage left}
}
\end{frame}
\section{The (Good?) Old Fashioned Way}
{\setbeamercolor{background canvas}{bg=basicallyblack}
\usebeamercolor[fg]{inverted text}
\begin{frame}
\par {\usebeamerfont{title} Teaching Ruby}\par
\vspace{3cm}\hfill
{\usebeamerfont{subtitle}The (Good?) Old\\* \hfill Fashioned Way}
\end{frame}
}
\begin{frame}[fragile]
\frametitle{Numbers}
\begin{rubycode}
5 + 5 #=> 10
9 / 2 #=> 4
9.0 / 2 #=> 4.5
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Strings and Symbols}
\begin{rubycode}
'Hello' #=> "Hello"
:what? #=> :what?
"Hello, " + "World!"
#=> "Hello, World!"
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Boolean Values}
\begin{rubycode}
true #=> true
false #=> false
20 < 100 #=> true
true and false #=> false
true or false #=> true
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Arrays and Hashes}
\begin{rubycode}
[ 1, 2, 3.0, "four" ]
{ :name => "Steven!",
:age => 24,
:species => "human" }
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Variable Assignment}
\begin{rubycode}
my_name = "Steven!"
my_age = 24
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Variable Access}
\begin{rubycode}
# ten years from now
my_age + 10 #=> 34
# I hashify myself
{ :name => my_name,
:age => my_age }
#=> {:name => "Steven!",
# :age => 24}
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Console Output}
\begin{rubycode}
puts my_name
Steven!
#=> nil
puts my_age + 10
34
#=> nil
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Conditionals}
\begin{rubycode}
if my_name == "Steven!"
puts "Hello!"
else
puts "Who are you?"
end
Hello!
#=> nil
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Loops}
\begin{rubycode}
while my_age < 30 do
puts "Enjoying my twenties"
my_age = my_age + 1
end
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Methods}
\begin{rubycode}
"foo".upcase #=> "FOO"
\end{rubycode}
\end{frame}
{\setbeamercolor{background canvas}{bg=basicallyblack}
\usebeamercolor[fg]{inverted text}
\begin{frame}
\par {\usebeamerfont{title} Teaching Ruby}\par
\vspace{3cm}\hfill
{\usebeamerfont{subtitle}What's wrong with\\* \hfill this picture?}
\end{frame}
}
\begin{frame}
\frametitle{What's wrong with this picture?}
{\usebeamerfont{subtitle}
\only<1>{Six whole concepts come before methods.}
\only<2>{No mention whatsoever of classes.}
\only<3>{Why do we cling to this?}
}
\end{frame}
\begin{frame}
\par {\usebeamerfont{subtitle}Ruby is not a computer language.}
\vspace{4cm}\pause
\par {\usebeamerfont{subtitle}So why are we teaching it like one?}
\end{frame}
{\setbeamercolor{background canvas}{bg=basicallyblack}
\usebeamercolor[fg]{inverted text}
\begin{frame}
\par{\usebeamerfont{title} Teaching Objects}
\par\vspace{3cm}
\hfill{\usebeamerfont{subtitle}Ruby is the computer}
\end{frame}
}
\begin{frame}
\frametitle{But Steven!,}
If we try to teach all of that\\* \emph{and} Objects,\\*
their heads will explode!
\end{frame}
\begin{frame}[fragile]
\frametitle{Everything is an Object}
\begin{rubycode}
5 #=> 5
42.0 #=> 42.0
"Hello!" #=> "Hello!"
[1, 2, 3] #=> [1, 2, 3]
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{They Receive Messages}
\begin{rubycode}
"six".send :upcase
#=> "SIX"
5.send :+, 9
#=> 14
17.send :nil?
#=> false
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Objects Have (a) Class}
\begin{rubycode}
5.send :class
#=> Fixnum
4.0.send :class
#=> Float
["he's", "crazy?"].send :class
#=> Array
\end{rubycode}
\end{frame}
{\setbeamercolor{background canvas}{bg=basicallyblack}
\usebeamercolor[fg]{inverted text}
\begin{frame}
\par{\usebeamerfont{title} Teaching Objects}
\par\vspace{3cm}
\hfill{\usebeamerfont{subtitle}The pen and the scribe}
\end{frame}
}
\begin{frame}[fragile]
\frametitle{Instantiation}
\begin{rubycode}
pen = Object.new
#=> #<Object:0x007ff1c491de90>
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Method Definition}
\begin{rubycode}
def pen.to_s
"A trusty pen"
end
#=> nil
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Message Sending}
\begin{rubycode}
pen.send :to_s
#=> A trusty pen
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{A Pinch of Sugar}
\begin{rubycode}
def pen.to_s
"A trusty pen"
end
pen.to_s
#=> A trusty pen
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Errors Are Your Friends}
\begin{rubycode}
pen.write "Hi there"
#=> NoMethodError: undefined
# method `write' for
# A trusty pen:Object
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Use the Kernel, Luke}
\begin{rubycode}
def pen.write thing
Kernel.puts thing
end
#=> nil
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Write Anything!}
\begin{rubycode}
pen.write "Hi"
Hi
#=> nil
pen.write pen
A trusty pen
#=> nil
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Feature Request: Color}
\begin{rubycode}
pen.ink_color = "Blue"
#=> NoMethodError: undefined
# method `ink_color=' for
# A trusty pen:Object
def pen.ink_color= color
@ink_color = color
end
#=> nil
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Showing Our Colors}
\begin{rubycode}
def pen.to_s
"A trusty #{@ink_color} pen"
end
pen.ink_color = "purple"
#=> "purple"
pen
#=> "A trusty purple pen"
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Implicit Receivers}
\begin{rubycode}
def pen.sparkly_write thing
write "*;. #{thing} *;.*"
end
pen.sparkly_write pen
*;. A trusty purple pen *;.*
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Conditionals Revisited}
\begin{rubycode}
def pen.html_write thing
write if @ink_color
"<p style=\"color: \
#{@ink_color};\">
#{thing}
</p>"
else
"<p>#{thing}</p>"
end
end
\end{rubycode}
\end{frame}
{\setbeamercolor{background canvas}{bg=basicallyblack}
\usebeamercolor[fg]{inverted text}
\begin{frame}
\par {\usebeamerfont{title} Teaching Ruby}\par
\vspace{3cm}\hfill
{\usebeamerfont{subtitle}What have we\\* \hfill introduced?}
\end{frame}
}
\begin{frame}[fragile]
\frametitle{Time to get classy\ldots}
\begin{rubycode}
Scribe = Class.new do
def initialize pen
@pen = pen
@items = Array.new
end
def note item
@items.<< item
end
# to be continued
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{\ldots{}you blockhead}
\begin{rubycode}
# in the Scribe class body
def write_everything
@items.each do |item|
@pen.write item
end
end
end
#=> Scribe
\end{rubycode}
\end{frame}
\begin{frame}[fragile]
\frametitle{Hiring a new scribe}
\begin{rubycode}
mielot = Scribe.new pen
#=> #<Scribe:0x007fe57b086228
# @pen=A trusty purple pen>
mielot.note "Time: #{Time.now}"
mielot.note "This demo is over"
mielot.write_everything
Time: 2012-09-14 11:43:05 -0700
This demo is over
\end{rubycode}
\end{frame}
{\setbeamercolor{background canvas}{bg=basicallyblack}
\usebeamercolor[fg]{inverted text}
\begin{frame}
\par {\usebeamerfont{title} Teaching Ruby}\par
\vspace{3cm}\hfill
{\usebeamerfont{title}with Objects}
\end{frame}
\begin{frame}
\par {\usebeamerfont{title} Teaching Objects}\par
\vspace{3cm}\hfill
{\usebeamerfont{title}with Ruby}
\end{frame}
}
\begin{frame}
\frametitle{Why is this better?}
The object metaphor provides a context for everything else we learn
about Ruby
\end{frame}
\begin{frame}
\frametitle{Why is this better?}
We don't bombard them with new concepts until just before their use
\end{frame}
\begin{frame}
\frametitle{Why is this better?}
With a thorough understanding of semantics, new things (like syntactic sugar)
are more readily digestible
\end{frame}
\begin{frame}
\begin{center}
\vspace{2.5cm}
{\usebeamercolor[fg]{title}\usebeamerfont{title}Thanks!}
\vspace{1.5cm}
Behind the Scenes
\par\rule[3mm]{3cm}{0.1mm}
\XeLaTeX / Beamer
Pygments / Minted
\end{center}
\end{frame}
\end{document}