What do you mean, backwards compatibility?

1,316 views
1,157 views

Published on

The Java driver for MongoDB has been around almost as long as the NoSQL database itself. It was designed without some of the modern Java features we now take for granted, and the API might be easier with features like lambdas.

The existing Java driver is extensively used, which leads to a tricky question: how do you create a new API that uses modern development patterns whilst retaining backwards compatibility? Your users are fundamental to the success of your business, you do not want to alienate them, break their systems or make it hard for them to migrate to the New World Order.

In this presentation Trisha will share some of the pain experienced and solutions tried while creating a new Java driver for MongoDB.

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,316
On SlideShare
0
From Embeds
0
Number of Embeds
450
Actions
Shares
0
Downloads
5
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

What do you mean, backwards compatibility?

  1. 1. Trisha Gee #GeeCON Java Driver Developer, 10gen @trisha_gee What do you mean, backwards compatibility? Thursday, 16 May 13
  2. 2. Design: translate the requirements in a specification that describes the global architecture and the functionality of the system. http://homepages.cwi.nl/~paulk/patents/isnot/node4.html Thursday, 16 May 13
  3. 3. Managing the Development of Large Software Systems - Dr Winston Royce http://www.cs.umd.edu/class/spring2003/cmsc838p/Process/waterfall.pdf Thursday, 16 May 13
  4. 4. Agile Design <This Page Left Intentionally Blank> Thursday, 16 May 13
  5. 5. Design is a Process, not a Document Thursday, 16 May 13
  6. 6. What are you saying? • Design is a journey, enjoy the ride • There will be Monsters • There will be Safe Houses • There might not even be a destination... Thursday, 16 May 13
  7. 7. Best Job Evar!! Thursday, 16 May 13
  8. 8. We’re off! Thursday, 16 May 13
  9. 9. Backward Compatibility Thursday, 16 May 13
  10. 10. Lots of unknowns Thursday, 16 May 13
  11. 11. Design Goals Thursday, 16 May 13
  12. 12. Yes, it’s a document Thursday, 16 May 13
  13. 13. Design Goals • Consistency • Cleaner design • Intuitive API • Sane Exception handling • Test friendly • Backwards compatible Thursday, 16 May 13
  14. 14. Lack of consistency Thursday, 16 May 13
  15. 15. Coding Standards Thursday, 16 May 13
  16. 16. Zero Analysis Errors Thursday, 16 May 13
  17. 17. No more arguments Thursday, 16 May 13
  18. 18. Design Goals ✓Consistency • Cleaner design • Intuitive API • Sane Exception handling • Test friendly • Backwards compatible Thursday, 16 May 13
  19. 19. Users Thursday, 16 May 13
  20. 20. Identify Our Users Thursday, 16 May 13
  21. 21. 1. Java Developers 2. ODMs / other drivers / third parties 3. Contributors Three Types Of Users Thursday, 16 May 13
  22. 22. Java Developers • Consistency • Cleaner design •Intuitive API •Sane Exception handling •Test friendly •Backwards compatible Thursday, 16 May 13
  23. 23. Third Party Libraries •Consistency •Cleaner design • Intuitive API • Sane Exception handling •Test friendly •Backwards compatible Thursday, 16 May 13
  24. 24. Contributors •Consistency •Cleaner design • Intuitive API •Sane Exception handling •Test friendly • Backwards compatible Thursday, 16 May 13
  25. 25. Users are our friends Thursday, 16 May 13
  26. 26. Backward Compatibility Thursday, 16 May 13
  27. 27. Architecture Thursday, 16 May 13
  28. 28. UML, yuk! Thursday, 16 May 13
  29. 29. High Level Architecture Thursday, 16 May 13
  30. 30. Scala Driver Thursday, 16 May 13
  31. 31. Design Goals • Consistency ✓Cleaner design • Intuitive API • Sane Exception handling • Test friendly • Backwards compatible Thursday, 16 May 13
  32. 32. Design Goals • Consistency • Cleaner design • Intuitive API • Sane Exception handling • Test friendly •Backwards compatible Thursday, 16 May 13
  33. 33. High Level Architecture Thursday, 16 May 13
  34. 34. Option 1:Wrapping Thursday, 16 May 13
  35. 35. Option 2: Connecting Thursday, 16 May 13
  36. 36. Backward Compatibility? Thursday, 16 May 13
  37. 37. Tests Pass Thursday, 16 May 13
  38. 38. We win! Thursday, 16 May 13
  39. 39. Design Goals • Consistency • Cleaner design • Intuitive API • Sane Exception handling • Test friendly ✓Backwards compatible Thursday, 16 May 13
  40. 40. Not DeadYet... Thursday, 16 May 13
  41. 41. The Public API Thursday, 16 May 13
  42. 42. Design Goals • Consistency • Cleaner design •Intuitive API • Sane Exception handling • Test friendly • Backwards compatible Thursday, 16 May 13
  43. 43. Caveats • It won’t look like this • Haven’t decided consistent names yet • Need something that suits all drivers Thursday, 16 May 13
  44. 44. Find Thursday, 16 May 13
  45. 45. Find collection.find(query).skip(1000).limit(100); Thursday, 16 May 13
  46. 46. Find collection.find(query).skip(1000).limit(100); collection.find(query).skip(1000).limit(100); Thursday, 16 May 13
  47. 47. Find Thursday, 16 May 13
  48. 48. Find collection.find(query).skip(1000).limit(100); collection.find(query).skip(1000).limit(100); collection.find(query, fields); Thursday, 16 May 13
  49. 49. Which One? Thursday, 16 May 13
  50. 50. Find Thursday, 16 May 13
  51. 51. Find collection.find(query).skip(1000).limit(100); collection.find(query).skip(1000).limit(100); collection.find(query, fields); Thursday, 16 May 13
  52. 52. Find collection.find(query).skip(1000).limit(100); collection.find(query).skip(1000).limit(100); collection.find(query, fields); collection.find(query).select(fields); Thursday, 16 May 13
  53. 53. Fewer Decisions Thursday, 16 May 13
  54. 54. “Cmd + space” friendly Thursday, 16 May 13
  55. 55. Find collection.find(query).skip(1000).limit(100); collection.find(query).skip(1000).limit(100); collection.find(query, fields); collection.find(query).select(fields); Thursday, 16 May 13
  56. 56. Remove Thursday, 16 May 13
  57. 57. Remove collection.remove(query); Thursday, 16 May 13
  58. 58. Remove collection.remove(query); collection.find(query).remove(); Thursday, 16 May 13
  59. 59. Find and Modify Thursday, 16 May 13
  60. 60. Find and Modify collection.findAndModify(query, update); Thursday, 16 May 13
  61. 61. Find and Modify collection.findAndModify(query, update); collection.find(query).updateOneAndGet(update); Thursday, 16 May 13
  62. 62. They hate me! Thursday, 16 May 13
  63. 63. Find and Modify Thursday, 16 May 13
  64. 64. Find and Modify collection.findAndModify(query, update); collection.find(query) .updateOneAndGet(update); collection.findAndModify(query, fields, sort, false, update, true, false); Thursday, 16 May 13
  65. 65. Find and Modify collection.findAndModify(query, update); collection.find(query) .updateOneAndGet(update); collection.findAndModify(query, fields, sort, false, update, true, false); collection.find(query) .sort(sort) .updateOneAndGet(update); Thursday, 16 May 13
  66. 66. Find and Modify Thursday, 16 May 13
  67. 67. Find and Modify collection.findAndModify(query, update); collection.find(query) .updateOneAndGet(update); collection.findAndModify(query, fields, sort, false, update, true, false); collection.find(query) .sort(sort) .updateOneAndGet(update); Thursday, 16 May 13
  68. 68. Find and Modify collection.findAndModify(query, update); collection.find(query) .updateOneAndGet(update); collection.findAndModify(query, fields, sort, false, update, true, false); collection.find(query) .sort(sort) .updateOneAndGet(update); collection.find(query) .sort(sort) .getOneAndUpdate(update); Thursday, 16 May 13
  69. 69. Lack of consistency Thursday, 16 May 13
  70. 70. Consistency at last collection.find(query).limit(10); collection.find(query).limit(10).remove(); collection.find(query).sort(sortCriteria).getOne(); collection.find(query).sort(sortCriteria).remove(); collection.find(query).sort(sortCriteria).count(); Thursday, 16 May 13
  71. 71. Muerto del todo ✓Consistency • Cleaner design • Intuitive API • Sane Exception handling • Test friendly • Backwards compatible Thursday, 16 May 13
  72. 72. Design Goals • Consistency • Cleaner design •Intuitive API... • Sane Exception handling • Test friendly • Backwards compatible Thursday, 16 May 13
  73. 73. Not DeadYet! Thursday, 16 May 13
  74. 74. Tutorial/hack session Thursday, 16 May 13
  75. 75. This talk Thursday, 16 May 13
  76. 76. Design is a Process, not a Document Thursday, 16 May 13
  77. 77. Q & A Thursday, 16 May 13
  78. 78. 1.Are you using the Java driver? Thursday, 16 May 13
  79. 79. 2. What do you like about it? Thursday, 16 May 13
  80. 80. 3. What are your pain points? Thursday, 16 May 13
  81. 81. Design is a Process, not a Document Thursday, 16 May 13
  82. 82. Your Questions Thursday, 16 May 13

×