An Open Source Advantage (Droidcon MTL 2015)

An Open Source Advantage (Droidcon MTL 2015)

Video: https://www.youtube.com/watch?v=PCxz2LEmuL4

A successful app takes a lot of code. The best developers don’t write all of that code themselves; instead they rely on open source to solve all of the common problems. That way they can direct their energy on application-specific tasks.

In this keynote, we’ll show how to use open source effectively. We’ll start with guidance on evaluating a codebase. Then we’ll show you how to grow your relationship with an open source project, from user to contributor to maintainer.

We’ll talk about forking for good and evil, rejected pull requests, and how open source can lead to your code running on one billion Android devices.

69252b3de5cb7f464c09301d9a6b0401?s=128

Jesse Wilson

April 11, 2015
Tweet

Transcript

  1. an open source advantage @jakewharton @jessewilson

  2. Marketing

  3. Reputation

  4. Documentation

  5. Share Code

  6. Who do you work with?

  7. SOFTWARE DEVELOPER

  8. CUSTOMER PRODUCT EDITOR DESIGNER SOFTWARE DEVELOPER

  9. None
  10. So you’re making a blue ribbon Android application Best PROGRAMMER’S

    RELEASE
  11. You’re going to need many libraries.

  12. • views: lists, sticky headers, layout binding • networking: HTTP

    client, image downloaders, REST adapter • data: JSON, protocol buffers, database access, value objects • monitoring: analytics, automatic & manual bug reporting, logging • development: debug utilities, static analysis • testing: UI, unit testing, mock objects, assertions, JVM testing • structure: dependency injection, async events, navigation
  13. • views: lists, sticky headers, layout binding • networking: HTTP

    client, image downloaders, REST adapter • data: JSON, protocol buffers, database access, value objects • monitoring: analytics, automatic & manual bug reporting, logging • development: debug utilities, static analysis • testing: UI, unit testing, mock objects, assertions, JVM testing • structure: dependency injection, async events, navigation
  14. {
 "baseUrl": "http://localhost:8080/cash/",
 "headerBackgroundUri": "/static/email/images/exampleBackground.png",
 "headerImageUri": "animatedHeader.gif",
 "theme": {
 "backgroundColor":

    "#ce0606",
 "textColor": "#ff6a5f",
 "buttonColor": "#ec2a2a"
 },
 "headerAlt": "$35",
 "title": "I embedded the background image in the HTML.",
 "button": {
 "label": "Thanks",
 "url": "https://cash.me/"
 },
 "showAboutFooter": false,
 "rightToRefundLink": false
 }
  15. Each library has many features.

  16. JSON library

  17. JSON library JSON writer JSON reader binding annotations m odel

    objects precision policy lenient policy binding system collections binding POJO bindings date bindings hash collision defence constructor caller code generator exception policy pretty printer benchmarks U TF-8 transcoder type registry naming policy string pool error locator type resolver enum bindings cycle defense
  18. JSON library JSON writer JSON reader binding annotations m odel

    objects precision policy lenient policy binding system collections binding POJO bindings date bindings hash collision defence constructor caller code generator exception policy pretty printer benchmarks U TF-8 transcoder type registry naming policy string pool error locator type resolver enum bindings cycle defense
  19. Each feature requires many lines of code.

  20. /**
 * Returns a <a href="http://goessner.net/articles/JsonPath/">JsonPath</a> to
 * the current

    location in the JSON value.
 */
 public String getPath() {
 StringBuilder result = new StringBuilder().append('$');
 for (int i = 0, size = stackSize; i < size; i++) {
 switch (stack[i]) {
 case JsonScope.EMPTY_ARRAY:
 case JsonScope.NONEMPTY_ARRAY:
 result.append('[').append(pathIndices[i]).append(']');
 break;
 
 case JsonScope.EMPTY_OBJECT:
 case JsonScope.DANGLING_NAME:
 case JsonScope.NONEMPTY_OBJECT:
 result.append('.');
 if (pathNames[i] != null) {
 result.append(pathNames[i]);
 }
 break;
 
 case JsonScope.NONEMPTY_DOCUMENT:
 case JsonScope.EMPTY_DOCUMENT:
 case JsonScope.CLOSED:
 break;
 }
 }
 return result.toString();
 }
  21. Can’t build it all yourself! * Unless you’re in no

    hurry to ship.
  22. Open source offers many options!

  23. Guide to Jake & Jesse’s Evaluating Open! Source Projects Picasso,

    Volley,! Glide, & Fresco: Which one should! you avoid? Jason Parser With forward by Lynn E. R. Layout
  24. Simple

  25. Right features

  26. Correct

  27. Engaged

  28. read the code

  29. None
  30. None
  31. } dependencies {

  32. You just got thousands of lines of code for free.

    } compile 'com.google.code.gson:gson:2.3.1' dependencies { compile 'com.google.code.gson:gson:2.3.1'
  33. Put it to work.

  34. This is the best time to contribute documentation.

  35. Found a bug? Isolate it.

  36. Happy? Spread the love.

  37. You aren’t paying with money.

  38. You aren’t paying with money. Pay with your time.

  39. Let’s talk about contributing code…

  40. SMALL LIBRARY

  41. YOUR NEEDS SMALL LIBRARY

  42. JEN’S NEEDS YOUR NEEDS SMALL LIBRARY

  43. MARCOS’ NEEDS JEN’S NEEDS YOUR NEEDS SMALL LIBRARY

  44. MARCOS’ NEEDS MATT’S NEEDS JEN’S NEEDS YOUR NEEDS SMALL LIBRARY

  45. M ARCO S’ N EED S M ATT’S N EED

    S JEN ’S N EED S YO U R N EED S BIG LIBRARY
  46. FEATURES YOU DON’T NEED FEATURES YOU NEED

  47. INCLUDE Code we all need.

  48. INCLUDE Code we all need. EXCLUDE Everything else!

  49. I wrote some new features for you!

  50. No thanks! I wrote some new features for you!

  51. No thanks! BUT THE CODE IS ALREADY WRITTEN!

  52. BUT THE CODE IS ALREADY WRITTEN! Ummm…

  53. EXTENSIBLE! Good APIs are EXTENSIBLE!

  54. OUR API MAKES YOUR CODE SIMPLE!

  55. OUR API MAKES YOUR CODE SIMPLE! AMAZE.

  56. AMAZE. PLUS WE’LL ADD IT AS A SAMPLE!

  57. (Designing extensible APIs is hard.)

  58. What to open source?

  59. Not another JSON library

  60. Not another JSON library * Unless you’re doing something new.

  61. Not another JSON library * Unless you’re doing something new.

  62. Often it’s code you inherited!

  63. Managing a Codebase

  64. Managing a Community

  65. Be inclusive.

  66. Prefer face to face.

  67. flic.kr/jeremylevinedesign flic.kr/koreanet

  68. • Be responsive. • Engage with people. • Say no

    (nicely). • Cut releases. Responsibilities
  69. • Guide the ship. • Programming is fun. • Make

    friends! • Reputation.
 (which you can exchange for speaking opportunities at Droidcons) Perks
  70. Enjoy Droidcon Montréal @jakewharton @jessewilson