Page 157 -
P. 157

The text between <<<<<<< .mine and ======= indicates the changes that were found in
                          the working copy. The text between ======= and >>>>>>> .r38 indicates the conflicting
                          changes that were found in r38 (see Table 7-3). It is up to the user to choose one or the
                          other of these changes. The user can also come up with a way to use both of them—for
                          example, indicating that the chopped M&Ms are optional.

                          Once the user has resolved the changes, the svn resolved command is used to indicate that
                          the conflict has been resolved:

                            $ svn resolved cookies.txt
                            Resolved conflicted state of 'cookies.txt'
                          Now Alice can commit the changes to the repository.

                          Commit the changes

                          Once the working copy has been updated and all of the conflicts have been resolved, it is
                          time to commit the changes by using svn commit. In the example above, Alice would issue
                          the following command:
                            $ svn commit -m "Updated the recipe to add nuts"
                            Sending        cookies.txt
                            Transmitting file data .
                            Committed revision 47.

                                   NOTE
                                   Additional information on version control and working with Subver-
                                   sion (including branches, tags, and setting up Apache to work with
                                   Subversion) can be found in Version Control with Subversion by Ben
                                   Collins-Sussman, Brian W. Fitzpatrick, and C. Michael Pilato (O’Reilly,
                                   2004). It can be downloaded free of charge or browsed online at http://
                                   svnbook.red-bean.com/.


                          Refactoring
                          To refactor a program is to improve the design of that program without altering its behavior. *

                          There are many different kinds of improvements—called refactorings—that can be performed.
                          Every programmer knows that there are many ways to write code to implement one spe-
                          cific behavior. There are many choices that do not affect the behavior of the software but
                          that can have an enormous impact on how easy the code is to read and understand. The
                          programmers choose variable names, decide whether certain blocks of code should be
                          pulled out into separate functions, choose among various different but syntactically equiv-
                          alent statements, and make many other choices that can have a significant impact on how
                          easy the software is to maintain.


                          * Some people have a much narrower definition of the term refactoring than we use in this chapter.
                           They use it to refer only to the specific activity of making source code smaller by taking specific
                           code paths and turning them into runtime data or structures.

                                                                                  DESIGN AND PROGRAMMING  149
   152   153   154   155   156   157   158   159   160   161   162