Your SlideShare is downloading. ×
Review your code like a Googler
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Review your code like a Googler

877

Published on

Presentation about Code Review and Gerrit given at Confitura 2013 conference. Shows how to start with Gerrit, how configure Ecipse Mylyn Gerrit Connector plugin and how perform code reviews directly …

Presentation about Code Review and Gerrit given at Confitura 2013 conference. Shows how to start with Gerrit, how configure Ecipse Mylyn Gerrit Connector plugin and how perform code reviews directly in the IDE

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

  • Be the first to like this

No Downloads
Views
Total Views
877
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. All change lists must be reviewed. Period. “Review your code like a Googler” 2013 Dariusz Łuksza Dariusz Łuksza, CollabNet dariusz@luksza.org @dluksza
  • 2. 2013 Dariusz Łuksza Are you Git? pre-requirements
  • 3. First rule of Code Review: 2013 Dariusz Łuksza Your code is not your wife... pre-requirements
  • 4. First rule of Code Review and OpenSource: 2013 Dariusz Łuksza Your code is not your wife... pre-requirements
  • 5. 2013 Dariusz Łuksza Your code is not your wife... you can share it! pre-requirements First rule of Code Review and OpenSource:
  • 6. 2013 Dariusz Łuksza I'm here for You!
  • 7. 2013 Dariusz Łuksza Next ~47min. ● Code Review & Types ● Post-commit vs pre-commit ● The Gerrit ● EGit + Mylyn Review Gerrit Connector ● Command line→ ● Code Review Tips ● Gerrit++ ● Q&A Code reviews with Gerrit by Mateusz Szczap @ Marmolana 14:50
  • 8. 2013 Dariusz Łuksza Code Review
  • 9. post-commit review (formal code review) 2013 Dariusz Łuksza
  • 10. post-commit review (formal code review) 2013 Dariusz Łuksza
  • 11. 2013 Dariusz Łuksza Flickr: markcph post-commit review (formal code review)
  • 12. 2013 Dariusz Łuksza Flickr: markcph post-commit review (formal code review) Coffee, absolute must have during formal code reviews
  • 13. 2013 Dariusz Łuksza Flickr: sebastian_bergmann post-commit review (formal code review)
  • 14. 2013 Dariusz Łuksza Flickr: bike post-commit review (formal code review)
  • 15. 2013 Dariusz Łuksza review on request (post- or pre-commit)
  • 16. 2013 Dariusz Łuksza review on request (post- or pre-commit) 90 min later OK, so where I was before... Hi Jeff, could you review my changes before I submit I need a review... OK, lets go! Can I interrupt you for a moment?You already interrupted me... Sure you can, what is it? this loop iterates over… mhm... and then it brakes... if (req != null) { for (i = 0; … if (...) break; ... I finished my task and need final code review... would you like to look on it? emmmm … OK... 153 min later 9 min later finally I can get back to my task... … and then...
  • 17. 2013 Dariusz Łuksza asynchronous review with Gerrit (pre-commit)
  • 18. 2013 Dariusz Łuksza Gerrit Code Review this loop iterates over… mhm... and then it brakes... if (req != null) { for (i = 0; … if (...) break; ... found it!! HAHAHA OK, so now, commit and push for review! … step into... step over... … step over... step over... It's time to check others review requests I'm invincible!! Great! There are requests from Tom, Sara and Jim... let me see...
  • 19. post-commit vs. pre-commit 2013 Dariusz Łuksza
  • 20. Flickr: bike 2013 Dariusz Łuksza post-commit vs. pre-commit Flickr: sriram VS.
  • 21. 2013 Dariusz Łuksza The Gerrit
  • 22. The Gerrit ● Created for Android OpenSource project ● Designed to bring Google's code review feeling to Android community ● Pure Java based ● Has vibrant community ● Used in many OpenSource project's and Enterprise companies ● Can be used as regular Git server without code review ● Supports branch based permissions ● It is getting more and more extend-able 2013 Dariusz Łuksza
  • 23. 2013 Dariusz Łuksza Who uses Gerrit?
  • 24. 2013 Dariusz Łuksza let's play with Gerrit
  • 25. Demo Time! Preconditions: – You are joining new team with already existing project – Somebody already creates yours account in LDAP – You already generated yours SSH key – Already have Eclipse Kepler with EGit and Mylyn Gerrit connector installed 2013 Dariusz Łuksza
  • 26. 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Meet Fred
  • 27. First login into Gerrit 2013 Dariusz Łuksza First login into Gerrit 2013 Dariusz Łuksza fred Insert yours credentials here
  • 28. First login into Gerrit 2013 Dariusz Łuksza First login into Gerrit 2013 Dariusz Łuksza fred Yours SSH public key goes here, remember to click 'Add'
  • 29. First login into Gerrit 2013 Dariusz Łuksza First login into Gerrit 2013 Dariusz Łuksza fred Finally, click 'Continue'
  • 30. First login into Gerrit 2013 Dariusz Łuksza First login into Gerrit 2013 Dariusz Łuksza fred You are logged in
  • 31. Configure Mylyn Connector 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Add task repository
  • 32. Configure Mylyn Connector 2013 Dariusz Łuksza2013 Dariusz Łuksza fred If you don't have Gerrit connector on the list, use 'Install More Connectors' button Select Gerrit and click 'Next'
  • 33. Configure Mylyn Connector 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Provide server data Validate before save Finally, click 'Finish' to save new connection
  • 34. Configure Mylyn Connector 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Of course I would like to create query for this connector
  • 35. Configure Mylyn Connector 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Name the query For our simple use case 'All open changes' will be enough
  • 36. Configure Mylyn Connector 2013 Dariusz Łuksza2013 Dariusz Łuksza fred After successful configuration you will see task repository and query in proper Eclipse views
  • 37. Cloning project from Gerrit 2013 Dariusz Łuksza2013 Dariusz Łuksza fred
  • 38. Clone project from Gerrit 2013 Dariusz Łuksza2013 Dariusz Łuksza fred
  • 39. Clone project from Gerrit 2013 Dariusz Łuksza2013 Dariusz Łuksza fred
  • 40. Clone project from Gerrit 2013 Dariusz Łuksza2013 Dariusz Łuksza fred
  • 41. Clone project from Gerrit 2013 Dariusz Łuksza2013 Dariusz Łuksza fred
  • 42. Clone project from Gerrit 2013 Dariusz Łuksza2013 Dariusz Łuksza fred
  • 43. Clone project from Gerrit 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Because in git repository there is no Eclipse configuration file (like eg. .project) we need to import it as 'general project'
  • 44. Clone project from Gerrit 2013 Dariusz Łuksza2013 Dariusz Łuksza fred
  • 45. Clone project from Gerrit 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Now we can import nested Maven projects
  • 46. Clone project from Gerrit 2013 Dariusz Łuksza2013 Dariusz Łuksza fred
  • 47. Clone project from Gerrit 2013 Dariusz Łuksza2013 Dariusz Łuksza fred
  • 48. Create new feature branch 2013 Dariusz Łuksza2013 Dariusz Łuksza fred
  • 49. Create new feature branch 2013 Dariusz Łuksza2013 Dariusz Łuksza fred
  • 50. Create first change 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Change something in repository
  • 51. Create first change 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Remember to check generation of 'Change-Id' tag Leave this line as it is, EGit will generate 'Change-Id' for you
  • 52. Create first change 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Now push yours changes to Gerrit
  • 53. Create first change 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Provide name of branch to which change should be merged after successful review
  • 54. Create first change 2013 Dariusz Łuksza2013 Dariusz Łuksza fred
  • 55. Create first change 2013 Dariusz Łuksza2013 Dariusz Łuksza fred After some time you will see yours change on list of open changes
  • 56. 2013 Dariusz Łuksza2013 Dariusz Łuksza roman Meet Roman
  • 57. Review change 2013 Dariusz Łuksza2013 Dariusz Łuksza roman
  • 58. Review change 2013 Dariusz Łuksza2013 Dariusz Łuksza roman Double click on file will open a compare view
  • 59. Review change 2013 Dariusz Łuksza2013 Dariusz Łuksza roman
  • 60. Review change 2013 Dariusz Łuksza2013 Dariusz Łuksza roman You can provide comments directly for each code line
  • 61. Review change 2013 Dariusz Łuksza2013 Dariusz Łuksza roman
  • 62. Review change 2013 Dariusz Łuksza2013 Dariusz Łuksza roman
  • 63. Review change 2013 Dariusz Łuksza2013 Dariusz Łuksza roman As you see Jenkins already have an opinion about this change
  • 64. Review change 2013 Dariusz Łuksza2013 Dariusz Łuksza roman You can publish yours comments using 'Publish Comments...' button
  • 65. Review change 2013 Dariusz Łuksza2013 Dariusz Łuksza roman Now you can provide yours vote and comment for this change
  • 66. 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Switch back to Fred
  • 67. View incoming comments 2013 Dariusz Łuksza2013 Dariusz Łuksza fred You will be informed about new comments on yours reviews
  • 68. Abandon change 2013 Dariusz Łuksza2013 Dariusz Łuksza fred If you push something by accident you can always abandon such change
  • 69. Abandon change 2013 Dariusz Łuksza2013 Dariusz Łuksza fred
  • 70. 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Pushing multiple changes
  • 71. Push multiple commits 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Create two or more commits in a row and use standard EGit 'Push to Gerrit...' flow
  • 72. Push multiple commits 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Gerrit will create separate review requests for each commit
  • 73. 2013 Dariusz Łuksza2013 Dariusz Łuksza roman Switch to Roman
  • 74. Review connected changes 2013 Dariusz Łuksza2013 Dariusz Łuksza roman Of course you will see two open changes, let's review last one!
  • 75. Review connected changes 2013 Dariusz Łuksza2013 Dariusz Łuksza roman Jenkins already verified this change, so let's merge it!
  • 76. Review connected changes 2013 Dariusz Łuksza2013 Dariusz Łuksza roman
  • 77. Review connected changes 2013 Dariusz Łuksza2013 Dariusz Łuksza roman Last step is to push 'Submit' button
  • 78. Review connected changes 2013 Dariusz Łuksza2013 Dariusz Łuksza roman Change was submitted, but it is not merged because it's parent change is still under review. It will be automatically merged after parent will be accepted
  • 79. Review connected changes 2013 Dariusz Łuksza2013 Dariusz Łuksza roman Let's review second change
  • 80. Review connected changes 2013 Dariusz Łuksza2013 Dariusz Łuksza roman Let's review second change
  • 81. Review connected changes 2013 Dariusz Łuksza2013 Dariusz Łuksza roman Of course it was merged successfully
  • 82. Review connected changes 2013 Dariusz Łuksza2013 Dariusz Łuksza roman Of course it was also merged successfully Wat is going with previously submitted change?
  • 83. 2013 Dariusz Łuksza2013 Dariusz Łuksza roman Roman goes to Bahama (continue other's work)
  • 84. Continue other's work 2013 Dariusz Łuksza2013 Dariusz Łuksza fred All changes are stored in Gerrit, you can fetch each patch set version when ever you want to
  • 85. Continue other's work 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Provide meaningful branch name and click 'Finish'
  • 86. Continue other's work 2013 Dariusz Łuksza2013 Dariusz Łuksza fred Done, you have Roman's changes locally and can continue his work
  • 87. Code Review Tips ● Be constructive, don't hate, always propose or point to solution ● Don't take comments personally, they are only about code and how you can improve, code and your skills ● Code review is like refactoring of code that you have written long time ago … you need to understand author's intention ● It's like TDD, review code before it hit main repository. This will guarantee the best application quality ● Do code review on daily basis … remember when you are not reviewing other's code then application is not progressing 2013 Dariusz Łuksza
  • 88. 2013 Dariusz Łuksza Dariusz Łuksza, CollabNet dariusz@luksza.org @dluksza “Review your code like a Googler” Q&A
  • 89. 2013 Dariusz Łuksza BTW. Don't forget about DevCrowd conference in Szczecin in 2014. More info you can found at: http://devcrowd.pl

×