Text
Page: 1
Be a library developer!
Remember than Imagine
Kouhei Sutou
ClearCode Inc.
2013/06/01
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 2
Table of contents
✓ Share this talk's goal
✓ Describe key idea
✓ Apply the key idea
✓ Wrap up & The next step
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 3
Share the goal
✓ Share this talk's goal
✓ Describe key idea
✓ Apply the key idea
✓ Wrap up & The next step
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 4
This talk's goal
You know
how to develop better softwares
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 5
Better?
Show
by example
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 6
API
context.save
context.circle(50, 50, 10)
context.stroke
context.restore
from cairo gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 7
API: Point
context.save
# <- Point
context.circle(50, 50, 10)
context.stroke
context.restore # <- Point
from cairo gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 8
API: Better
context.save do
context.circle(50, 50, 10)
context.stroke
end
from cairo gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 9
API: Why
Why is it better?
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 10
API: Because
Because it's
more Ruby-ish
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 11
Ruby-ish?
-ish ==
Similar to others
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 12
Is "similar" better?
✓ Similarity makes consistency
✓ Consistency makes readability
✓ Readability is important to
develop better softwares
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 13
Is "readability" important?
✓ Readability makes
maintenability
✓ Maintenability is needed for
improving your softwares
repeatedly
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 14
So
Ruby-ish is
better
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 15
Let's validate
the example
Page: 16
Remember
File
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 17
Remember: File
# Setup
file = File.open(path)
file.read
# Teardown
file.close
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 18
Remember: File
# Setup
File.open(path) do |file|
file.read
end # Teardown
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 19
API (reprise)
context.save
# Setup
context.circle(50, 50, 10)
context.stroke
context.restore # Teardown
from cairo gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 20
API: Better (reprise)
context.save do # Setup
context.circle(50, 50, 10)
context.stroke
end
# Teardown
from cairo gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 22
Better
Ruby-ish
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 23
In other words
Similar to others
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 24
The goal (reprise)
You know
how to develop better softwares
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 25
In other words
You know
what is "similar"
and do similarly
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 26
Describe key idea
✓ Share this talk's goal
✓ Describe key idea
✓ Apply the key idea
✓ Wrap up & The next step
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 27
Key idea
Remember
than
Imagine
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 28
Remember than Imagine
Easy! Di cult...
Knowledge ???
Remember Imagine
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 29
To remember,
Easy!
How to get?
Di cult...
Knowledge ???
Remember Imagine
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 30
How to get knowledge?
✓ Experience
✓ Ask
✓ Observe
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 31
Experience!
✓ Experience ← Do this rst!
✓ Ask
✓ Observe
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 32
Key idea
Remember
than
Imagine
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 33
Apply the key idea
✓ Share this talk's goal
✓ Describe key idea
✓ Apply the key idea
✓ Wrap up & The next step
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 34
The goal (reprise)
You know
how to develop better softwares
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 35
Apply the key idea
Knowledge
Better
softwares
Remember
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 36
To achieve the goal,
What should
you experience?
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 37
What experience?
What experience?
Knowledge
Better
softwares
Remember
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 38
Rubyist
Rubyist experience!
Knowledge
Better
softwares
Remember
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 39
Rubyist?
You
experienced!
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 41
API: Getter
window.get_property("opacity")
# What is better API???
from gtk2 gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 42
API: Getter (better)
window.get_property("opacity")
window.opacity # Better
from gtk2 gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 43
Now,
You found
"remember" is
"di cult"
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 44
Di cult!
Remember!?
What is
"Ruby-ish"!?
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 45
Di cult?
Easy!
Knowledge
Remember
Be a library developer! - Remember than Imagine
Di cult...
???
Di cult???
Imagine
Powered by Rabbit 2.0.8
Page: 46
Because
You don't have
experience about
"Remember than
Imagine"
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 47
No "remember" experience
Rubyist experience!
Knowledge
Better
softwares
No experience
Remember
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 48
Your status
✓ Experience
✓ Ask (Heard) ← You are here!
✓ Observe
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 49
To achieve the goal,
What should
you experience?
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 50
What experience?
Rubyist experience!
Better
softwares
Knowledge
What experience?
Remember
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 51
Library developer
Rubyist experience!
Better
softwares
Knowledge
Library developer
Remember
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 52
Library developer
Considers about
✓ easy to use API
✓ as a Rubyist
✓ easy to understand document
✓ as a library user
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 53
Library developer
Considers them
many times
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 54
"Many times"
It's very good
exercise
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 55
Exercises
✓ API
✓ Document
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 57
API: Getter (reprise)
# Low level
window.get_property("opacity")
# Better
window.opacity
from gtk2 gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 58
API: Better?
# Low level
window.get_property("visible")
# Better
# ???: hint: "visible" is bool
from gtk2 gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 59
API: Better
# Low level
window.get_property("visible")
# Better
window.visible?
from gtk2 gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 60
API: Getter
# Better for record as collection
record["name"]
# Better for record as object
record.name
from rroonga gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 61
API: Init
require "gst"
# ???
Gst.init # <- What?
Gst::ElementFactory.make("playbin")
from gstreamer gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 62
API: Init (usage)
require "gst"
# For advanced use
Gst.init("--gst-debug=*:9")
Gst::ElementFactory.make("playbin")
from gstreamer gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 63
API: Init (better)
require "gst"
# Make optional
# Gst.init
Gst::ElementFactory.make("playbin")
from gstreamer gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 64
API: Init (impl)
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
from gstreamer gem
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 66
Document: Install
Install:
For Debian GNU/Linux:
% sudo apt-get install libgtk2.0-dev
% gem install gtk2
For OS X:
...
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 67
Document: Better
Install:
% gem install gtk2
libgtk2-0-dev is installed automatically
"gem install GEM_NAME" is popular install way
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 68
Exercises end
✓ We remembered about
"what is similar?"
✓ We done "similarly"
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 69
Do you understand
about
"Remember than
Imagine"?
Page: 70
Wrap up
✓ Share this talk's goal
✓ Describe key idea
✓ Apply the key idea
✓ Wrap up & The next step
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 71
This talk's goal
You know
how to develop better softwares
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 72
Better
Ruby-ish
Similar to others
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 73
Goal: In other words
You know
what is "similar"
and do similarly
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 74
Key idea
Remember
than
Imagine
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 75
Remember than Imagine
Easy! Di cult...
Knowledge ???
Remember Imagine
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 76
For development
✓ Experience Rubyist for
knowledge
✓ Then remember the knowledge
✓ But it is di cult because you don't
have experience about "remember"
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 77
No "remember" experience
Rubyist experience!
Knowledge
Better
softwares
No experience
Remember
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 78
Experience lib developer
It's very good
exercise
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 79
The next step
✓ Share this talk's goal
✓ Describe key idea
✓ Apply the key idea
✓ Wrap up & The next step
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 80
The next step
Use "library developer"
experience to other
things
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 81
For example,
Use it to
develop other
softwares
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 82
Develop other softwares
You can remember about
✓ a better bug report
✓ How to reproduce?
✓ a better patch
✓ How to commit? (size? message?)
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 83
Conclusion
Be a library
developer!
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 84
FYI
✓ We accept applications about
our internship
✓ You can develop a library with us
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 85
Bonus tracks
✓ Similar vs. Innovation
✓ No "imagine" communication
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 86
Similar
vs.
Innovation
Page: 87
Innovation
✓ Doing "similarly" will not
achieve "innovation"
✓ Should all we aspire
innovation?
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 88
No
✓ We have regular life
✓ It's also important that
we improve our regular life
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 89
No
"imagine"
communication
Page: 90
No "imagine"
✓ Show all u need from the start
✓ Don't omit anything
✓ If you emit something,
other people need "imagine"
✓ Use your experience for it!
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8
Page: 91
Key idea
Remember
than
Imagine
Be a library developer! - Remember than Imagine
Powered by Rabbit 2.0.8