Slide 1

Slide 1 text

Open Source Maintenance Eric Hodel - [email protected]

Slide 2

Slide 2 text

Jury Duty

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Open Source is My Job

Slide 7

Slide 7 text

Projects •RubyGems •RDoc •net-http-persistent •… many more

Slide 8

Slide 8 text

Responsibilities Maintenance Stewardship Understanding

Slide 9

Slide 9 text

Why Open Source?

Slide 10

Slide 10 text

“programming is rather thankless. you see your works become replaced by superior works in a year. unable to run at all in a few more.” _why

Slide 11

Slide 11 text

“Here’s what becoming eFamous made me realize: Everyone is sincere and doing it because they care. I was very surprised to learn this.” @garybernhardt

Slide 12

Slide 12 text

“I get paid to do something I love. Something I’ve done in my spare time since I was a kid. That’s awesome. That’s why I care.” @lindseybieda

Slide 13

Slide 13 text

I Care

Slide 14

Slide 14 text

Pleasant Surprises net-http-persistent single connection ~750,000 requests

Slide 15

Slide 15 text

Pleasant Surprises rdoc -C shows documentation coverage for your library used in contracts

Slide 16

Slide 16 text

Values

Slide 17

Slide 17 text

Open Source Values •Community •Collaboration •Sharing •Re-use

Slide 18

Slide 18 text

Proprietary Software “Your team should work like an open source project” bit.ly/1byoEiK Ryan Tomayko

Slide 19

Slide 19 text

OSS Constraints •Electronic Communication •Visible Work •Asynchronous •Lock-free

Slide 20

Slide 20 text

Commits

Slide 21

Slide 21 text

Commits Create History

Slide 22

Slide 22 text

Tell a Story

Slide 23

Slide 23 text

Commit Small •History is easier to read •Easy to revert •Easy branch maintenance •github user page bragging

Slide 24

Slide 24 text

Atomic Commit Convention bit.ly/160ia91

Slide 25

Slide 25 text

Small Commits •Fix only one bug •Add one method •Whitespace cleanup •Reformat a line

Slide 26

Slide 26 text

Current status: Not sure where I was going with this

Slide 27

Slide 27 text

“One thing Clojure has taught me is that good commit messages are a luxury of people that know what the fuck they are doing” @tpope

Slide 28

Slide 28 text

Be Descriptive Descriptive messages make history easy to understand

Slide 29

Slide 29 text

git commit --help “begin the commit message with a single short line summarizing the change”

Slide 30

Slide 30 text

Short Summary •The URI argument to Gem::Request.new must be a URI •Only display relevant release notes upon update •Allow `gem uninstall foo --all`

Slide 31

Slide 31 text

git commit --help “followed by a more thorough description”

Slide 32

Slide 32 text

Thorough Description The URI argument to Gem::Request.new must be a URI The tests were lazy and used a String which was converted internally. This causes problems on older ruby versions which don't allow `URI(URI("http://example"))`. Now the argument given is always a URI in the tests.

Slide 33

Slide 33 text

Thorough Description •Old behavior •Why it needs to change •New behavior

Slide 34

Slide 34 text

Thorough Description •Commit references •Issue references •Don't assign blame •Except to yourself

Slide 35

Slide 35 text

Issues

Slide 36

Slide 36 text

Organize

Slide 37

Slide 37 text

Issue Labels •Status •Type •Category

Slide 38

Slide 38 text

Milestones •Release boundary •Allow slippage •Feature freeze

Slide 39

Slide 39 text

Keep an Open Mind

Slide 40

Slide 40 text

Random Test Failure -{"SHA512"=> +{"SHA1"=>

Slide 41

Slide 41 text

Random Test Failure •Rarely occurs •Probably hash order problem •Must be hash order problem!

Slide 42

Slide 42 text

Hash Mismatch +"data.tar.gz"=>"14413052..."}, -"data.tar.gz"=>"c6465bbb..."},

Slide 43

Slide 43 text

gzip Timestamp •One second resolution •Test gzipped two files •Sometimes in different seconds

Slide 44

Slide 44 text

It's OK to Be Wrong

Slide 45

Slide 45 text

