<p>In my current job the supervisor's practice is to only check in production ready code.  Most recently the project I was on involved work by 3 different developers with some file overlap.  This meant manually integrating changes despite the fact that some changes took a day and then it was done.  I wanted to see if this was a common practice and get suggestions on how to change this practice with the knowledge that many times my opinion means little in the grand scheme of things.</p>

[{'answer_id': 44631, 'author': 'Thomas Owens', 'author_id': 572, 'author_profile': 'https://Stackoverflow.com/users/572', 'pm_score': 2, 'selected': False, 'text': '<p>Code that is checked in should be unit tested, but, to me, "production ready" implies that it\'s gone through integration and system testing. You can\'t do that until a code freeze, so I don\'t see how you can do that before every check in.</p>\n'}, {'answer_id': 44642, 'author': 'Sara Chipps', 'author_id': 4140, 'author_profile': 'https://Stackoverflow.com/users/4140', 'pm_score': 0, 'selected': False, 'text': '<p>I would personally not approve of this because sometimes that\'s the best way to catch problem code with less experienced developers (by seeing it as they are working on it) and when you "check in early and often" you can rollback to earlier changes you made (as you were developing) if you decide that some changes you made earlier was actually a better idea.  </p>\n'}, {'answer_id': 44643, 'author': 'Tanj', 'author_id': 4275, 'author_profile': 'https://Stackoverflow.com/users/4275', 'pm_score': 1, 'selected': False, 'text': '<p>wouldn\'t it be a good idea to have a testing branch of the repo that can have the non "production ready code" checked in after the changes are done and tested?</p>\n\n<p>the main trunk should never have code checked in that breaks the build and doesn\'t pass unit tests, but branches don\'t have to have all those restrictions in place.</p>\n'}, {'answer_id': 44647, 'author': 'Simon Steele', 'author_id': 4591, 'author_profile': 'https://Stackoverflow.com/users/4591', 'pm_score': 3, 'selected': True, 'text': '<p>You can use various ways to handle this situation, depending on your source control system. </p>\n\n<p>Private branches: Allow you to check in and work on code while you go, merging back and forth at appropriate times.</p>\n\n<p>Shelvesets/pacakaged changesets: Allow you to store changesets and send them around for review - ensuring they\'re production ready before check in.</p>\n\n<p>As to whether this is an appropriate way to work, we don\'t allow check-in to main branches without prior review. To pass review your code must pass various automated tools, and then must be acceptable to your peer reviewer. For some definitions of "production ready" - this is it. Therefore, we do something like what you do. However, we use private branches to ensure that check-ins can still be made while this is in progress, and that other check-ins don\'t have to interfere. </p>\n\n<p>If production ready means tested in an integration environment, then it sounds like you may need staging branches or something similar.</p>\n'}, {'answer_id': 44663, 'author': 'osp70', 'author_id': 2357, 'author_profile': 'https://Stackoverflow.com/users/2357', 'pm_score': 0, 'selected': False, 'text': "<p>I think it may be the version control we user, VSS in combination with a lack of time to learn the branching.  I really like the idea of nightly check ins to help with development and avoid 'Going Dark'.  I can see him being resistant to the trunks but perhaps building a development SS and when the code is production ready move it to production SS.</p>\n"}, {'answer_id': 44666, 'author': 'tonylo', 'author_id': 4071, 'author_profile': 'https://Stackoverflow.com/users/4071', 'pm_score': 0, 'selected': False, 'text': "<p>From the practices I have seen the term production quality is used as a 'frightener' to ensure that people are scared of breaking top of tree, not a bad thing to be honest because top of tree should always work if possible.</p>\n\n<p>I would say that best practice is that you should only be merging distinct (i.e. seperate) functional components on the top of tree. If you have a significant overlap on deltas to the same source files I think this 'might' indicate that somewhere along the line the project management has broken down, and that those developers should have merged their changes to seperate integration branch before going in to the main line sources. An individual developer saying that they unit tested their stuff is irrelevant, because the thing they tested has changed!</p>\n\n<p>Trying to solve integration problems on your main line codeline will inevitably stall other unrelated submissions.</p>\n"}, {'answer_id': 44667, 'author': 'Troels Arvin', 'author_id': 4462, 'author_profile': 'https://Stackoverflow.com/users/4462', 'pm_score': 0, 'selected': False, 'text': '<p>Assuming that you are working in a centralized version control system (such as Subversion), and assuming that you have a concept of "the trunk" (where the latest well-working code lives):</p>\n\n<p>If you work on new features in "features branches"/"experimental branches", then it\'s OK to commit code which is far from finished. (When the feature is done, you commit the well-behaving result into the "trunk".)</p>\n\n<p>But you will not win a popularity contest if committing non-compiling/obviously non-working code into the "trunk" or a "release branch".</p>\n\n<p><em>The Pragmatic Programmers</em> have a book called <a href="http://www.pragprog.com/titles/svn2/pragmatic-version-control-using-subversion" rel="nofollow noreferrer"><em>Pragmatic Version Control using Subversion</em></a> which includes a section with advice about branches.</p>\n'}, {'answer_id': 44684, 'author': 'bpapa', 'author_id': 543, 'author_profile': 'https://Stackoverflow.com/users/543', 'pm_score': 0, 'selected': False, 'text': "<p>Check in early and check in often for two main reasons - </p>\n\n<p>1 - it might make it easier to integrate code</p>\n\n<p>2 - in case your computer explodes your weeks of work isn't gone</p>\n"}, {'answer_id': 44691, 'author': 'osp70', 'author_id': 2357, 'author_profile': 'https://Stackoverflow.com/users/2357', 'pm_score': 0, 'selected': False, 'text': "<p>@bpapa</p>\n\n<p>Nightly backups of work folders to servers will prevent losing more than a days work.  </p>\n\n<p>@tonyo</p>\n\n<p>Let's see the requirement documents were completed the day after we finished coding.  Does that tell you about our project management?  </p>\n\n<p>We are a small shop so while you would think change is easy there are some here that are unbending to the old ways.</p>\n"}, {'answer_id': 44919, 'author': 'axs6791', 'author_id': 3081, 'author_profile': 'https://Stackoverflow.com/users/3081', 'pm_score': 0, 'selected': False, 'text': '<p>An approach I particularly like is to have different life cycle versions in the depot. That is,for example, have a dev version of the code that is where the developers check in code that is in being worked on; then you could have a beta version, where you could add beta fixes to your code; and then a production version.  </p>\n\n<p>There is obvious overhead in this approach, such as the fact that you will have a larger workspace on you local machine, the fact that you will need need to have a migration process into place to move code from one stage to the next (which means a code freeze when doing the integration testing that goes with the migration), and that depending on the complexity of the project(s) you might need to have tools that change settings, environment variables, registry entries, etc.<br>\nAll of this is a pain to set up, but you only do it once, and once you have it all in place, makes working on different stages of the code a breeze.</p>\n'}, {'answer_id': 60879, 'author': 'Jay Bazuzi', 'author_id': 5314, 'author_profile': 'https://Stackoverflow.com/users/5314', 'pm_score': 2, 'selected': False, 'text': '<p>Start by switching away from VSS to something more reliable &amp; feature-rich.  See <a href="https://stackoverflow.com/questions/44588/how-to-convince-a-company-to-switch-their-source-control#60870">How to convince a company to switch their Source Control</a></p>\n\n<p>Then apply known-good practices:</p>\n\n<ul>\n<li><a href="http://www.codinghorror.com/blog/archives/001165.html" rel="nofollow noreferrer">Check in often</a></li>\n<li>Pick up others\' changes often, to simplify merging</li>\n<li>Use fast <a href="https://stackoverflow.com/questions/1383/what-is-unit-testing">unit tests</a> to make sure each change meets a minimum bar</li>\n<li>Require that that the checked-in code always builds, and always passes tests.</li>\n</ul>\n\n<p>Now you won\'t be "production ready" at this point: you will still need a couple weeks to test &amp; fix before you can deploy.  Getting that time down is awesome for you, and awesome for your customer, so invest in:</p>\n\n<ul>\n<li>High quality automated acceptance tests.</li>\n</ul>\n'}]
['https://Stackoverflow.com/questions/44630', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2357/']