<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hello fellow Twisted maintainers,</div><div><br></div><div>There are lots of things that could be done to make contributing to Twisted easier and more fun.  I know, because people are constantly buttonholing me to tell me about how we should use this or that source hosting or continuous integration website :).  However, there's one persistent problem - in my opinion, the largest problem - that I think we could address without revving any of our technology[1] or changing our process (as documented, anyway; there are some changes to it as it is practiced).</div><div><br></div><div>That problem is perfectionism; particularly perfectionism in code reviews, but also sometimes on the part of change authors.  The "one weird trick" I am referring to in the subject is <b>trusting the process</b>, and not attempting to second-guess it or add extraneous bells and whistles to it because you're worried it may not work.</div><div><br></div><div>According to <a href="https://twistedmatrix.com/trac/wiki/ReviewProcess#Reviewers:Howtoreviewachange">our official code review process</a>, in order to be acceptable to land on trunk, a change must have:</div><div><br></div><div><ol class="MailOutline"><li>Coding-standard compliance.</li><li>Test coverage for all new or changed code.</li><li>Docstrings for new or changed code.</li><li>Narrative documentation for any new or changed user-visible features.</li><li>No backwards-incompatible changes.</li><li>A NEWS file.<br><br>I think most would agree that reviewers might also reasonably block a change for:<br><br></li><li>Exploits or other security issues introduced in any new or changed functionality, or</li><li>Performance regressions (ideally in existing benchmarks, and not in new performance criteria that the reviewer just invented!) in existing functionality.</li></ol><div><br></div><div>Maybe those last two things should be added to the official process documentation.</div><div><br></div></div><div>However, these 8 things really ought to be the only things that ought to cause a reviewer to block a change.  Right now, reviewers also routinely check for, <i>and</i> block changes for:</div><div><br></div><div><ol class="MailOutline"><li>A perfect, future-proof public API for everything new</li><li>Any un-handled use-cases</li><li>Hypothetical alternative approaches which would yield a more flexible implementation that could enable different functionality in the future</li><li>Optimal performance for new functionality</li><li>Re-factoring to use existing code if a change introduces duplication</li></ol><div><br></div></div><div>Worse yet, multiple reviewers will sometimes show up on the same ticket, demanding increasingly intricate and sometimes <i>conflicting </i>implementation improvements.  This is understandably very frustrating for the author and can make changes get stalled for long periods of time.</div><div><br></div><div>So here are some suggestions:</div><div><br></div><div>First of all, we do not have to have a perfect public API for everything all the time.  You can deprecate stuff later.  You can remove stuff later.  We have a process to do this: trust it.  Sure, it takes a release cycle or two, but that is not nearly the hardship that it seems.  Experience has taught us that realistically, neither the reviewer nor the author of a change is going to have the energy to fix up new public APIs to be perfect within the time frame of a single release cycle anyway, so you might as well have people using the pretty-good-but-not-perfect API in the meanwhile.  So if you're authoring a change that you think might have a better public API but you don't know what it is, just submit for review anyway.  If you're reviewing a change that has a public API that you think might be made better with a bunch of additional work, just approve it and ask the author to file a ticket for improving it in the future.</div><div><br></div><div>Secondly, it's OK to do a code review that isn't perfect.  I suspect that one reason so many code reviews are so nitpicky is that nobody wants to be the one to approve a change that gets reverted.  My advice here is: don't worry about it.  If you're reviewing some code, make a good-faith effort to find the issues with it according to the documented criteria, but if you don't find any problems, <i>just approve it</i>, as the process says you should.  If you make a mistake, that's why we have a process for reverting changes.  If you want another reviewer to look at it after the fact, just ask.</div><div><br></div><div>Third, code review is not just about the formal requirements; of course there can be discussion about design, API, or implementation techniques.  As a reviewer, you may notice anything in my second list, or more, and you can definitely mention it to the author of the change.  But you should mention it in a <i>clearly delineated separate section of your review feedback which you explicitly state is not required to accept the change.</i>  Always feel free to say "file a ticket for X before landing this" so that we don't lose track of improvements for the future that occur to you as you're reviewing, but don't feel like you have to block a change for any possible flaw.</div><div><i><br></i></div><div>And finally, if you <i>really</i> don't know whether you want to commit to a public API, there's always the option of putting something in a private implementation module so that it can go into a release and users can start importing it with the understanding that they typed an underscore so they're on their own with regard to compatibility guarantees :-).</div><div><br></div><div>In closing, if you can think of a review you've done in the past that asked the author to do too much work above and beyond the requirements, consider going back and amending the review to separate the required stuff from suggestions and feedback you have.</div><div><br></div><div>-glyph</div><div><br></div><div>[1]: We're also making good progress towards revving that technology, but I'll have more to say about that in a separate post.</div></body></html>