old-www/REF/CVS-BestPractices/html/section1-devsandbox.html

324 lines
7.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Developer Sandbox</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="CVS Best Practices"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Using GUI Tools"
HREF="section1-guitools.html"><LINK
REL="NEXT"
TITLE="CVS Server Configuration"
HREF="section1-serverconfig.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>CVS Best Practices</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="section1-guitools.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="section1-serverconfig.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="section1-devsandbox"
></A
>4. Developer Sandbox</H1
><P
>The developer <SPAN
CLASS="QUOTE"
>"sandbox"</SPAN
> is where each developer keeps his
or her working copy of the code base. In CVS this is referred to as the
working directory. This is where they build, test and debug the modules that
they are working on. A sandbox can also be the area where the staging build
or the production build is done. Changes made in the work area are checked
into the CVS repository. In addition, changes made in the repository by
others have to be updated in the sandbox on a regular basis. </P
><P
>The best practices related to developers sandbox are:
</P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="section2-clockinsync"
></A
>4.1. Keep System clocks in Sync</H2
><P
>CVS tracks change to source files by using the timestamp on the
file. If each client system date and time is not in sync, there is a
definite possibility of CVS getting confused. Thus system clocks must be
kept in sync by use of a central time server or similar mechanism.
</P
><P
>CVS is designed from ground up to handle multiple timezones. As
long as the host operating system has been setup and configured correctly,
CVS will be able to track changes correctly.
</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="section2-dontshare"
></A
>4.2. Do not share the sandbox</H2
><P
>Sandboxes have to be unique for each developer or purpose. They
should not be used for multiple things at the same time. A sandbox can be a
working area for a developer or the build area for the final release. If
such sandboxes are shared, then the owner of the sandbox will not be aware
of the changes made to the files resulting in confusion. </P
><P
>In CVS, the sandbox is created automatically when a working copy is
checked out for a CVS project using the <B
CLASS="command"
>cvs checkout
{project-name}</B
> command. </P
><P
>In very large projects, it does not make sense for the developers to
check-out the entire source into the local sandbox. In such cases, they can
take the binaries generated by the build team on a regular basis for all those
components of the application that is not changed by them and only check-out
the parts that are built by the developer. </P
><P
>For example, in a Java project, the build team can keep the results of
their last successful build in a standard location in the form of JAR files on
the network file servers. Individual developers will use a standard classpath
setup that has the network drives mounted on standard paths. Thus, the
developers will automatically get the latest version of the files as required
by them.</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="section2-syncup"
></A
>4.3. Stay in sync with the repository</H2
><P
>To gain the benefits of working within a sandbox as mentioned above,
the developer must keep his or her sandbox in sync with the main repository.
A regular <B
CLASS="command"
>cvs update</B
> with the appropriate tag or branch
name will ensure that the sandboxes are kept up to date. </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="section2-workinside"
></A
>4.4. Do not work outside the sandbox</H2
><P
>The sandbox can be thought of as a controlled area within which CVS
can track for changes made to the various source files. Files belonging to
other developers will be automatically updated by CVS in the developer's
sandbox. Thus the developer who lives within the sandbox will stand to gain
a lot of benefits of concurrent development. </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="section2-cleanupatcompletion"
></A
>4.5. Cleanup after Completion</H2
><P
>Make sure that the sandbox is cleaned up after completion of work on
the files. Cleanup can be done in CVS by using the <B
CLASS="command"
>cvs
release</B
> command. This ensures that no old version of the files
exists in the development sandbox. As explained previously, pre-built
binaries from the build team can be used to ensure that all the parts of the
application are available to the developer without the need for a complete
compilation in the sandbox. </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="section2-checkin"
></A
>4.6. Check-in Often</H2
><P
>To help other developers keep their code in sync with your code, you
must check-in your code often into the CVS repository. The best
practice would be to check-in soon as a piece of code is completed, reviewed
and tested, check-in the changes with <B
CLASS="command"
>cvs commit</B
> to
ensure that your changes are committed to the CVS repository. </P
><P
> CVS promotes concurrent development. Concurrent development is
possible only if all the other developers are aware of the ongoing changes
on a regular basis. This awareness can be termed as <SPAN
CLASS="QUOTE"
>"situation
awareness"</SPAN
> </P
><DIV
CLASS="warning"
><P
></P
><TABLE
CLASS="warning"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/warning.gif"
HSPACE="5"
ALT="Warning"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>One of the <SPAN
CLASS="QUOTE"
>"bad"</SPAN
> practices that commonly occur
is the sharing of files between developers by email. This works against
most of the best practices mentioned above. To share updates between two
developers, CVS must be used as the communication medium. This will
ensure that CVS is <SPAN
CLASS="QUOTE"
>"aware"</SPAN
> of the changes and can track
them. Thus, audit trail can be established if necessary. </P
></TD
></TR
></TABLE
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="section1-guitools.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="section1-serverconfig.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Using <SPAN
CLASS="acronym"
>GUI</SPAN
> Tools</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>CVS Server Configuration</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>