software composition by @steveklabnik

51
by @steveklabnik Software Composition

Upload: svitla-systems-inc

Post on 09-May-2015

1.430 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Software composition by @steveklabnik

by @steveklabnik

Software Composition

Page 2: Software composition by @steveklabnik

Who?

Page 3: Software composition by @steveklabnik

Who?

Page 4: Software composition by @steveklabnik

Who?

Page 5: Software composition by @steveklabnik

Who?

Page 6: Software composition by @steveklabnik
Page 7: Software composition by @steveklabnik
Page 8: Software composition by @steveklabnik
Page 9: Software composition by @steveklabnik

“Best Practices”

•Use descriptive variable names

•Add whitespace for clarity

•Use object orientation properly

•Write comments

Page 10: Software composition by @steveklabnik
Page 11: Software composition by @steveklabnik
Page 12: Software composition by @steveklabnik

Alas, poor Yorick! I knew him, Horatio, a fellow of infinite jest, of most excellent fancy. He has bore me on his back a thousand times, and now how abhorr'd in my imagination it is!

Page 13: Software composition by @steveklabnik

Software Composition:

Page 14: Software composition by @steveklabnik

Software Composition:

The Multitude of Audiences

Page 15: Software composition by @steveklabnik

Software Composition:

The Multitude of Audiences

The Multiplicity of Forms

Page 16: Software composition by @steveklabnik

Software Composition:

The Multitude of Audiences

The Multiplicity of Forms

An Aside: Literacy Crisis

Page 17: Software composition by @steveklabnik

The Multitude of Audiences

Page 18: Software composition by @steveklabnik

The Default Audience:The Computer

Science is what we understand well enough to explain to a computer. Art is everything else we do.•Don Knuth

Page 19: Software composition by @steveklabnik

The Reflexive Audience:The programmer

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.•Brian Kernighan

Page 20: Software composition by @steveklabnik

The ‘Other’ Audience:Colleagues and Coworkers

Always code as if the guy who ends up maintaining your code is a violent psychopath who knows where you live.•Martin Golding

Page 21: Software composition by @steveklabnik

The forgotten audience:end-users

If I asked my customers what they wanted, they'd have told me, "A faster horse."•Henry Ford

Page 22: Software composition by @steveklabnik

The Multiplicity of Forms

Page 23: Software composition by @steveklabnik

Source`Twas brillig, and the slithy toves  Did gyre and gimble in the wabe:All mimsy were the borogoves,  And the mome raths outgrabe.- Jabberwocky

Page 24: Software composition by @steveklabnik

puts <<2*2,2puts <<2*2,22

Page 25: Software composition by @steveklabnik

v=0000;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP4ZojjV)O>qIH1/n[|2yE[>:ieC "%.#% :::##" 97N-A&Kj_K_><wS5rtWk@*a+Y5yH?b[F^e7C/56j|pmRe+:)B "##% ::##########" O98(Zh)'Iof*nm.,$C5Nyt=PPu01Avw^<IiQ=5$'D-y? "##: ###############" g6`YT+qLw9k^ch|K'),tc6ygIL8xI#LNz3v}T=4W "# #. .####:#######" lL27FZ0ij)7TQCI)P7u}RT5-iJbbG5P-DHB<. " ##### # :############" R,YvZ_rnv6ky-G+4U'$*are@b4U351Q-ug5 " #######################" 00x8RR%`Om7VDp4M5PFixrPvl&<p[]1IJ " ############:#### %#####" EGgDt8Lm#;bc4zS^y]0`_PstfUxOC(q " .#############:##% .## ." /,}.YOIFj(k&q_VzcaAi?]^lCVYp!; " %% .################. #. " ;s="v=%04o;ev"%(;v=(v-($*+[45, ":####: :##############% : " ])[n=0].to_i;)%360)+"al$s=%q#{ "%######. ######### " ;;"%c"%126+$s<<126}";d.gsub!(/ "##########. #######% " |\s|".*"/,"");;require"zlib"|| "########### :######. " ;d=d.unpack"C*"d.map{|c|n=(n|| ":#########: .######: . " )*90+(c-2)%91};e=["%x"%n].pack " :#######% :###### #: " &&"H*";e=Zlib::Inflate.inflate( " ######% .####% :: " &&e).unpack("b*")[0];22.times{|y| " ####% %### " ;w=(Math.sqrt(1-((y*2.0-21)/22)**(; " .###: .#% " ;2))*23).floor;(w*2-1).times{|x|u=(e+ " %## " )[y*z=360,z]*2;u=u[90*x/w+v+90,90/w];s[( " #. " ;y*80)+120-w+x]=(""<<32<<".:%#")[4*u.count(( " . " ;"0"))/u.size]}};;puts\s+";_ The Qlobe#{" "*18+ ( "# :#######" ;"Copyright(C).Yusuke End\oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010

