= Be a library developer! : subtitle ((*R*))emember ((*t*))han ((*I*))magine : author Kouhei Sutou : institution ClearCode Inc. : date 2013/06/01 : allotted-time 28m : theme . = Table of contents * Share this talk's goal * Describe key idea * Apply the key idea * Wrap up & The next step = Share the goal * ((*Share this talk's goal*)) * Describe key idea * Apply the key idea * Wrap up & The next step = This talk's goal (('tag:as-large-as-possible')) You know\nhow to develop better softwares = Better? Show\nby example = API # coderay ruby context.save context.circle(50, 50, 10) context.stroke context.restore (('tag:center'))(('note:from cairo gem')) == slide property : evaluate-code true = API: Point # coderay ruby context.save # <- Point context.circle(50, 50, 10) context.stroke context.restore # <- Point (('tag:center'))(('note:from cairo gem')) == slide property : evaluate-code true = API: Better # coderay ruby context.save do context.circle(50, 50, 10) context.stroke end (('tag:center'))(('note:from cairo gem')) == slide property : evaluate-code true = API: Why Why is it better? = API: Because Because it's more Ruby-ish = Ruby-ish? -ish ==\n Similar to others = Is "similar" better? * Similarity makes consistency * Consistency makes readability * Readability is important to develop better softwares = Is "readability" important? * Readability makes maintenability * Maintenability is needed for improving your softwares repeatedly = So Ruby-ish is\nbetter = Let's validate the example = Remember File = Remember: File # coderay ruby # Setup file = File.open(path) file.read # Teardown file.close = Remember: File # coderay ruby # Setup File.open(path) do |file| file.read end # Teardown = API (reprise) # coderay ruby context.save # Setup context.circle(50, 50, 10) context.stroke context.restore # Teardown (('tag:center'))(('note:from cairo gem')) == slide property : evaluate-code true = API: Better (reprise) # coderay ruby context.save do # Setup context.circle(50, 50, 10) context.stroke end # Teardown (('tag:center'))(('note:from cairo gem')) == slide property : evaluate-code true = Wrap up = Better Ruby-ish = In other words Similar to others = The goal (reprise) (('tag:as-large-as-possible')) You know\nhow to develop better softwares = In other words (('tag:as-large-as-possible')) You know\nwhat is "similar" and do similarly = Describe key idea * Share this talk's goal * ((*Describe key idea*)) * Apply the key idea * Wrap up & The next step = Key idea (('tag:left')) (('tag:margin-left * 10')) ((*R*))emember\n((*t*))han\n((*I*))magine = Remember than Imagine # image # src = remember-than-imagine.svg # relative_height = 100 == slide property : enable-title-on-image false = To remember, # image # src = to-remember.svg # relative_height = 100 == slide property : enable-title-on-image false = How to get knowledge? * Experience * Ask * Observe = Experience! * ((*Experience*)) ← Do this first! * Ask * Observe = Key idea (('tag:left')) (('tag:margin-left * 10')) ((*R*))emember\n((*t*))han\n((*I*))magine = Apply the key idea * Share this talk's goal * Describe key idea * ((*Apply the key idea*)) * Wrap up & The next step = The goal (reprise) (('tag:as-large-as-possible')) You know\nhow to develop better softwares = Apply the key idea # image # src = apply-key-idea.svg # relative_height = 100 == slide property : enable-title-on-image false = To achieve the goal, What should you experience? = What experience? # image # src = what-experience.svg # relative_height = 100 == slide property : enable-title-on-image false = Rubyist # image # src = rubyist-experience.svg # relative_height = 100 == slide property : enable-title-on-image false = Rubyist? You experienced! = Try = API: Getter # coderay ruby window.get_property("opacity") # What is better API??? (('tag:center'))(('note:from gtk2 gem')) = API: Getter (better) # coderay ruby window.get_property("opacity") window.opacity # Better (('tag:center'))(('note:from gtk2 gem')) = Now, (('tag:as-large-as-possible')) You found "remember" is "difficult" = Difficult! Remember!?\n What is\n"Ruby-ish"!? = Difficult? # image # src = remember-is-difficult.svg # relative_height = 100 == slide property : enable-title-on-image false = Because (('tag:as-large-as-possible')) You don't have experience about\n "((*R*))emember ((*t*))han ((*I*))magine" = No "remember" experience # image # src = no-remember-experience.svg # relative_height = 100 == slide property : enable-title-on-image false = Your status * Experience * ((*Ask*)) (Heard) ← You are here! * Observe = To achieve the goal, What should you experience? = What experience? # image # src = what-experience-to-remember.svg # relative_height = 100 == slide property : enable-title-on-image false = Library developer # image # src = library-developer-experience.svg # relative_height = 100 == slide property : enable-title-on-image false = Library developer Considers about * easy to use API * as a Rubyist * easy to understand document * as a library user = Library developer Considers them ((*many times*)) = "Many times" It's very good exercise = Exercises * API * Document = API = API: Getter (reprise) # coderay ruby # Low level window.get_property("opacity") # Better window.opacity (('tag:center'))(('note:from gtk2 gem')) = API: Better? # coderay ruby # Low level window.get_property("visible") # Better # ???: hint: "visible" is bool (('tag:center'))(('note:from gtk2 gem')) = API: Better # coderay ruby # Low level window.get_property("visible") # Better window.visible? (('tag:center'))(('note:from gtk2 gem')) = API: Getter # coderay ruby # Better for record as collection record["name"] # Better for record as object record.name (('tag:center'))(('note:from rroonga gem')) = API: Init # coderay ruby require "gst" # ??? Gst.init # <- What? Gst::ElementFactory.make("playbin") (('tag:center'))(('note:from gstreamer gem')) = API: Init (usage) # coderay ruby require "gst" # For advanced use Gst.init("--gst-debug=*:9") Gst::ElementFactory.make("playbin") (('tag:center'))(('note:from gstreamer gem')) = API: Init (better) # coderay ruby require "gst" # Make optional # Gst.init Gst::ElementFactory.make("playbin") (('tag:center'))(('note:from gstreamer gem')) = API: Init (impl) # coderay ruby class << Gst def const_missing(name) init; const_get(name); end def init(*argv) # ...initialize library... class << self remove_method(:const_missing) end; end; end (('tag:center'))(('note:from gstreamer gem')) = Document = Document: Install Install: For Debian GNU/Linux: % sudo apt-get install libgtk2.0-dev % gem install gtk2 For OS X: ... = Document: Better Install: % gem install gtk2 (('tag:center'))(('note:libgtk2-0-dev is installed automatically')) (('tag:center'))(('note:"gem install GEM_NAME" is popular install way')) = Exercises end * We remembered about\n "what is similar?" * We done "similarly" = Do you understand about\n"((*R*))emember ((*t*))han ((*I*))magine"? = Wrap up * Share this talk's goal * Describe key idea * Apply the key idea * ((*Wrap up*)) & The next step = This talk's goal (('tag:as-large-as-possible')) You know\nhow to develop better softwares = Better Ruby-ish\n Similar to others = Goal: In other words (('tag:as-large-as-possible')) You know\nwhat is "similar" and do similarly = Key idea (('tag:left')) (('tag:margin-left * 10')) ((*R*))emember\n((*t*))han\n((*I*))magine = Remember than Imagine # image # src = remember-than-imagine.svg # relative_height = 100 == slide property : enable-title-on-image false = For development * Experience Rubyist for ((*knowledge*)) * Then ((*remember*)) the knowledge * But it is difficult because you don't have experience about "((*remember*))" = No "remember" experience # image # src = no-remember-experience.svg # relative_height = 100 == slide property : enable-title-on-image false = Experience lib developer It's very good exercise = The next step * Share this talk's goal * Describe key idea * Apply the key idea * Wrap up & ((*The next step*)) = The next step Use "library developer" experience to other things = For example, Use it to develop other softwares = Develop other softwares You can remember about * a better bug report * How to reproduce? * a better patch * How to commit? (size? message?) = Conclusion Be a library developer! = FYI # image # src = clear-code.svg # relative_height = 20 * We accept applications about our internship * You can develop a library with us = Bonus tracks * Similar vs. Innovation * No "imagine" communication\n = Similar\nvs.\nInnovation = Innovation * Doing "similarly" will not achieve "innovation" * Should all we aspire innovation? = No * We have regular life * It's also important that\n we improve our regular life = No\n"imagine" communication = No "imagine" * Show all u need from the start * Don't omit anything * If you emit something,\n other people need "imagine" * Use your experience for it! = Key idea (('tag:left')) (('tag:margin-left * 10')) ((*R*))emember\n((*t*))han\n((*I*))magine