Books
in black and white
Main menu
Share a book About us Home
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

More Java Pitfalls Share Reactor - Daconta M,C.

Daconta M,C. More Java Pitfalls Share Reactor - Wiley publishing, 2003. - 476 p.
ISBN: 0-471-23751-5
Download (direct link): morejavapitfallssharereactor2003.pdf
Previous << 1 .. 32 33 34 35 36 37 < 38 > 39 40 41 42 43 44 .. 166 >> Next

The combination of these three open-source applications, CVS/JUnit/Bugrat, can be an effective configuration management toolset that developers can integrate with Ant to facilitate their development activities. Configuration management systems are important in that they minimize risk and promote traceability through source control, test coordination, bug tracking, and resolution. Normal CVS operations and JUnit test scripts can be embedded in Ant scripts. The BugRat tracking tool can be built or deployed by using an Ant script to place the zipped Web Archive BugRat file in your J2EE Web container. Lines 146 to 179 show how to initialize, deploy, and clean up a BugRat installation.
127 <!--
128 ********************************************************
129 ** CVS
130 *****************************************************-- >
131 <target name="cvs" description="Check out CVS files...">
132 133 <echo message="Check out CVS files..."/>
134 <cvs cvsRoot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic"
135 package="j akarta-ant"
136 dest="c:\Java_Pitfalls\Antidote\jakarta-ant-antidote" />
137 <cvs command="update -A -d"/>
138 139 </target>
140 141 <!--
142 ********************************************************
143 ** Bugrat - Bug Tracking Tool
144 *****************************************************-- >
145 146 <target name="initBugrat">
147 148 <!-- Create the time stamp -- >
149 <tstamp/>
150 <!-- Create the build directory structure used by compile -- > 2
151 <available property="haveBugrat" type="dir"
file="${destdir.bugrat}"/>
152
153 </target>
154
Listing 11.1 (continued)
Apache Ant and Lifecycle Management 93
155 <target name="prepareBugrat" depends="initBugrat">
156
157 <mkdir dir="${destdir}"/>
158
159 </target>
160
161 <target name="installBugrat" depends="prepareBugrat" 2
unless="haveBugrat">
162 <unzip src="${zip.bugrat}" dest="${destdir}"/>
163 </target>
164
165 <target name="deployBugrat" depends="installBugrat" 2
description="Install Bugrat">
166
167 <pathconvert targetos="windows" property="bugrat_home">
168 <path location="${destdir.bugrat}"/>
169 </pathconvert >
170
171 </target>
172
173 <target name="cleanBugrat">
174
175 <! Delete the ${build} and ${dist} directory trees -->
176 <delete dir="${destdir}" />
177 <! For the sake of brevity, I've omitted the SQL scripts that 2
need to be run to build the Bugrat repository. These files include: 2
defconfig.sql, defproperties.sql, examplecats.sql, and mysqlschema. sql - ->
178
179 </target>
Listing 11.1 (continued)
As in life, with software, increasing complexity leads to the natural occurrence of more problems. During software development, source code needs to be consistently reviewed to determine where code can be refactored, or rewritten, to improve efficiencies. Refactoring increases quality through design improvements and the reduction of defects. Two open-source Java utilities, JDepend and JavaNCSS, can be used within an Ant script to provide metrics so that program behaviors can be observed and improvements can be tested.
The JDepend application reads Java class and source file directories to generate metric measurements that can be used to determine software quality. Designs are more extensible when they are independent of implementation details, which allows them to adapt to new modifications without breaking the entire system. JDepend isolates program couplings to determine where dependencies lie and where migrations can occur among lower levels of software hierarchies to higher levels so that redundancies can be decreased. JavaNCSS provides noncommented source code measurements so that large, cumbersome programs can be discovered and possibly be rewritten to improve readability or performance.
Certainly, measurements from both JDepend and JavaNCSS should be used only to gauge software quality and not be deemed absolute predictors as to what needs to be performed in order to make code more efficient.
94 Item 11
181 <!--
182 ********************************************************
183 ** JDepend
184 *****************************************************__>
185 <target name="jdepend">
200 <jdepend outputfile="docs/jdepend-report.txt">
201 <sourcespath>
202 <pathelement location="./ant/src" />
203 </sourcespath>
204 <classpath location="." />
206 </j depend>
208 </target>
209 210 <!--
211 ********************************************************
212 ** JavaNCSS
213 *****************************************************-- >
214 <target name="javancss"> 2
223 <taskdef name="javancss" classname="javancss.JavancssAntTask"
classpath="${CLASSPATH}"/>
231 <javancss srcdir="./ant/src"
232 generateReport="true"
233 outputfile="j avancss_metrics.xml"
234 format="xml"/>
236 </target>
Listing 11.1 (continued)
Developers can include a splash screen target to signal that something is actually occurring during an Ant command-line build operation by adding lines 242 to 248.
Previous << 1 .. 32 33 34 35 36 37 < 38 > 39 40 41 42 43 44 .. 166 >> Next