-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·800 lines (680 loc) · 20.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Programming for People</title>
<meta name="description" content="Writting programs for people.">
<meta name="author" content="Samson Ootoovak">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/night.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/tomorrow-night-bright.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>Programming for People</h1>
<p>
<small>Created by
<a href="https://github.com/ootoovak">Samson Ootoovak</a> /
<a href="http://twitter.com/ootoovak">@ootoovak</a>
</small>
</p>
</section>
<section>
<h2>Today I am going to talk about programming</h2>
</section>
<section>
<p>
You have spent your time here so far learning how to comunicate
with computers.
</p>
<img src="images/responsibility5.png" alt="http://hyperboleandahalf.blogspot.co.nz/2010/06/this-is-why-ill-never-be-adult.html">
</section>
<section>
<h2>
But as you learn more about programming, it is good to
remember that programming is not just for computers.
</h2>
</section>
<section>
<h2>
When you are programming you are also communicating with people.
</h2>
</section>
<section>
<h2>Brief History</h2>
<aside class="notes">
So I am just going to take a moment to give a breif history
of programming.
</aside>
</section>
<section>
<p>
It used to be very important to comunicate as efficiently
as possible with a computer.
</p>
<img src="images/eniac_with_programmers.gif" alt="http://plyojump.com/classes/mainframe_era.php">
<aside class="notes">
1944 ENIAC, short for Electronic Numerical Integrator And
Computer, was the first large-scale, electronic, digital
computer capable of being reprogrammed to solve a full range
of computing problems.
</aside>
</section>
<section>
<h2>
But as computers got faster and there was more code to
maintain the focus shifted.
</h2>
</section>
<section>
<h2>Computers are simple, they're just 1's and 0's!</h2>
<aside class="notes">
I'm sure we have all heard this on a bad movie or TV show
about hacks as an explanation of how easy computers are if
you know they comunicate in 1's and 0's.
</aside>
</section>
<section>
<p>
See simple...
</p>
<img src="images/FVFO1F6GLPH1FR4.LARGE.jpg" alt="http://www.instructables.com/id/Learn-Binary-The-easy-way-01000001-00000001/">
</section>
<section>
<h2>
So back to the real world.
</h2>
</section>
<section>
<p>
In 1952 woman named Grace Hopper wrote the first compiler.
<img src="images/Grace_Hopper_and_UNIVAC.jpg" alt="http://en.wikipedia.org/wiki/File:Grace_Hopper_and_UNIVAC.jpg">
</p>
<p class="fragment">
The was the first step in abstraction away from the 1's and
0's and towards code that was easier for people to read.
</p>
<p class="fragment">
(Side note: Grace Hopper was also the person the coined the
term <strong>debugging</strong> after finding and removing
an actual moth from a computer.)
</p>
</section>
<section>
<p>
Fast forward a few years... and now we have programming
languages like Ruby.
</p>
<blockquote class="fragment" cite="http://learnruby.com/about-ruby.html">
“For me, the purpose of life is, at least partly, to
have joy. Programmers often feel joy when they can
concentrate on the creative side of programming, so Ruby is
designed to make programmers happy.”
-- Yukihiro Matsumoto (a.k.a. “Matz”), 2000
</blockquote>
</section>
<section>
<p>
But even Ruby code can get scary.
</p>
<pre><code class='ruby' data-trim>
class RobotSearch
def find_cupcake(cupcake_x, cupcake_y)
@robot_x = 0
@robot_y = 0
@robot_direction = 0
@found_cupcake = false
6.times do
@robot_x += 1
@robot_y += 1
end
if(@robot_x == cupcake_x && @robot_y == cupcake_y)
puts 'You found the cupcake!'
@found_cupcake = true
end
unless(@found_cupcake)
@robot_direction = 90
end
6.times do
@robot_x += 1
@robot_y += 1
end
if(@robot_x == cupcake_x && @robot_y == cupcake_y)
puts 'You found the cupcake!'
@found_cupcake = true
end
unless(@found_cupcake)
@robot_direction = 90
end
if(found_cupcake)
puts "Found cupcate at position #{@robot_x}, #{@robot_y}!"
else
puts 'I give up.'
end
end
end
</code></pre>
</section>
<section>
<h2>But a computer understands this code fine, so why does it matter?</h2>
</section>
<section>
<h2>Well</h2>
<ul>
<li>We write programs so we can communicate with computers.</li>
<li class="fragment">
Also, there are programs everywhere and they all need to
be kept up to date.
</li>
<li class="fragment">
But we write these programs for people to use.
</li>
</ul>
</section>
<section>
<h2>Programming has also become social</h2>
</section>
<section>
<p>Github</p>
<img src="images/sam_github.png" alt="my github">
</section>
<section>
<p>Twitter</p>
<img src="images/sam_twitter.png" alt="my twitter">
</section>
<section>
<p>
And when it comes to code we are all standing on the
shoulders of others.
</p>
<img src="images/rubygems.png" alt="http://rubygems.org/">
</section>
<section>
<h2>
So even if you are writing code by yourself you are still going to
have to read other peoples' code
</h2>
<p class="fragment">
And more than likely other people will also be reading your code
</p>
<p class="fragment">
So now more than ever you are writing code for
<strong>people</strong>.
</p>
</section>
<section>
<h2>So how do we code for people?</h2>
</section>
<section>
<h2>Object Oriented Programming</h2>
<p>You have been using this already in Rails, yay!</p>
<p class="fragment">
When we write objects the goal is to make
sure they only do 1 thing
</p>
<p class="fragment">When they try to do more than one thing</p>
</section>
<section>
<p>
Then this happens.
</p>
<pre><code class='ruby' data-trim>
class RobotSearch
def find_cupcake(cupcake_x, cupcake_y)
@robot_x = 0
@robot_y = 0
@robot_direction = 0
@found_cupcake = false
6.times do
@robot_x += 1
@robot_y += 1
end
if(@robot_x == cupcake_x && @robot_y == cupcake_y)
puts 'You found the cupcake!'
@found_cupcake = true
end
unless(@found_cupcake)
@robot_direction = 90
end
6.times do
@robot_x += 1
@robot_y += 1
end
if(@robot_x == cupcake_x && @robot_y == cupcake_y)
puts 'You found the cupcake!'
@found_cupcake = true
end
unless(@found_cupcake)
@robot_direction = 90
end
if(found_cupcake)
puts "Found cupcate at position #{@robot_x}, #{@robot_y}!"
else
puts 'I give up.'
end
end
end
</code></pre>
</section>
<section>
<h2>A programmer named Sandi Metz proposed 4 rules to help with this</h2>
<ol>
<li class="fragment">Your class can be no longer than 100 lines of code.</li>
<li class="fragment">Your methods can be no longer than 5 lines of code.</li>
<li class="fragment">You can pass no more than 4 parameters and you can’t just make it one big hash.</li>
<li class="fragment">
When a call comes into your Rails controller, you can
only instantiate 1 object to do whatever it is that needs to be done.
</li>
</ol>
</section>
<section>
<h2>
But don't worry if you didn't get all of that.
</h2>
</section>
<section>
<h2>
We are just going to use rule #2 to help fix the large
messy code I showed you earlier.
</h2>
<p class="fragment">
Your methods can be no longer than 5 lines of code.
</p>
</section>
<section>
<pre><code class='ruby' data-trim>
class RobotSearch
def find_cupcake(cupcake_x, cupcake_y)
@robot_x = 0
@robot_y = 0
@robot_direction = 0
@found_cupcake = false
6.times do
@robot_x += 1
@robot_y += 1
end
if(@robot_x == cupcake_x && @robot_y == cupcake_y)
puts 'You found the cupcake!'
@found_cupcake = true
end
unless(@found_cupcake)
@robot_direction = 90
end
6.times do
@robot_x += 1
@robot_y += 1
end
if(@robot_x == cupcake_x && @robot_y == cupcake_y)
puts 'You found the cupcake!'
@found_cupcake = true
end
unless(@found_cupcake)
@robot_direction = 90
end
if(found_cupcake)
puts "Found cupcate at position #{@robot_x}, #{@robot_y}!"
else
puts 'I give up.'
end
end
end
</code></pre>
<aside class="notes">
Just a warning the code might look a little scarrier before
it looks better. :)
</aside>
</section>
<section>
<pre><code class='ruby' data-trim>
class RobotSearch
def find_cupcake(cupcake_x, cupcake_y)
put_robot_at_starting_point
6.times do
@robot_x += i
@robot_y += i
end
if(@robot_x == cupcake_x && @robot_y == cupcake_y)
puts 'You found the cupcake!'
@found_cupcake = true
end
unless(@found_cupcake)
@robot_direction = 90
end
6.times do
@robot_x += 1
@robot_y += 1
end
if(@robot_x == cupcake_x && @robot_y == cupcake_y)
puts 'You found the cupcake!'
@found_cupcake = true
end
unless(@found_cupcake)
@robot_direction = 90
end
if(found_cupcake)
puts "Found cupcate at position #{@robot_x}, #{@robot_y}!"
else
puts 'I give up.'
end
end
def put_robot_at_starting_point
@robot_x = 0
@robot_y = 0
@robot_direction = 0
@found_cupcake = false
end
end
</code></pre>
</section>
<section>
<pre><code class='ruby' data-trim>
class RobotSearch
def find_cupcake(cupcake_x, cupcake_y)
put_robot_at_starting_point
walk_forward_steps(6)
if(@robot_x == cupcake_x && @robot_y == cupcake_y)
puts 'You found the cupcake!'
@found_cupcake = true
end
unless(@found_cupcake)
@robot_direction = 90
end
walk_forward_steps(6)
if(@robot_x == cupcake_x && @robot_y == cupcake_y)
puts 'You found the cupcake!'
@found_cupcake = true
end
unless(@found_cupcake)
@robot_direction = 90
end
if(found_cupcake)
puts "Found cupcate at position #{@robot_x}, #{@robot_y}!"
else
puts 'I give up.'
end
end
def walk_forward_steps(number_of_steps)
number_of_steps.times do
@robot_x += 1
@robot_y += 1
end
end
def put_robot_at_starting_point
@robot_x = 0
@robot_y = 0
@robot_direction = 0
@found_cupcake = false
end
end
</code></pre>
</section>
<section>
<pre><code class='ruby' data-trim>
class RobotSearch
def find_cupcake(cupcake_x, cupcake_y)
put_robot_at_starting_point
walk_forward_steps(6)
check_if_found_cupcake?(cupcake_x, cupcake_y)
unless(@found_cupcake)
@robot_direction = 90
end
walk_forward_steps(6)
check_if_found_cupcake?(cupcake_x, cupcake_y)
unless(@found_cupcake)
@robot_direction = 90
end
if(found_cupcake)
puts "Found cupcate at position #{@robot_x}, #{@robot_y}!"
else
puts 'I give up.'
end
end
def check_if_found_cupcake?(cupcake_x, cupcake_y)
if(@robot_x == cupcake_x && @robot_y == cupcake_y)
puts 'You found the cupcake!'
@found_cupcake = true
end
end
def walk_forward_steps(number_of_steps)
number_of_steps.times do
@robot_x += 1
@robot_y += 1
end
end
def put_robot_at_starting_point
@robot_x = 0
@robot_y = 0
@robot_direction = 0
@found_cupcake = false
end
end
</code></pre>
</section>
<section>
<pre><code class='ruby' data-trim>
class RobotSearch
def find_cupcake(cupcake_x, cupcake_y)
put_robot_at_starting_point
walk_forward_steps(6)
check_if_found_cupcake?(cupcake_x, cupcake_y)
turn_right
walk_forward_steps(6)
check_if_found_cupcake?(cupcake_x, cupcake_y)
turn_right
if(found_cupcake)
puts "Found cupcate at position #{@robot_x}, #{@robot_y}!"
else
puts 'I give up.'
end
end
def turn_right
unless(@found_cupcake)
@robot_direction = 90
end
end
def check_if_found_cupcake?(cupcake_x, cupcake_y)
if(@robot_x == cupcake_x && @robot_y == cupcake_y)
puts 'You found the cupcake!'
@found_cupcake = true
end
end
def walk_forward_steps(number_of_steps)
number_of_steps.times do
@robot_x += 1
@robot_y += 1
end
end
def put_robot_at_starting_point
@robot_x = 0
@robot_y = 0
@robot_direction = 0
@found_cupcake = false
end
end
</code></pre>
</section>
<section>
<pre><code class='ruby' data-trim>
class RobotSearch
def find_cupcake(cupcake_x, cupcake_y)
put_robot_at_starting_point
walk_forward_steps(6)
check_if_found_cupcake?(cupcake_x, cupcake_y)
turn_right
walk_forward_steps(6)
check_if_found_cupcake?(cupcake_x, cupcake_y)
turn_right
yay_found?(found)
end
def yay_found?(found)
if(found_cupcake)
puts "Found cupcate at position #{@robot_x}, #{@robot_y}!"
else
puts 'I give up.'
end
end
def turn_right
unless(@found_cupcake)
@robot_direction = 90
end
end
def check_if_found_cupcake?(cupcake_x, cupcake_y)
if(@robot_x == cupcake_x && @robot_y == cupcake_y)
puts 'You found the cupcake!'
@found_cupcake = true
end
end
def walk_forward_steps(number_of_steps)
number_of_steps.times do
@robot_x += 1
@robot_y += 1
end
end
def put_robot_at_starting_point
@robot_x = 0
@robot_y = 0
@robot_direction = 0
@found_cupcake = false
end
end
</code></pre>
</section>
<section>
<pre><code class='ruby' data-trim>
class RobotSearch
def find_cupcake(cupcake_x, cupcake_y)
put_robot_at_starting_point
search(cupcake_x, cupcake_y)
search(cupcake_x, cupcake_y)
yay_found?(found)
end
def search(cupcake_x, cupcake_y)
walk_forward_steps(6)
check_if_found_cupcake?(cupcake_x, cupcake_y)
turn_right
end
def yay_found?(found)
if(found_cupcake)
puts "Found cupcate at position #{@robot_x}, #{@robot_y}!"
else
puts 'I give up.'
end
end
def turn_right
unless(@found_cupcake)
@robot_direction = 90
end
end
def check_if_found_cupcake?(cupcake_x, cupcake_y)
if(@robot_x == cupcake_x && @robot_y == cupcake_y)
puts 'You found the cupcake!'
@found_cupcake = true
end
end
def walk_forward_steps(number_of_steps)
number_of_steps.times do
@robot_x += 1
@robot_y += 1
end
end
def put_robot_at_starting_point
@robot_x = 0
@robot_y = 0
@robot_direction = 0
@found_cupcake = false
end
end
</code></pre>
</section>
<section>
<pre><code class='ruby' data-trim>
class RobotSearch
def find_cupcake(cupcake_x, cupcake_y)
put_robot_at_starting_point
search(cupcake_x, cupcake_y)
search(cupcake_x, cupcake_y)
yay_found?(found)
end
def search(cupcake_x, cupcake_y)
walk_forward_steps(6)
check_if_found_cupcake?(cupcake_x, cupcake_y)
turn_right
end
end
</code></pre>
<aside class="notes">
As you can see our code is not much easier to digest.
It almost has a naritive when you read it
The next programmer that reads your code will likely thank you for
your small methods. Maybe even give you a hug!
</aside>
</section>
<section>
<img src="images/fridayhug.png" alt="http://fridayhug.com/">
</section>
<section>
<h2>Thank you for your time</h2>
</section>
<section>
<p>
Talk inspired by Sandi Metz (<a href="https://twitter.com/sandimetz">@sandimetz</a>),
Katrina Owen (<a href="https://twitter.com/kytrinyx">@kytrinyx</a>),
and Avdi Grimm (<a href="https://twitter.com/avdi">@avdi</a>)
</p>
<p>
You can find me on Twitter <a href="https://twitter.com/ootoovak">@ootoovak</a>,
on Github at <a href="https://github.com/ootoovak">https://github.com/ootoovak</a> and
these slides on Speaker Deck here <a href="https://speakerdeck.com/ootoovak">https://speakerdeck.com/ootoovak</a>
</p>
<img class="fragment" src="http://placekitten.com/800/600" alt="PlaceKitten">
<aside class="notes">
When I did a trial run of the talk I used this picture from
placekitten.com as a place holder. It was requested I keep
in in somewhere.
</aside>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: false,
rollingLinks: false,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'page', // default/cube/page/concave/zoom/linear/fade/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
// { src: 'plugin/search/search.js', async: true, condition: function() { return !!document.body.classList; } }
// { src: 'plugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>