rubygems/rubygems #510 them: The chmod should be included in the publishing guide

Slide 46

Slide 46 text

rubygems/rubygems #510 me: Why? The file is created with the correct permissions

Slide 47

Slide 47 text

rubygems/rubygems #510 them: The guide says to run: curl -u username [...] > ~/.gem/credentials

Slide 48

Slide 48 text

rubygems/rubygems #510 me: I'm sorry, I didn't read that section. RubyGems creates the credentials file for you. I'll rewrite the offending section.

Slide 49

Slide 49 text

Pursue Understanding

Slide 50

Slide 50 text

“‘X’ is Hard to Use” •“Hard”, “Broken”, “Doesn't Work” •You think “X” is easy, works •They might be right!

Slide 51

Slide 51 text

Maintenance & New Features

Slide 52

Slide 52 text

Find the Root Cause

Slide 53

Slide 53 text

“Trying to force myself to keep asking, ‘rather than *solve* [hard problem X], is there a way to make [X] irrelevant?’ Typical answer: yes.” Kathy Sierra — @seriouspony

Slide 54

Slide 54 text

Hard → Easy •Hide details when possible •Avoid configuration •Provide broad defaults

Slide 55

Slide 55 text

pcaprub API pcap = Pcap.open_live 'wlan0', 65535, true, 0 pcap.setfilter 'icmp' loop do p pcap.next end

Slide 56

Slide 56 text

capp capp = Capp.live capp.filter = 'icmp' capp.loop do |packet| p packet end

Slide 57

Slide 57 text

“The worst thing about writing clever code is not being clever enough to understand it.” Eleanor McHugh — @feyeleanor

Slide 58

Slide 58 text

Keep it Simple •Small commits •Minimum change •Document when you can't

Slide 59

Slide 59 text

rails/rails@ba0568e “In the past we used Hash[columns.zip(row)] […], the verbose way is much more efficient both time and memory wise cause it avoids a big array allocation”

Slide 60

Slide 60 text

Refactor •Simplify methods •Improve API •Improve understanding •Don't forget tests

Slide 61

Slide 61 text

Good API

Slide 62

Slide 62 text

Compact API •Minimum objects •Minimum arguments •Minimum configuration •Self-check through tests

Slide 63

Slide 63 text

Good Names •Hardest •Do your names fit? •Reveal intention?

Slide 64

Slide 64 text

Semantic Versioning

Slide 65

Slide 65 text

2.3.4 •Incompatible API changes

Slide 66

Slide 66 text

2.3.4 •Incompatible API changes •Backward-compatible features

Slide 67

Slide 67 text

2.3.4 •Incompatible API changes •Backward-compatible features •Backward-compatible bug fixes •http://semver.org

Slide 68

Slide 68 text

SemVer and RubyGems 'rake', '~> 10.0.3' 10.0.3 to 10.0.99…

Slide 69

Slide 69 text

SemVer and RubyGems 'rake', '~> 10.0', '>= 10.0.3' 10.0.3 to 10.99…

Slide 70

Slide 70 text

Reduce Barriers

Slide 71

Slide 71 text

“This is what your tool chain looks like to people not ‘in the know’. They just want to do a thing” @jessenoller

Slide 72

Slide 72 text

How Do I Start? •CONTRIBUTING.txt •run: bundle •How do I run the tests? •hoe: rake newb

Slide 73

Slide 73 text

CONTRIBUTING.txt •Your process •fork, edit, test, pull request •Code conventions •Vocabulary

Slide 74

Slide 74 text

Automate Everything •Travis-CI •Generate files •Run tests •Release

Slide 75

Slide 75 text

How to Contribute

Slide 76

Slide 76 text

What Gems do You Use?

Slide 77

Slide 77 text

Gems You Use •Report bugs •Report bad documentation •Hard to understand •Missing examples

Slide 78

Slide 78 text

Pull Requests •Contact the maintainers: “How would I fix issue #XXX” •Start small •Try different projects

Slide 79

Slide 79 text

Scratch Your Own Itch

Slide 80

Slide 80 text

Code Climate •Free for github projects •Uses flog and flay •Refactoring targets •Method duplication •Complexity

Slide 81

Slide 81 text

Thank You