Page 26: Software composition by @steveklabnik

v=0416;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP4ZojjV)O>qIH1/n[|2yE[>:ieC ".#####%.#% " 97N-A&Kj_K_><wS5rtWk@*a+Y5yH?b[F^e7C/56j|pmRe+:)B " .#####%##% :" O98(Zh)'Iof*nm.,$C5Nyt=PPu01Avw^<IiQ=5$'D-y? " #####%###: #" g6`YT+qLw9k^ch|K'),tc6ygIL8xI#LNz3v}T=4W " %######## #." lL27FZ0ij)7TQCI)P7u}RT5-iJbbG5P-DHB<. " :####### ###" R,YvZ_rnv6ky-G+4U'$*are@b4U351Q-ug5 " ###: : ####" 00x8RR%`Om7VDp4M5PFixrPvl&<p[]1IJ " %#... #####" EGgDt8Lm#;bc4zS^y]0`_PstfUxOC(q " %### .#####" /,}.YOIFj(k&q_VzcaAi?]^lCVYp!; " :. %% .#####" ;s="v=%04o;ev"%(;v=(v-($*+[45, " :####: :####" ])[n=0].to_i;)%360)+"al$s=%q#{ " %######. " ;;"%c"%126+$s<<126}";d.gsub!(/ " ##########. " |\s|".*"/,"");;require"zlib"|| " ########### " ;d=d.unpack"C*"d.map{|c|n=(n|| " :#########: " )*90+(c-2)%91};e=["%x"%n].pack " :#######% " &&"H*";e=Zlib::Inflate.inflate( " ######% " &&e).unpack("b*")[0];22.times{|y| " ####% " ;w=(Math.sqrt(1-((y*2.0-21)/22)**(; " .###: " ;2))*23).floor;(w*2-1).times{|x|u=(e+ " %## " )[y*z=360,z]*2;u=u[90*x/w+v+90,90/w];s[( " #. " ;y*80)+120-w+x]=(""<<32<<".:%#")[4*u.count(( " . " ;"0"))/u.size]}};;puts\s+";_ The Qlobe#{" "*18+ ( " .##### :#" ;"Copyright(C).Yusuke End\oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010

Page 27: Software composition by @steveklabnik

v=0341;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP4ZojjV)O>qIH1/n[|2yE[>:ieC "#% .#####%." 97N-A&Kj_K_><wS5rtWk@*a+Y5yH?b[F^e7C/56j|pmRe+:)B " : %#####%##. " O98(Zh)'Iof*nm.,$C5Nyt=PPu01Avw^<IiQ=5$'D-y? " #####%###: " g6`YT+qLw9k^ch|K'),tc6ygIL8xI#LNz3v}T=4W " %######## " lL27FZ0ij)7TQCI)P7u}RT5-iJbbG5P-DHB<. " :####### " R,YvZ_rnv6ky-G+4U'$*are@b4U351Q-ug5 " :### : " 00x8RR%`Om7VDp4M5PFixrPvl&<p[]1IJ " %#... " EGgDt8Lm#;bc4zS^y]0`_PstfUxOC(q " .###: " /,}.YOIFj(k&q_VzcaAi?]^lCVYp!; " :. %% " ;s="v=%04o;ev"%(;v=(v-($*+[45, " :####: " ])[n=0].to_i;)%360)+"al$s=%q#{ " %######. " ;;"%c"%126+$s<<126}";d.gsub!(/ " ##########" |\s|".*"/,"");;require"zlib"|| "% ##########" ;d=d.unpack"C*"d.map{|c|n=(n|| " :#########" )*90+(c-2)%91};e=["%x"%n].pack " ########" &&"H*";e=Zlib::Inflate.inflate( "#. ######%" &&e).unpack("b*")[0];22.times{|y| "## :####. " ;w=(Math.sqrt(1-((y*2.0-21)/22)**(; "#. .###: " ;2))*23).floor;(w*2-1).times{|x|u=(e+ "% . %## " )[y*z=360,z]*2;u=u[90*x/w+v+90,90/w];s[( " . #. " ;y*80)+120-w+x]=(""<<32<<".:%#")[4*u.count(( " : " ;"0"))/u.size]}};;puts\s+";_ The Qlobe#{" "*18+ ( "#. .##### " ;"Copyright(C).Yusuke End\oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010

Page 28: Software composition by @steveklabnik

v=0264;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP4ZojjV)O>qIH1/n[|2yE[>:ieC "####% .####" 97N-A&Kj_K_><wS5rtWk@*a+Y5yH?b[F^e7C/56j|pmRe+:)B "##### : .#####" O98(Zh)'Iof*nm.,$C5Nyt=PPu01Avw^<IiQ=5$'D-y? "######. #####%" g6`YT+qLw9k^ch|K'),tc6ygIL8xI#LNz3v}T=4W "####: . %######" lL27FZ0ij)7TQCI)P7u}RT5-iJbbG5P-DHB<. "#### . :######" R,YvZ_rnv6ky-G+4U'$*are@b4U351Q-ug5 "####% ###: " 00x8RR%`Om7VDp4M5PFixrPvl&<p[]1IJ "### %#..." EGgDt8Lm#;bc4zS^y]0`_PstfUxOC(q "## .. %###" /,}.YOIFj(k&q_VzcaAi?]^lCVYp!; ":#. . :" ;s="v=%04o;ev"%(;v=(v-($*+[45, ": : : " ])[n=0].to_i;)%360)+"al$s=%q#{ "% %#: " ;;"%c"%126+$s<<126}";d.gsub!(/ "#::#.: %#% " |\s|".*"/,"");;require"zlib"|| " : :#% " ;d=d.unpack"C*"d.map{|c|n=(n|| " :% : " )*90+(c-2)%91};e=["%x"%n].pack " %###%% " &&"H*";e=Zlib::Inflate.inflate( " ########. " &&e).unpack("b*")[0];22.times{|y| " ########. " ;w=(Math.sqrt(1-((y*2.0-21)/22)**(; " ##:%###. " ;2))*23).floor;(w*2-1).times{|x|u=(e+ " %% . " )[y*z=360,z]*2;u=u[90*x/w+v+90,90/w];s[( " . " ;y*80)+120-w+x]=(""<<32<<".:%#")[4*u.count(( " " ;"0"))/u.size]}};;puts\s+";_ The Qlobe#{" "*18+ ( "####. .###" ;"Copyright(C).Yusuke End\oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010

Page 29: Software composition by @steveklabnik

v=0207;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP4ZojjV)O>qIH1/n[|2yE[>:ieC "#######% .#" 97N-A&Kj_K_><wS5rtWk@*a+Y5yH?b[F^e7C/56j|pmRe+:)B "##########: : " O98(Zh)'Iof*nm.,$C5Nyt=PPu01Avw^<IiQ=5$'D-y? "#############. " g6`YT+qLw9k^ch|K'),tc6ygIL8xI#LNz3v}T=4W "############: . " lL27FZ0ij)7TQCI)P7u}RT5-iJbbG5P-DHB<. "############# . " R,YvZ_rnv6ky-G+4U'$*are@b4U351Q-ug5 "############## " 00x8RR%`Om7VDp4M5PFixrPvl&<p[]1IJ "# %######### " EGgDt8Lm#;bc4zS^y]0`_PstfUxOC(q " %#: %##: : " /,}.YOIFj(k&q_VzcaAi?]^lCVYp!; " #. .:#. . " ;s="v=%04o;ev"%(;v=(v-($*+[45, " : : : : " ])[n=0].to_i;)%360)+"al$s=%q#{ " :% %#: " ;;"%c"%126+$s<<126}";d.gsub!(/ " #::#.: %#% " |\s|".*"/,"");;require"zlib"|| " : :#% " ;d=d.unpack"C*"d.map{|c|n=(n|| " :% : " )*90+(c-2)%91};e=["%x"%n].pack " .###%# " &&"H*";e=Zlib::Inflate.inflate( " ########. " &&e).unpack("b*")[0];22.times{|y| " :######## " ;w=(Math.sqrt(1-((y*2.0-21)/22)**(; " ##:%###. " ;2))*23).floor;(w*2-1).times{|x|u=(e+ " %% . " )[y*z=360,z]*2;u=u[90*x/w+v+90,90/w];s[( " . " ;y*80)+120-w+x]=(""<<32<<".:%#")[4*u.count(( " " ;"0"))/u.size]}};;puts\s+";_ The Qlobe#{" "*18+ ( "#######. ." ;"Copyright(C).Yusuke End\oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010

Page 30: Software composition by @steveklabnik

v=0132;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP4ZojjV)O>qIH1/n[|2yE[>:ieC ":::#######%" 97N-A&Kj_K_><wS5rtWk@*a+Y5yH?b[F^e7C/56j|pmRe+:)B "################ : " O98(Zh)'Iof*nm.,$C5Nyt=PPu01Avw^<IiQ=5$'D-y? "####################. " g6`YT+qLw9k^ch|K'),tc6ygIL8xI#LNz3v}T=4W " .####:############: . " lL27FZ0ij)7TQCI)P7u}RT5-iJbbG5P-DHB<. "# # :################# . " R,YvZ_rnv6ky-G+4U'$*are@b4U351Q-ug5 "#######################% " 00x8RR%`Om7VDp4M5PFixrPvl&<p[]1IJ "######:#### %######### " EGgDt8Lm#;bc4zS^y]0`_PstfUxOC(q "#######:##% .## .### .. " /,}.YOIFj(k&q_VzcaAi?]^lCVYp!; "##########. #. .:#. . " ;s="v=%04o;ev"%(;v=(v-($*+[45, "#########% : : : : " ])[n=0].to_i;)%360)+"al$s=%q#{ "######### :% %#: " ;;"%c"%126+$s<<126}";d.gsub!(/ "#######% #::#.: %#% " |\s|".*"/,"");;require"zlib"|| ":######. : :#% " ;d=d.unpack"C*"d.map{|c|n=(n|| ".######: . :% : " )*90+(c-2)%91};e=["%x"%n].pack ":###### #: %###%% " &&"H*";e=Zlib::Inflate.inflate( ".####% :: ########. " &&e).unpack("b*")[0];22.times{|y| " %### ########. " ;w=(Math.sqrt(1-((y*2.0-21)/22)**(; " .#% ##:%###. " ;2))*23).floor;(w*2-1).times{|x|u=(e+ " %% . " )[y*z=360,z]*2;u=u[90*x/w+v+90,90/w];s[( " . " ;y*80)+120-w+x]=(""<<32<<".:%#")[4*u.count(( " " ;"0"))/u.size]}};;puts\s+";_ The Qlobe#{" "*18+ ( "##########." ;"Copyright(C).Yusuke End\oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010

Page 31: Software composition by @steveklabnik

v=0055;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP4ZojjV)O>qIH1/n[|2yE[>:ieC "% :::#####" 97N-A&Kj_K_><wS5rtWk@*a+Y5yH?b[F^e7C/56j|pmRe+:)B " .:################" O98(Zh)'Iof*nm.,$C5Nyt=PPu01Avw^<IiQ=5$'D-y? " ######################" g6`YT+qLw9k^ch|K'),tc6ygIL8xI#LNz3v}T=4W " #. .####:############: " lL27FZ0ij)7TQCI)P7u}RT5-iJbbG5P-DHB<. " ##### # :################# . " R,YvZ_rnv6ky-G+4U'$*are@b4U351Q-ug5 " :############################ " 00x8RR%`Om7VDp4M5PFixrPvl&<p[]1IJ " ############:#### %######### " EGgDt8Lm#;bc4zS^y]0`_PstfUxOC(q " %############:### %#: %##: : " /,}.YOIFj(k&q_VzcaAi?]^lCVYp!; " .################. #. .:#. . " ;s="v=%04o;ev"%(;v=(v-($*+[45, " :##############% : : : : " ])[n=0].to_i;)%360)+"al$s=%q#{ " ######### :% %#: " ;;"%c"%126+$s<<126}";d.gsub!(/ " #######% #::#.: %#" |\s|".*"/,"");;require"zlib"|| " :######. : :" ;d=d.unpack"C*"d.map{|c|n=(n|| " .######: . :% " )*90+(c-2)%91};e=["%x"%n].pack " ######%:# .###%" &&"H*";e=Zlib::Inflate.inflate( " .####% :: ######" &&e).unpack("b*")[0];22.times{|y| " .###: :#####" ;w=(Math.sqrt(1-((y*2.0-21)/22)**(; " .#% ##:%#" ;2))*23).floor;(w*2-1).times{|x|u=(e+ " " )[y*z=360,z]*2;u=u[90*x/w+v+90,90/w];s[( " " ;y*80)+120-w+x]=(""<<32<<".:%#")[4*u.count(( " " ;"0"))/u.size]}};;puts\s+";_ The Qlobe#{" "*18+ ( ":##########" ;"Copyright(C).Yusuke End\oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010

Page 32: Software composition by @steveklabnik

v=0000;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP4ZojjV)O>qIH1/n[|2yE[>:ieC "%.#% :::##" 97N-A&Kj_K_><wS5rtWk@*a+Y5yH?b[F^e7C/56j|pmRe+:)B "##% ::##########" O98(Zh)'Iof*nm.,$C5Nyt=PPu01Avw^<IiQ=5$'D-y? "##: ###############" g6`YT+qLw9k^ch|K'),tc6ygIL8xI#LNz3v}T=4W "# #. .####:#######" lL27FZ0ij)7TQCI)P7u}RT5-iJbbG5P-DHB<. " ##### # :############" R,YvZ_rnv6ky-G+4U'$*are@b4U351Q-ug5 " #######################" 00x8RR%`Om7VDp4M5PFixrPvl&<p[]1IJ " ############:#### %#####" EGgDt8Lm#;bc4zS^y]0`_PstfUxOC(q " .#############:##% .## ." /,}.YOIFj(k&q_VzcaAi?]^lCVYp!; " %% .################. #. " ;s="v=%04o;ev"%(;v=(v-($*+[45, ":####: :##############% : " ])[n=0].to_i;)%360)+"al$s=%q#{ "%######. ######### " ;;"%c"%126+$s<<126}";d.gsub!(/ "##########. #######% " |\s|".*"/,"");;require"zlib"|| "########### :######. " ;d=d.unpack"C*"d.map{|c|n=(n|| ":#########: .######: . " )*90+(c-2)%91};e=["%x"%n].pack " :#######% :###### #: " &&"H*";e=Zlib::Inflate.inflate( " ######% .####% :: " &&e).unpack("b*")[0];22.times{|y| " ####% %### " ;w=(Math.sqrt(1-((y*2.0-21)/22)**(; " .###: .#% " ;2))*23).floor;(w*2-1).times{|x|u=(e+ " %## " )[y*z=360,z]*2;u=u[90*x/w+v+90,90/w];s[( " #. " ;y*80)+120-w+x]=(""<<32<<".:%#")[4*u.count(( " . " ;"0"))/u.size]}};;puts\s+";_ The Qlobe#{" "*18+ ( "# :#######" ;"Copyright(C).Yusuke End\oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010

Page 33: Software composition by @steveklabnik

BEFOREHAND: close door, each window & exit; wait until time. open spellbook, study, read (scan, select, tell us);write it, print the hex while each watches, reverse its length, write again; kill spiders, pop them, chop, split, kill them. unlink arms, shift, wait & listen (listening, wait),sort the flock (then, warn the "goats" & kill the "sheep");

Page 34: Software composition by @steveklabnik

"eyes".scan /the_darkness/catch( :in_the_wind ) { ?a.round; "breath" \ or "a".slice /of_moon/ }

Page 35: Software composition by @steveklabnik

Source vs. Binary

Unity can only be manifested by the Binary. Unity itself and the idea of Unity are already two.- Buddha

Page 36: Software composition by @steveklabnik
Page 37: Software composition by @steveklabnik

Code vs. Data

The progression of the Lisp programmer: the newbie realizes that the difference between code and data is trivial. The expert realizes that all code is data. And the true master realizes that all data is code.- Unknown

Page 38: Software composition by @steveklabnik

Polyglot

The Tao gave birth to machine language. Machine language gave birth to the assembler. The assembler gave birth to the compiler. Now there are ten thousand languages.Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao. But do not program in COBOL if you can avoid it.- The Tao of Programming

Page 39: Software composition by @steveklabnik

The Temporal Dimension

The authenticity of a thing is the essence of all that is transmissible from its beginning, ranging from its substative duration to its testimony to the history which it has experienced. - Walter Benjamin, "The Work of Art in the Age of Mechanical Reproduction"

Page 40: Software composition by @steveklabnik

Integrating Copies

Even the most perfect reproduction of a work of art is lacking in one element: its presence in time and space, its unique existence at the place where it happens to be.- Walter Benjamin, "The Work of Art in the Age of Mechanical Reproduction"

Page 41: Software composition by @steveklabnik

Multiple Representations

Q: If only you and dead people understand hexidecimal, how many people understand hexidecimal?A: 57006.

Page 42: Software composition by @steveklabnik

Backporting

Software is like sex; make one mistake, and you'll be supporting it for the next 18 years.- Unknown

Page 43: Software composition by @steveklabnik

Levels of AbstractionWilliam James, father of American psychology, tells of meeting an old lady who told him the Earth rested on the back of a huge turtle. "But, my dear lady", Professor James asked, as politely as possible, "what holds up the turtle?" "Ah", she said, "that's easy. He is standing on the back of another turtle." "Oh, I see", said Professor James, still being polite. "But would you be so good as to tell me what holds up the second turtle?" "It's no use, Professor", said the old lady, realizing he was trying to lead her into a logical trap. "It's turtles-turtles-turtles, all the way!"- Prometheus Rising

Page 44: Software composition by @steveklabnik

an aside:

Page 45: Software composition by @steveklabnik

Software as a crisis of literacy

Page 46: Software composition by @steveklabnik

an aside to the aside:

Page 47: Software composition by @steveklabnik

terminology problems

Page 48: Software composition by @steveklabnik

Crisis - A point of great tension in a narrative that determines how the action will come out.

Page 49: Software composition by @steveklabnik
Page 50: Software composition by @steveklabnik
Page 51: Software composition by @steveklabnik

Thanks!@steveklabnik

http://steveklabnik.com