DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Kardashians of Code: The Perfect Life of Pull Request Influencers

Kardashians of Code: The Perfect Life of Pull Request Influencers

Don't fret. Just because the pull requests other developers send to your repo seem perfect doesn't mean they always were.

Stephen Connolly user avatar by
Stephen Connolly
·
Feb. 13, 19 · Opinion
Like (10)
Save
Tweet
Share
4.83K Views

Join the DZone community and get the full member experience.

Join For Free

There you are, scrolling down through your feed and you spot another one of Kim's pull requests. Oh my, it's gorgeous. Fabulous, even. The perfect beauty of it.

The first commit in the pull request is just documentation changes. I say "just," but we're talking the user-facing documentation and the support guide. Placeholders for the screenshots, too. Then there's a comment with a TODO list of the screenshots that need to be taken and updated. All the check marks are ticked, of course.

The second commit, all the test cases describing what the new feature should do, and the CI reports that commit had test failures. Naturally, because this is the true meaning of "test first."

The third commit, with its simple commit message of "Implements ELENDUR-2436" has the green checkmark of glory, reversing the red X introduced by the test cases in the second commit.

And finally, the pièce de résistance, the fourth commit replaces the placeholder screenshots with the real deal, followed, of course, with the comment "Ok, I think this is ready for review now."

You swipe right to the diff view and admire the beauty: no stray white space changes, only required imports touched, doc comments are on all the new methods, and the names of the methods, fields, and variables introduced. They are a joy to read, your eyes well up, and you type :heart: in the review comments and click approve. How could you not?


"Ok! That's enough code review for now, time to do some coding," you say to yourself, and so you turn to your work for ELENDUR-2756.

You push your changes to GitHub and open the create pull request screen...and then the depression hits.

Your pull request is a mess, twenty commits, lots of noise in the diff screen. You start to read through the pull_request_template.md checklist.

"Ok, I'll have to write some tests...damn documentation, I hate writing that..."

And finally, it dawns on you.

"I will never be as good a developer as Kim."

You've tried to write the test first, but you end up having to refactor them as you go. Kim just distilled the tests out of thin air perfectly formed, all failing until the feature landed.

Let's not even get started on documentation-first development. It sounds wonderful, the documentation describing exactly what the feature is and how it should work, but that's obviously a skill that is far beyond your abilities.

Well, I'm here to tell you: "Don't be so hard on yourself!"

All those pull request influencers cheat. You do not know how many attempts they made at implementing the feature, perhaps even hundreds of little tweaks left and right. When we look at our own development, we see the hundreds of changes we make as we try to get something working. Just like on Instagram which only shows you the photo that they decided to post and not the hundreds of deleted shots until they looked just right.

Photo credit: George Dolgikh

It doesn't stop there; once they have something working, they can then use the IDE refactoring tools to make the changes look better. Rename variables from i, j, k to something more meaningful. Extract functions and give them names that reflect their function. Write more tests. Write the documentation. These are the Instagram filters for the pull request influencers.

And now for the big open secret:

They all use git rebase to touch up their pull requests and set the stage of a compelling story.

git rebase is the Photoshop for pull requests.

Once you have that perfect story, well, then you push the first commit only and create the pull request. You can then push a commit at a time, waiting for the CI server to start building your changes. That's how the Kardashians of code create their beautiful pull requests.

So don't feel bad about yourself because your pull requests don't look perfect on your first attempt, and don't feel you have to make your pull requests look that good either.

But, it does no harm to tidy up your changes and organize them a bit better before you push...because it will help you get the changes reviewed.

Everyone can use the filters of IDE refactoring tools to make their pull requests look better, and a really ugly pull request can benefit from a fewgit rebase touch-ups. Just don't judge yourself against the one picture (out of a thousand deleted), air-brushed and carefully-staged Instagram view of a perfect life.

pull request Requests code style Commit (data management)

Published at DZone with permission of Stephen Connolly. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Agile Transformation With ChatGPT or McBoston?
  • What Is Policy-as-Code? An Introduction to Open Policy Agent
  • Why It Is Important To Have an Ownership as a DevOps Engineer
  • What Was the Question Again, ChatGPT?

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: