6. What is SAPO?
• Older than Google,
kind of like Yahoo!
• 100+ techs
7. What is SAPO?
• Older than Google,
kind of like Yahoo!
• 100+ techs
• 100+ non-techs
8. What is SAPO?
• Older than Google,
kind of like Yahoo!
• 100+ techs
• 100+ non-techs
• Mail, Blogs, Photos,Videos, Links, Cars, Real
Estate, Jobs, Maps, Encyclopedia online,
Search, Messaging, Social Network, etc., etc.,
etc.
10. What do I do at SAPO?
• Evangelism (motivation, productivity, quality)
11. What do I do at SAPO?
• Evangelism (motivation, productivity, quality)
• Organize the training program
12. What do I do at SAPO?
• Evangelism (motivation, productivity, quality)
• Organize the training program
• Recruitment (lots of interviews every week)
13. What do I do at SAPO?
• Evangelism (motivation, productivity, quality)
• Organize the training program
• Recruitment (lots of interviews every week)
• Organize events
14. What do I do at SAPO?
• Evangelism (motivation, productivity, quality)
• Organize the training program
• Recruitment (lots of interviews every week)
• Organize events
• Etc.
18. “Why?”
• tomorrow, you may need to fix a glitch in
your code
• next week, you may need to confirm
something
• 6 months from now, you may need to
develop a new feature
21. use strict;
my @list=('Emacs', 'Vi '); my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
22. use strict;
my @list=('Emacs', 'Vi '); my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
23. use strict;
my @list=('Emacs', 'Vi '); my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
24. use strict;
my @list=('Emacs', 'Vi '); my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
25. use strict;
my @list=('Emacs', 'Vi '); my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
26. use strict;
my @list=('Emacs', 'Vi '); my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
27. use strict;
my @list=('Emacs', 'Vi '); my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
28. use strict;
my @list=('Emacs', 'Vi '); my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
29. Block separation
• A program is a list of instructions
• You’re writing it as a letter
• Separate your paragraphs, for clarity
30. use strict;
my @list=('Emacs', 'Vi '); my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
31. use strict;
my @list=('Emacs', 'Vi '); my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
33. use strict;
my @list=('Emacs', 'Vi '); my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
34. use strict;
my @list=('Emacs', 'Vi ');
my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
36. use strict;
my @list=('Emacs', 'Vi ');
my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
37. use strict;
my @list=('Emacs', 'Vi ');
my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
38. Spaces around
operators
• Don’t clutter things up
• Spaces around operators help you find
them more easily
39. use strict;
my @list=('Emacs', 'Vi ');
my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
40. use strict;
my @list=('Emacs', 'Vi ');
my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
41. use strict;
my @list = ('Emacs', 'Vi ');
my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i = int ($rand + rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
42. Naming variables
• Don’t name them “var”, “list”, “hash” or
anything else that does not have a meaning
• Make sure the name helps you identify
what it is
43. use strict;
my @list = ('Emacs', 'Vi ');
my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i = int ($rand + rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
44. use strict;
my @editors = ('Emacs', 'Vi ');
my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i = int ($rand + rand());
print " $editors[$i] users are from Venus" . ",
"$editors[1-$i] users are from Mars" .
"n";
}
46. use strict;
my @editors = ('Emacs', 'Vi ');
my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i = int ($rand + rand());
print " $editors[$i] users are from Venus" . ",
"$editors[1-$i] users are from Mars" .
"n";
}
47. use strict;
my @editors = ('Emacs', 'Vi ');
my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i = int ($rand + rand());
print " $editors[$i] users are from Venus" . ",
"$editors[1-$i] users are from Mars" .
"n";
}
49. my @list = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47
my @list2 = (1,1,2,3,5,8,13,21,34,55,89,144,233,377,
for my $number (@list) {
if (grep{$number==$_}@list2) {print "$number is
}
50. my @list = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47
my @list2 = (1,1,2,3,5,8,13,21,34,55,89,144,233,377,
for my $number (@list) {
if (grep{$number==$_}@list2) {print "$number is
}
51. my @list = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47
my @list2 = (1,1,2,3,5,8,13,21,34,55,89,144,233,377,
for my $number (@list) {
if (grep{$number==$_}@list2) {print "$number is
}
52. my @list = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47
my @list2 = (1,1,2,3,5,8,13,21,34,55,89,144,233,377,
for my $number (@list) {
if (grep{$number==$_}@list2) {print "$number is
}
53. my @list = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47
my @list2 = (1,1,2,3,5,8,13,21,34,55,89,144,233,377,
for my $number (@list) {
if (grep{$number==$_}@list2) {print "$number is
}
54. 2 is both a prime number and a fibonacci number
3 is both a prime number and a fibonacci number
5 is both a prime number and a fibonacci number
13 is both a prime number and a fibonacci number
89 is both a prime number and a fibonacci number
55. Strict and warnings
• both strict and warnings will help you avoid
lots of pesky mistakes
56. my @list = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47
my @list2 = (1,1,2,3,5,8,13,21,34,55,89,144,233,377,
for my $number (@list) {
if (grep{$number==$_}@list2) {print "$number is
}
57. use strict;
use warnings;
my @list = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47
my @list2 = (1,1,2,3,5,8,13,21,34,55,89,144,233,377,
for my $number (@list) {
if (grep{$number==$_}@list2) {print "$number is
}
58. Avoid lines over 80 charac
• code is easier to read if it fits on the screen
• even if using line wrapping, having to figure
out if two lines are different instructions or
the same one is harder than not having to
do it
59. use strict;
use warnings;
my @list = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47
my @list2 = (1,1,2,3,5,8,13,21,34,55,89,144,233,377,
for my $number (@list) {
if (grep{$number==$_}@list2) {print "$number is
}
60. use strict;
use warnings;
my @list = (2,3,5,7,11,13,17,19,23,29,31,
37,41,43,47,53,59,61,67,71,73,79,83,89,97,101) ;
my @list2 = (1,1,2,3,5,8,13,21,34,55,89,
144,233,377,610,987,1597,2584,4181,6765) ;
for my $number (@list) {
if (grep{$number==$_}@list2) {
print "$number is both a prime number and a
}
61. use strict;
use warnings;
my @list = (2,3,5,7,11,13,17,19,23,29,31,
37,41,43,47,53,59,61,67,71,73,79,83,89,97,101) ;
my @list2 = (1,1,2,3,5,8,13,21,34,55,89,
144,233,377,610,987,1597,2584,4181,6765) ;
for my $number (@list) {
if (grep{$number==$_}@list2) {
print "$number is both a prime number " . " a
}
62. use strict;
use warnings;
my @list = (2,3,5,7,11,13,17,19,23,29,31,
37,41,43,47,53,59,61,67,71,73,79,83,89,97,101) ;
my @list2 = (1,1,2,3,5,8,13,21,34,55,89,
144,233,377,610,987,1597,2584,4181,6765) ;
for my $number (@list) {
if (grep{$number==$_}@list2) {
print "$number is both a prime number " .
" and a fibonacci numbern"}
}
63. When breaking lines,
align vertically
• a broken line is a visual accident waiting to
happen
64. use strict;
use warnings;
my @list = (2,3,5,7,11,13,17,19,23,29,31,
37,41,43,47,53,59,61,67,71,73,79,83,89,97,101) ;
my @list2 = (1,1,2,3,5,8,13,21,34,55,89,
144,233,377,610,987,1597,2584,4181,6765) ;
for my $number (@list) {
if (grep{$number==$_}@list2) {
print "$number is both a prime number " .
" and a fibonacci numbern"}
}
65. use strict;
use warnings;
my @list = (2,3,5,7,11,13,17,19,23,29,31,
37,41,43,47,53,59,61,67,71,73,79,83,89,9
my @list2 = (1,1,2,3,5,8,13,21,34,55,89,
144,233,377,610,987,1597,2584,4181,6765
for my $number (@list) {
if (grep{$number==$_}@list2) {
print "$number is both a prime number " .
" and a fibonacci numbern"}
}
66. Add spaces after a
comma
• spaces after a comma help you visually
separate items
67. use strict;
use warnings;
my @list = (2,3,5,7,11,13,17,19,23,29,31,
37,41,43,47,53,59,61,67,71,73,79,83,89,9
my @list2 = (1,1,2,3,5,8,13,21,34,55,89,
144,233,377,610,987,1597,2584,4181,6765
for my $number (@list) {
if (grep{$number==$_}@list2) {
print "$number is both a prime number " .
" and a fibonacci numbern"}
}
68. use strict;
use warnings;
my @list = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31,
37, 41, 43, 47, 53, 59, 61, 67, 71, 73,
my @list2 = (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,
144, 233, 377, 610, 987, 1597, 2584, 41
for my $number (@list) {
if (grep{$number==$_}@list2) {
print "$number is both a prime number " .
" and a fibonacci numbern"}
}
69. Organize long lists
as tables
• the brain identifies patterns such as tables
much more easily
70. use strict;
use warnings;
my @list = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31,
37, 41, 43, 47, 53, 59, 61, 67, 71, 73,
my @list2 = (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,
144, 233, 377, 610, 987, 1597, 2584, 41
for my $number (@list) {
if (grep{$number==$_}@list2) {
print "$number is both a prime number " .
" and a fibonacci numbern"}
}
71. use strict;
use warnings;
my @list = ( 2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
37, 41, 43, 47, 53, 59, 61, 67, 71, 73,
my @list2 = (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,
144, 233, 377, 610, 987, 1597, 2584, 41
for my $number (@list) {
if (grep{$number==$_}@list2) {
print "$number is both a prime number " .
" and a fibonacci numbern"}
}
72. use strict;
use warnings;
my @list = ( 2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
37, 41, 43, 47, 53, 59, 61, 67, 71, 73,
my @list2 = ( 1, 1, 2, 3, 5, 8, 13, 2
144, 233, 377, 610, 987, 1597, 2584, 41
for my $number (@list) {
if (grep{$number==$_}@list2) {
print "$number is both a prime number " .
" and a fibonacci numbern"}
}
73. Again, name variables
appropriately
• the brain identifies patterns such as tables
much more easily
74. use strict;
use warnings;
my @list = ( 2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
37, 41, 43, 47, 53, 59, 61, 67, 71, 73,
my @list2 = ( 1, 1, 2, 3, 5, 8, 13, 2
144, 233, 377, 610, 987, 1597, 2584, 41
for my $number (@list) {
if (grep{$number==$_}@list2) {
print "$number is both a prime number " .
" and a fibonacci numbern"}
}
75. use strict;
use warnings;
my @prime_numbers = ( 2, 3, 5, 7, 11, 13, 17, 19,
37, 41, 43, 47, 53, 59, 61, 67,
my @fibonnaci = ( 1, 1, 2, 3, 5, 8,
144, 233, 377, 610, 987, 1597,
for my $number (@prime_numbers) {
if (grep{$number==$_}@fibonnaci) {
print "$number is both a prime number " .
" and a fibonacci numbern"}
}
76. Spaces for clarity
• around operators
• around blocks
• around anything else that may cause
confusion
77. use strict;
use warnings;
my @prime_numbers = ( 2, 3, 5, 7, 11, 13, 17, 19,
37, 41, 43, 47, 53, 59, 61, 67,
my @fibonnaci = ( 1, 1, 2, 3, 5, 8,
144, 233, 377, 610, 987, 1597,
for my $number (@prime_numbers) {
if (grep{$number==$_}@fibonnaci) {
print "$number is both a prime number " .
" and a fibonacci numbern"}
}
78. use strict;
use warnings;
my @prime_numbers = ( 2, 3, 5, 7, 11, 13, 17, 19,
37, 41, 43, 47, 53, 59, 61, 67,
my @fibonnaci = ( 1, 1, 2, 3, 5, 8,
144, 233, 377, 610, 987, 1597,
for my $number (@prime_numbers) {
if ( grep { $number == $_ } @fibonnaci ) {
print "$number is both a prime number " .
" and a fibonacci numbern"}
}
79. Block closing
• the closing curly brace should be in a line
by itself
• this helps better identify where the block
ends
80. use strict;
use warnings;
my @prime_numbers = ( 2, 3, 5, 7, 11, 13, 17, 19,
37, 41, 43, 47, 53, 59, 61, 67,
my @fibonnaci = ( 1, 1, 2, 3, 5, 8,
144, 233, 377, 610, 987, 1597,
for my $number (@prime_numbers) {
if ( grep { $number == $_ } @fibonnaci ) {
print "$number is both a prime number " .
" and a fibonacci numbern"}
}
81. use strict;
use warnings;
my @prime_numbers = ( 2, 3, 5, 7, 11, 13, 17, 19,
37, 41, 43, 47, 53, 59, 61, 67,
my @fibonnaci = ( 1, 1, 2, 3, 5, 8,
144, 233, 377, 610, 987, 1597,
for my $number (@prime_numbers) {
if ( grep { $number == $_ } @fibonnaci ) {
print "$number is both a prime number " .
" and a fibonacci numbern"
}
}
82. Always end a statement
with a semicolon
• even if it’s the last statement in the block
• even if the closing curly brace is on the
same line
• this will allow you to add another
statement without having to check the line
above
83. use strict;
use warnings;
my @prime_numbers = ( 2, 3, 5, 7, 11, 13, 17, 19,
37, 41, 43, 47, 53, 59, 61, 67,
my @fibonnaci = ( 1, 1, 2, 3, 5, 8,
144, 233, 377, 610, 987, 1597,
for my $number (@prime_numbers) {
if ( grep { $number == $_ } @fibonnaci ) {
print "$number is both a prime number " .
" and a fibonacci numbern"
}
}
84. use strict;
use warnings;
my @prime_numbers = ( 2, 3, 5, 7, 11, 13, 17, 19,
37, 41, 43, 47, 53, 59, 61, 67,
my @fibonnaci = ( 1, 1, 2, 3, 5, 8,
144, 233, 377, 610, 987, 1597,
for my $number (@prime_numbers) {
if ( grep { $number == $_ } @fibonnaci ) {
print "$number is both a prime number " .
" and a fibonacci numbern";
}
}
85. Inside a loop, use empty
lines around the body
• this is also going to help you identify the
beginning and the end of the loop
86. use strict;
use warnings;
my @prime_numbers = ( 2, 3, 5, 7, 11, 13, 17, 19,
37, 41, 43, 47, 53, 59, 61, 67,
my @fibonnaci = ( 1, 1, 2, 3, 5, 8,
144, 233, 377, 610, 987, 1597,
for my $number (@prime_numbers) {
if ( grep { $number == $_ } @fibonnaci ) {
print "$number is both a prime number " .
" and a fibonacci numbern";
}
}
87. use strict;
use warnings;
my @prime_numbers = ( 2, 3, 5, 7, 11, 13, 17, 19,
37, 41, 43, 47, 53, 59, 61, 67,
my @fibonnaci = ( 1, 1, 2, 3, 5, 8,
144, 233, 377, 610, 987, 1597,
for my $number (@prime_numbers) {
if ( grep { $number == $_ } @fibonnaci ) {
print "$number is both a prime number " .
" and a fibonacci numbern";
}
}
89. for my $number (@prime_numbers) {
if ( grep { $number == $_ } @fibonnaci ) {
print "$number is both a prime number " .
" and a fibonacci numbern";
}
}
104. use List::MoreUtils qw(any);
if ( is_fibonnaci($number) ) {
sub is_fibonnaci {
my $number = shift;
return any { $number == $_ } @fibonnaci
}
105. for my $number (@prime_numbers) {
if ( grep { $number == $_ } @fibonnaci ) {
print "$number is both a prime number " .
" and a fibonacci numbern";
}
}
106. for my $number (@prime_numbers) {
if ( is_fibonnaci($number) ) {
print "$number is both a prime number " .
" and a fibonacci numbern";
}
}
107. for my $number (@prime_numbers) {
if ( is_fibonnaci($number) ) {
print "$number is both a prime number " .
" and a fibonacci numbern";
}
}
sub is_fibonnaci {
my $number = shift;
return any { $number == $_ } @fibonnaci;
108. for my $number (@prime_numbers) {
if ( is_fibonnaci($number) ) {
print "$number is both a prime number " .
" and a fibonacci numbern";
}
}
109. for (@prime_numbers) {
if ( is_fibonnaci($_) ) {
print "$_ is both a prime number " .
" and a fibonacci numbern";
}
}
127. • Perl::Tidy - “Parses and beautifies perl
source”
• Perl::Critic - “Critique Perl source code for
best-practices”
128. Perl::Tidy
use strict;
my @list=('Emacs', 'Vi '); my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
129. Perl::Tidy
use strict;
my @list = ( 'Emacs', 'Vi ' );
my $rand = rand();
print "10 random users said:n";
foreach ( 0 .. 10 ) {
my $i = int( $rand + rand() );
print " $list[$i] users are from Venus" . ", "
. "$list[1-$i] users are from Mars" . "n";
}
131. Perl::Critic
use strict;
my @list=('Emacs', 'Vi '); my $rand = rand();
print "10 random users said:n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $list[$i] users are from Venus" . ", " .
"$list[1-$i] users are from Mars" .
"n";
}
133. Perl::Critic
• configurable (several severity levels,
extendable, .perlcriticrc)
• integrates with most text editors
• some people also use it as an svn hook
• if you don’t own PBP, there’s also user-
contributed documentation on each subject