Isn't daily commits (committing all changes before going home) an XP practice?
What are the benefits of following this?
What are the risks of not following this?
Isn't daily commits (committing all changes before going home) an XP practice?
What are the benefits of following this?
What are the risks of not following this?
Daily?? If you're following that strategy, you should commit far more often than that.
The idea is that you commit early. Commit often. Sync often. Make commits small and easy to review. Conflicts happen because 2 people are independently working on the same thing - when you work in small fast units the window to conflict becomes much smaller. And the remaining conflicts are tiny, and easy to resolve because everyone still has mental state. (As opposed to the industry standard of trying to untangle large conflicts 6 months down the line.)
The disadvantage is that you can be broken by someone else working far from you in the company. Also it makes it hard to work on branches that may or may not want to go into production. A lot of people also think that it is not a scaleable strategy - large organizations need more sophisticated practices.
I disagree with that criticism. For a reference point, at Google all changes must be peer reviewed before being committed. The average commit is less than 20 lines. Commits happen straight on the main branch. There are extensive unit tests and integration tests that automatically run before commits can finish. (With an infrastructure to make this happen acceptably fast.) The received wisdom at Google is that these practices successfully scale to Google. However if you take out any of those pieces, it wouldn't.
I think daily commits (or more) are a good software engineering practice in general, regardless of the methodology used. Some benefits (in no particular order)
Some detriments of less frequent check ins
I feel obliged to point out that "committing all changes before going home" is not necessarily something that you should do. When your mind has already called it a day, you risk breaking the build by committing something and then quickly leaving the office. Consider these questions first:
Having broken the build many enough times and having seen others do it many enough times as well, I do not commit my changes before going home if I answer "no" to any of those questions. All this being said, I'm all in favor of micro commits and committing at least hourly. Just don't commit if you've already put your coat on.
The concept of making daily (if not more often) commits comes out of the idea of Continuous Integration. The basic idea of CI is that developers should be integrating their changes several times a day, thus eliminating the historical norm of every one developing on their own for several weeks, then spending several months trying to integrate all of their different pieces. Most CI tools automate the process of building code changes and running suites of unit tests, so there is little burden on the developers.
With that as background, here are the direct answers to your questions.
What are the benefits of [committing all changes before going home]?
What are the risks of not [committing all changes before going home]?
Among many XP activities one of them is RESPECT that states:
What are the benefits of following this
You know how much work is done & how much is left to be done.
Other ppl have faster access to your code(less waiting time).
Easier to spot if a programmer is doing the task correctly.
Easier and faster code Integration.
Run Continous Integration + unit testing.