<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><!-- generator="wordpress/2.3.1" --><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">

<channel>
	<title>thomasknierim.com</title>
	<link>http://www.thomasknierim.com</link>
	<description>Software development with Java, Scala, and PHP</description>
	<pubDate>Sun, 08 Nov 2009 15:09:11 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/thomasknierim" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Ant script for Scala Web application</title>
		<link>http://www.thomasknierim.com/130/web-development/ant-script-for-scala-webapp/</link>
		<comments>http://www.thomasknierim.com/130/web-development/ant-script-for-scala-webapp/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 15:06:09 +0000</pubDate>
		<dc:creator>thomas</dc:creator>
		
		<category><![CDATA[Scala]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.thomasknierim.com/130/web-development/ant-script-for-scala-webapp/</guid>
		<description><![CDATA[In my last blog entry I introduced an Ant script for building a stand-alone application with Scala. Today I present a script for building a Scala web application. Just as in the last example, you can download the script and the project skeleton layout for a “Hello World” application. The difference is that this application [...]]]></description>
			<content:encoded><![CDATA[<p>In my last blog entry I introduced an Ant script for building a stand-alone application with Scala. Today I present a script for building a Scala web application. Just as in the last example, you can <a href="/code/scala-webapp-with-ant.zip">download the script and the project skeleton</a> layout for a “Hello World” application. The difference is that this application prints the infamous words on a web page rather than on the console. Things get slightly more complicated in a web application, because we need to interact with a web server to run the program. This is reflected by the Ant script below which has additional target definitions for deploying, undeploying and reloading the application on the server. I chose Tomcat for the server, because it&#8217;s a popular choice for Java web development and because Tomcat is mature, lightweight, and standards-compliant. If you use another web server, you may have to make some small modifications, but the overall structure should be the same. The script disregards web frameworks altogether and the “Hello World” application is simply implemented as a servlet. Since the file structure reflects the standard layout for a Java web application, it should be straightforward to get this to work with any Java web framework.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
</pre></td><td class="code"><pre class="xml xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;hello&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;build&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- root directory of this project --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;project.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- root directory of Scala installation --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scala.home&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;C:\\Program Files\\Scala&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- root directory of Tomcat installation --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;server.home&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;C:\\path\\to\\Tomcat\\installation&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- URL for Tomcat's manager application --&gt;</span>  
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;server.manager.url&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://dev:8080/manager&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- account name for Tomcat's admin account --&gt;</span>  
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;server.manager.username&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;admin&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- password name for Tomcat's admin account --&gt;</span>  
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;server.manager.password&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;admin&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- location of scalatest.jar for unit testing --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scalatest.jar&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;C:\\path\\to\\scalatest-1.0\\scalatest-1.0.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;init&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- derived path names --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;source.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${project.dir}/src&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;web.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${project.dir}/web&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;classes.dir&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${web.dir}/WEB-INF/classes&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;lib.dir&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${web.dir}/WEB-INF/lib&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;webapp.dir&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${server.home}/webapps/${ant.project.name}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;test.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${project.dir}/test&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- scala libraries for classpath definitions --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scala-library.jar&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${scala.home}/lib/scala-library.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scala-compiler.jar&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${scala.home}/lib/scala-compiler.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- classpath for the compiler task definition --&gt;</span>   
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;scala.classpath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${scala-compiler.jar}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${scala-library.jar}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- classpath for project build --&gt;</span>   
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;build.classpath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> </span>
<span style="color: #009900;">        <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${server.home}/lib/servlet-api.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${scala-library.jar}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${lib.dir}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;*.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${classes.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- classpath for unit test build  --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;test.classpath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">refid</span>=<span style="color: #ff0000;">&quot;build.classpath&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${scalatest.jar}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- definition for the &quot;scalac&quot; </span>
<span style="color: #808080; font-style: italic;">      and &quot;scaladoc&quot; ant tasks --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;taskdef</span> <span style="color: #000066;">resource</span>=<span style="color: #ff0000;">&quot;scala/tools/ant/antlib.xml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpath</span> <span style="color: #000066;">refid</span>=<span style="color: #ff0000;">&quot;scala.classpath&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/taskdef<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- definition for the &quot;scalatest&quot; ant task --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;taskdef</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scalatest&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">classname</span>=<span style="color: #ff0000;">&quot;org.scalatest.tools.ScalaTestTask&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpath</span> <span style="color: #000066;">refid</span>=<span style="color: #ff0000;">&quot;test.classpath&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/taskdef<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- definition for the &quot;reload&quot;, &quot;deploy&quot; </span>
<span style="color: #808080; font-style: italic;">      and &quot;undeploy&quot; Tomcat tasks --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;taskdef</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;deploy&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">classname</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.ant.DeployTask&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpath</span> </span>
<span style="color: #009900;">        <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;${server.home}/lib/catalina-ant.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/taskdef<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;taskdef</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;reload&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">classname</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.ant.ReloadTask&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpath</span> </span>
<span style="color: #009900;">        <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;${server.home}/lib/catalina-ant.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/taskdef<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;taskdef</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;undeploy&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">classname</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.ant.UndeployTask&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpath</span> </span>
<span style="color: #009900;">        <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;${server.home}/lib/catalina-ant.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/taskdef<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- compile project --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;build&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;init&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;build&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;buildnumber</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tstamp</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${classes.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${lib.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${scala-library.jar}&quot;</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${lib.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scalac</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">srcdir</span>=<span style="color: #ff0000;">&quot;${source.dir}&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">destdir</span>=<span style="color: #ff0000;">&quot;${classes.dir}&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">classpathref</span>=<span style="color: #ff0000;">&quot;build.classpath&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">force</span>=<span style="color: #ff0000;">&quot;never&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">deprecation</span>=<span style="color: #ff0000;">&quot;on&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;**/*.scala&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scalac<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- create a deployable web archive --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;war&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;build&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;war&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;war</span> <span style="color: #000066;">destfile</span>=<span style="color: #ff0000;">&quot;${project.dir}/${ant.project.name}.war&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">webxml</span>=<span style="color: #ff0000;">&quot;${web.dir}/WEB-INF/web.xml&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;${web.dir}&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- creates a deployable web archive with all classes</span>
<span style="color: #808080; font-style: italic;">    packed into a single jar file --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;packedwar&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;build&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;packedwar&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jar</span> <span style="color: #000066;">destfile</span>=<span style="color: #ff0000;">&quot;${lib.dir}/${ant.project.name}.jar&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;${classes.dir}&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">duplicate</span>=<span style="color: #ff0000;">&quot;preserve&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manifest<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;section</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Program&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;attribute</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Title&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${ant.project.name}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;attribute</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Build&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${build.number}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;attribute</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Date&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${TODAY}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/section<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/manifest<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/jar<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${classes.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;war</span> <span style="color: #000066;">destfile</span>=<span style="color: #ff0000;">&quot;${project.dir}/${ant.project.name}.war&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">webxml</span>=<span style="color: #ff0000;">&quot;${web.dir}/WEB-INF/web.xml&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;${web.dir}&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${lib.dir}/${ant.project.name}.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- deploy project on Tomcat server --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;deploy&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;war&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;deploy&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${webapp.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${webapp.dir}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${web.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;deploy</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;${server.manager.url}&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">username</span>=<span style="color: #ff0000;">&quot;${server.manager.username}&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;${server.manager.password}&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;/${ant.project.name}&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">localWar</span>=<span style="color: #ff0000;">&quot;${project.dir}/${ant.project.name}.war&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- update and reload project on Tomcat server --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;reload&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;build&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;reload&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${scala-library.jar}&quot;</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${lib.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${webapp.dir}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${web.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;reload</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;${server.manager.url}&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">username</span>=<span style="color: #ff0000;">&quot;${server.manager.username}&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;${server.manager.password}&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;/${ant.project.name}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- remove project from Tomcat server --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;undeploy&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;init&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;undeploy&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;undeploy</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;${server.manager.url}&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">username</span>=<span style="color: #ff0000;">&quot;${server.manager.username}&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;${server.manager.password}&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;/${ant.project.name}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- build unit tests --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;buildtest&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;build&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${test.dir}/build&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scalac</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">srcdir</span>=<span style="color: #ff0000;">&quot;${test.dir}&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">destdir</span>=<span style="color: #ff0000;">&quot;${test.dir}/build&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">classpathref</span>=<span style="color: #ff0000;">&quot;test.classpath&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">force</span>=<span style="color: #ff0000;">&quot;never&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">deprecation</span>=<span style="color: #ff0000;">&quot;on&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;**/*.scala&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scalac<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- run unit tests --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;test&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;buildtest&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;test&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scalatest</span> <span style="color: #000066;">runpath</span>=<span style="color: #ff0000;">&quot;${test.dir}/build&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;reporter</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;stdout&quot;</span> <span style="color: #000066;">config</span>=<span style="color: #ff0000;">&quot;YFABRT&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;membersonly</span> <span style="color: #000066;">package</span>=<span style="color: #ff0000;">&quot;suite&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- &lt;reporter type=&quot;graphic&quot; config=&quot;YFABRT&quot;/&gt; --&gt;</span>
      <span style="color: #808080; font-style: italic;">&lt;!-- &lt;suite classname=&quot;suite.TestSuite&quot;/&gt; --&gt;</span> 
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scalatest<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- delete all build files --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;clean&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;init&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;clean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${classes.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${project.dir}/doc&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${test.dir}/build&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${lib.dir}/scala-library.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${project.dir}/${ant.project.name}.war&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- create API documentation in doc folder --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scaladoc&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;build&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;scaladoc&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${project.dir}/doc&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scaladoc</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">srcdir</span>=<span style="color: #ff0000;">&quot;${source.dir}&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">destdir</span>=<span style="color: #ff0000;">&quot;${project.dir}/doc&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">classpathref</span>=<span style="color: #ff0000;">&quot;build.classpath&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">doctitle</span>=<span style="color: #ff0000;">&quot;${ant.project.name}&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">windowtitle</span>=<span style="color: #ff0000;">&quot;${ant.project.name}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>The directory structure differs slightly from that for a standalone application. We have an additional web directory for web content. It contains the WEB-INF directory where all class files and  libraries go. During development, class files are directly copied to the server without packaging. This ensures faster deploy/test cycles. In addition, there are Ant tasks for putting class files into a single jar  and for creating a distributable war file (war, packedwar). I have tried to keep the number of properties that need to be changed down to a minimum. Obviously, you need to set the home directories of your Scala, Scalatest, and Tomcat installations. You might also have to change the admin password for the Tomcat manager application which is used for automated deployment. Here is a summary of the defined targets:</p>
<ul>
<li>build = compile your webapp and put class files into the WEB-INF/classes directory.</li>
<li>war = build a deployable web archive.</li>
<li>packedwar = build a deployable web archive with all class files packed into a jar.</li>
<li>deploy = deploy your webapp on Tomcat server.</li>
<li>reload = update project files on server and reload application.</li>
<li>undeploy = remove webapp from Tomcat server.</li>
<li>test = build and run unit tests (using Scalatest).</li>
<li>clean = delete all build files.</li>
<li>scaladoc = create API documentation from sources and put it into the in ./doc directory.</li>
<li>package = create a distributable zip archive that contains all dependencies plus Scaladocs.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasknierim.com/130/web-development/ant-script-for-scala-webapp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Scala With Ant</title>
		<link>http://www.thomasknierim.com/129/scala/scala-with-ant/</link>
		<comments>http://www.thomasknierim.com/129/scala/scala-with-ant/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 02:19:42 +0000</pubDate>
		<dc:creator>thomas</dc:creator>
		
		<category><![CDATA[Scala]]></category>

		<guid isPermaLink="false">http://www.thomasknierim.com/129/scala/scala-with-ant/</guid>
		<description><![CDATA[Although Scala is tool-agnostic, the Scala community seems to have a preference for the Apache Maven build tool. I am not quite sure why. Given that most people who learn Scala come from a Java background, what could be more natural than using Ant for Scala development? As a tried-and-true build solution, Ant avoids the [...]]]></description>
			<content:encoded><![CDATA[<p>Although Scala is tool-agnostic, the Scala community seems to have a preference for the Apache Maven build tool. I am not quite sure why. Given that most people who learn Scala come from a Java background, what could be more natural than using Ant for Scala development? As a tried-and-true build solution, Ant avoids the headaches and additional learning curve that comes with an unfamiliar build tool. Although I have spent considerable time with Maven as part of my job, Maven and I haven&#8217;t become friends, and we probably never will. I won&#8217;t go into the details of the how and why. Instead I&#8217;m going to present and explain a few Ant scripts for Scala development. If you are new to Scala, I hope that this will give you a headstart with your new Scala projects. After all, you have a new language to learn and little time to bother with tools.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
</pre></td><td class="code"><pre class="xml xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;helloworld&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;run&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- root directory of this project --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;project.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- main class to run --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;main.class&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;app.HelloWorld&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- root directory of Scala installation --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scala.home&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;C:\\Program Files\\Scala&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- location of scalatest.jar for unit testing --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scalatest.jar&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;C:\\Program Files\\...\\scalatest-1.0.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;init&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- derived path names --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;build.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${project.dir}/build&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;source.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${project.dir}/src&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;test.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${project.dir}/test&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- scala libraries for classpath definitions --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scala-library.jar&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${scala.home}/lib/scala-library.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scala-compiler.jar&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${scala.home}/lib/scala-compiler.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- classpath for the compiler task definition --&gt;</span>   
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;scala.classpath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${scala-compiler.jar}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${scala-library.jar}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- classpath for project build --&gt;</span>   
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;build.classpath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${scala-library.jar}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${project.dir}/lib&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;*.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${build.dir}/classes&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- classpath for unit test build  --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;test.classpath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${scala-library.jar}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${scalatest.jar}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${build.dir}/classes&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- definition for the &quot;scalac&quot; and </span>
<span style="color: #808080; font-style: italic;">      &quot;scaladoc&quot; ant tasks --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;taskdef</span> <span style="color: #000066;">resource</span>=<span style="color: #ff0000;">&quot;scala/tools/ant/antlib.xml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpath</span> <span style="color: #000066;">refid</span>=<span style="color: #ff0000;">&quot;scala.classpath&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/taskdef<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- definition for the &quot;scalatest&quot; ant task --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;taskdef</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scalatest&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">classname</span>=<span style="color: #ff0000;">&quot;org.scalatest.tools.ScalaTestTask&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpath</span> <span style="color: #000066;">refid</span>=<span style="color: #ff0000;">&quot;test.classpath&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/taskdef<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- delete compiled files --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;clean&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;init&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;clean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${build.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${project.dir}/doc&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${project.dir}/lib/scala-library.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- compile project --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;build&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;init&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;build&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;buildnumber</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tstamp</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${build.dir}/classes&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scalac</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">srcdir</span>=<span style="color: #ff0000;">&quot;${source.dir}&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">destdir</span>=<span style="color: #ff0000;">&quot;${build.dir}/classes&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">classpathref</span>=<span style="color: #ff0000;">&quot;build.classpath&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">force</span>=<span style="color: #ff0000;">&quot;never&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">deprecation</span>=<span style="color: #ff0000;">&quot;on&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;**/*.scala&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scalac<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- run program --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;run&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;build&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;run&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;java</span> <span style="color: #000066;">classname</span>=<span style="color: #ff0000;">&quot;${main.class}&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">classpathref</span>=<span style="color: #ff0000;">&quot;build.classpath&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- build unit tests --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;buildtest&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;build&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${build.dir}/test&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scalac</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">srcdir</span>=<span style="color: #ff0000;">&quot;${test.dir}&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">destdir</span>=<span style="color: #ff0000;">&quot;${build.dir}/test&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">classpathref</span>=<span style="color: #ff0000;">&quot;test.classpath&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">force</span>=<span style="color: #ff0000;">&quot;never&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">deprecation</span>=<span style="color: #ff0000;">&quot;on&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;**/*.scala&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scalac<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- run unit tests --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;test&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;buildtest&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;test&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scalatest</span> <span style="color: #000066;">runpath</span>=<span style="color: #ff0000;">&quot;${build.dir}/test&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;reporter</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;stdout&quot;</span> <span style="color: #000066;">config</span>=<span style="color: #ff0000;">&quot;YFABRT&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;membersonly</span> <span style="color: #000066;">package</span>=<span style="color: #ff0000;">&quot;suite&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- &lt;reporter type=&quot;graphic&quot; config=&quot;YFABRT&quot;/&gt; --&gt;</span>
      <span style="color: #808080; font-style: italic;">&lt;!-- &lt;suite classname=&quot;suite.TestSuite&quot;/&gt; --&gt;</span> 
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scalatest<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- create a startable *.jar with proper </span>
<span style="color: #808080; font-style: italic;">    classpath dependency definition --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;jar&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;build&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;jar&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${build.dir}/jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${scala-library.jar}&quot;</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${project.dir}/lib&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;jar.class.path&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>		
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${project.dir}&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;lib/**/*.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathconvert</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;jar.classpath&quot;</span> <span style="color: #000066;">pathsep</span>=<span style="color: #ff0000;">&quot; &quot;</span> <span style="color: #000066;">dirsep</span>=<span style="color: #ff0000;">&quot;/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">refid</span>=<span style="color: #ff0000;">&quot;jar.class.path&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;map</span> <span style="color: #000066;">from</span>=<span style="color: #ff0000;">&quot;${basedir}${file.separator}lib&quot;</span> <span style="color: #000066;">to</span>=<span style="color: #ff0000;">&quot;lib&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>		
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pathconvert<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jar</span> <span style="color: #000066;">destfile</span>=<span style="color: #ff0000;">&quot;${build.dir}/jar/${ant.project.name}.jar&quot;</span> </span>
<span style="color: #009900;">         <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;${build.dir}/classes&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">duplicate</span>=<span style="color: #ff0000;">&quot;preserve&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manifest<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;attribute</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Main-Class&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${main.class}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;attribute</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Class-Path&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${jar.classpath}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;section</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Program&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;attribute</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Title&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${ant.project.name}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;attribute</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Build&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${build.number}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;attribute</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Date&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${TODAY}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/section<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/manifest<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/jar<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- create API documentation in doc folder --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scaladoc&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;build&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;scaladoc&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${project.dir}/doc&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scaladoc</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">srcdir</span>=<span style="color: #ff0000;">&quot;${source.dir}&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">destdir</span>=<span style="color: #ff0000;">&quot;${project.dir}/doc&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">classpathref</span>=<span style="color: #ff0000;">&quot;build.classpath&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">doctitle</span>=<span style="color: #ff0000;">&quot;${ant.project.name}&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">windowtitle</span>=<span style="color: #ff0000;">&quot;${ant.project.name}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- create a zip file with binaries for distribution --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;package&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;jar, scaladoc&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;package&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;zip</span> <span style="color: #000066;">destfile</span>=<span style="color: #ff0000;">&quot;${build.dir}/${ant.project.name}.zip&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;zipfileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${build.dir}/jar&quot;</span> </span>
<span style="color: #009900;">        <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;${ant.project.name}.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;zipfileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${project.dir}&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;lib/*&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;zipfileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${project.dir}&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;doc/*&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;zipfileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${project.dir}/txt&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;*&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/zip<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><a href="/code/scala-with-ant.zip">Download &#8220;helloworld.scala&#8221; with Ant build file</a>.</p>
<p>Fortunately, the designers of Scala provided built-in Ant tasks in the compiler library, which makes the integration of Ant straightforward. The XML code above shows the build.xml for a typical Scala standalone application, such as a GUI program or a console application. It is reasonably complete and it provides Ant targets for all common tasks:</p>
<ul>
<li>build = compile your project and put class files into the ./build directory.</li>
<li>run = run program.</li>
<li>jar = create a startable jar archive from class files.</li>
<li>test = build and run unit tests (using Scalatest).</li>
<li>scaladoc = create API documentation from sources and put it into the in ./doc directory.</li>
<li>package = create a distributable zip archive that contains all dependencies plus Scaladocs.</li>
</ul>
<p>The directory tree is kept as simple as possible:</p>
<div style="clear:both"><img src="http://www.thomasknierim.com/wp-content/uploads/2009/10/ant-skeleton-standalone.png" alt="Scala Project Skeleton" /></div>
<ul>
<li>build - temporary directory for class files and other binaries</li>
<li>lib - contains external dependencies (*.jar files)</li>
<li>src - contains Scala source code tree</li>
<li>test - contains Scala unit tests</li>
<li>txt - contains files (such as license text) that are  packaged with the distributable zip archive</li>
</ul>
<p>If your project depends on external jars, all you have to do is to drop these into the ./lib folder. Ant will take care of creating appropriate class paths, entering them into the manifest of the startable jar file, and including them in the distribution package. The Scala library is packed automatically so that the resulting package can be deployed on computers that don&#8217;t have Scala installed (only a standard JRE is required). To use this Ant script on your computer, you need to change the values of the scala.home and scalatest.jar properties to match the location of your Scala and Scalatest installations (never mind the latter if you use another unit testing framework). If you are working in a team, it is good practice to put Ant properties into a separate properties file, so that the build file can be checked into a source code management tool. I have included them here for simplicity.</p>
<p>One of the advantages of using Ant is that it has very good integration with IDEs, such as Eclipse. The only twist is that Eclipse does not honour the classpaths defined in build.xml for its own incremental compilation process used to mark syntactical errors. Thus if you import the Ant project into Eclipse, you have to tell Eclipse about the dependencies using the Project/Properties/Java Build Path option.</p>
<p><img src="http://www.thomasknierim.com/wp-content/uploads/2009/10/ant-in-eclipse.png" alt="Ant in Eclipse" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasknierim.com/129/scala/scala-with-ant/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Frameworkless Architecture</title>
		<link>http://www.thomasknierim.com/126/web-development/frameworkless-architecture/</link>
		<comments>http://www.thomasknierim.com/126/web-development/frameworkless-architecture/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 06:23:28 +0000</pubDate>
		<dc:creator>thomas</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.thomasknierim.com/126/web-development/frameworkless-architecture/</guid>
		<description><![CDATA[Perhaps suggesting to eschew web frameworks for web application development is playing the devil&#8217;s advocate. Perhaps it is even foolish. To renounce the productivity boost one gets with a properly designed framework does not sound like sensible advice. Only ignorant script kiddies entertain such ideas. Well, for the most part that is true. A web [...]]]></description>
			<content:encoded><![CDATA[<p>Perhaps suggesting to eschew web frameworks for web application development is playing the devil&#8217;s advocate. Perhaps it is even foolish. To renounce the productivity boost one gets with a properly designed framework does not sound like sensible advice. Only ignorant script kiddies entertain such ideas. Well, for the most part that is true. A web framework does indeed simplify application development if it is chosen well. It does even more if it is designed well. It can provide architectural support for building maintainable applications. It can help with the plumbing and provide conceptual structure to guide the development process.</p>
<p>So, what speaks against using a web framework? Plenty actually, especially at the lower end of the spectrum and especially with dynamic languages. The main problem with web frameworks is that they add overhead. This means that the added functionality and structure is bought at the cost of performance degradation. The graveness of this problem depends on the system architecture. One  needs to keep in mind, that dynamic languages are interpreted at runtime, which makes them CPU-intensive and relatively slow. Because the life cycle of a script is essentially stateless and single-step, classes and data structures need to be rebuild and reloaded (in theory) at each request. In practice, this does not happen, because servers are designed to provide at least rudimentary caching. However, the runtime performance of interpreted languages is typically several magnitudes smaller than that of a compiled language, which magnifies the problem.</p>
<p>To illustrate my point, consider these <a href="http://paul-m-jones.com/?p=315" target="_blank">benchmarks for PHP frameworks</a> kindly provided by Paul M. Jones. According to these figures, a trivial PHP page is served by Apache 2 at a performance reduction of 43% compared to static HTML. The use of various PHP web frameworks further reduces performance by 85% - 95% compared to a PHP page that merely echoes content. Although it can be expected that these figures develop inverse logarithmically with increasing application code complexity, the slowdown is significant. PHP offers a number of remedies, such as  opcode caching, object caching, and products such as Zend Server, APC, and MCache, yet performance is unlikely to get even close to that of a compiled language.</p>
<p>Furthermore, there is the question whether the complexity of the project justifies the complexity introduced by a web framework. Would you use a web framework for building a guestbook script? Probably  not. What about a blog software? A photo gallery? A bulletin board? These types of applications are the mainstay of dynamic languages, such as PHP. It is the area where PHP really shines. Think of Wordpress, phpBB, Mediawiki, Drupal, osCommerce, Coppermine and other popular applications. They all have one thing in common: they don&#8217;t use a framework. Hence, before choosing a web framework for PHP development, it may be worth pondering if any is required. This suggestion may sound a bit contradictory, having just reviewed the Zend framework in a previous article. However, in my own practice I haven&#8217;t come across many complex PHP projects.</p>
<p>The commercial PHP projects I worked on during the last 10 years can roughly be divided into three categories: 1. extensions and customisations of open source packages, 2. intranet information systems, and 3. e-commerce systems and “catalogware”. Although the latter two may be considered candidates for web frameworks, the size of these projects was almost always small enough to do without. On several occasions, I chose to implement an “ultralight” MVC architecture by hand instead of using an out-of-the-box framework. The main reason for this was again performance. The “ultralight” approach is defined by implementing only the required functionality, which results in highly specialised design. In practice, this means slimming the controller, reducing DB abstraction to a thin wrapper around the native library, and foregoing a templating system in favour of embedded PHP.</p>
<p>The advantage of this approach is that you get separation of presentation and business logic, componentisation, and customisable control flow without the performance cost of full-blown framework. The disadvantage is that it is slightly more laborious to implement and less flexible. Don&#8217;t get me wrong. I have no problems imagining scenarios where I would want to use a PHP web framework such as the Zend framework. However, in these cases I&#8217;d probably be drawn towards using Java or (hopefully) Scala in the first place. In summary, I have found myself using PHP mostly in situations where a web framework seemed dispensable, while I have been using Java mostly in situations where a web framework seemed essential.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasknierim.com/126/web-development/frameworkless-architecture/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Scala Job Market</title>
		<link>http://www.thomasknierim.com/123/scala/scala-job-market/</link>
		<comments>http://www.thomasknierim.com/123/scala/scala-job-market/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 13:19:10 +0000</pubDate>
		<dc:creator>thomas</dc:creator>
		
		<category><![CDATA[Scala]]></category>

		<category><![CDATA[Scala job market IT employment developer work]]></category>

		<guid isPermaLink="false">http://www.thomasknierim.com/123/scala/scala-job-market/</guid>
		<description><![CDATA[Is there such a thing as a Scala job market? According to my sporadic research during this month, not really. A quick keyword search for “Scala” on monster.com came up with 14 listings in the US, 1 listing in the UK, 4 in Germany and 1 in India. In addition, I found 2 listings on [...]]]></description>
			<content:encoded><![CDATA[<p>Is there such a thing as a Scala job market? According to my sporadic research during this month, not really. A quick keyword search for “Scala” on monster.com came up with 14 listings in the US, 1 listing in the UK, 4 in Germany and 1 in India. In addition, I found 2 listings on javajobs.net and 2 on technojobs.co.uk. Most employers in these listings don&#8217;t hire people for Scala development, but the job ad says something like “&#8230;knowledge of a second JVM language, such as Scala, etc. is advantageous&#8230;” Freelancer markets like elancer.com, rentacoder.com, etc. show a similar picture. There are virtually no bids for Scala programmers at this time. On elance.com you can find 19 people who offer Scala development services (compared to roughly 11,000 Java programmers); on the German gulp.de site there are 30 Scala programmers (compared to roughly 12,000 Java programmers).</p>
<p>The Scala job statistics published today at www.itjobswatch.co.uk does not look all that promising either. Scala skills are requested only in 0.025 % of all IT Jobs, however, this number has grown tenfold since last year.</p>
<p><img src="http://www.thomasknierim.com/wp-content/uploads/2009/09/scala-uk-job-market.png" alt="Scala Job Market (UK)" /><br />
<br clear="all"/>Source: <a href="http://www.itjobswatch.co.uk/jobs/uk/scala.do" target="_blank">http://www.itjobswatch.co.uk/jobs/uk/scala.do</a></p>
<p>So what does this tell us?</p>
<p>If you program in Scala, you must be either an academic, a hobbyist, or a programmer with too much leisure time. Currently, there is no significant demand for Scala professionals. But this might change. The Java community has received Scala quite positively so far and the language has a rapidly growing fan base. There are several high-profile websites that have recently begun development efforts in Scala, notably Twitter and LinkedIn. There are also a number of large-scale commercial projects in Scala being started recently. Martin Odersky, the creator of Scala, is quite upbeat about the commercial future of Scala. In this talk, given at LinkedIn earlier this summer, he outlines his vision for the near future of Scala. He also mentions a number of companies that have taken up projects in Scala, among them Ebay, LinkedIn, NatureNews, OfficeDepot, SAIC, Siemens, Sony, Twitter and Xerox.</p>
<p><object width="425" height="344"></object></p>
<param name="movie" value="http://www.youtube.com/v/J85F2C13r4Q&amp;rel=0&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;feature=player_embedded&amp;fs=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/J85F2C13r4Q&amp;rel=0&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;feature=player_embedded&amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="425" height="344"></embed><object width="425" height="344"></object></p>
<param name="movie" value="http://www.youtube.com/v/9Hen_0HS5Ic&amp;rel=0&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;feature=player_embedded&amp;fs=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/9Hen_0HS5Ic&amp;rel=0&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;feature=player_embedded&amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="425" height="344"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasknierim.com/123/scala/scala-job-market/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Zend Framework Review</title>
		<link>http://www.thomasknierim.com/120/php/zend-framework/</link>
		<comments>http://www.thomasknierim.com/120/php/zend-framework/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 03:11:39 +0000</pubDate>
		<dc:creator>thomas</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[components]]></category>

		<category><![CDATA[controller]]></category>

		<category><![CDATA[development]]></category>

		<category><![CDATA[framework]]></category>

		<category><![CDATA[library]]></category>

		<category><![CDATA[model]]></category>

		<category><![CDATA[MVC]]></category>

		<category><![CDATA[view]]></category>

		<category><![CDATA[web]]></category>

		<category><![CDATA[Zend]]></category>

		<category><![CDATA[ZF Framework]]></category>

		<guid isPermaLink="false">http://www.thomasknierim.com/120/php/zend-framework/</guid>
		<description><![CDATA[Earlier this week, I gave the latest version of the Zend Framework v-1.9.2 another test drive. I had previously dabbled in v-1.7.4 as well as a pre-1.0 incarnation of the framework. I will not repeat listing the whole breadth of its functionality here, since you can find this elsewhere on the Internet. Neither will I [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.thomasknierim.com/wp-content/uploads/2009/09/zend-framework.gif" alt="zend-framework.gif" />Earlier this week, I gave the latest version of the Zend Framework v-1.9.2 another test drive. I had previously dabbled in v-1.7.4 as well as a pre-1.0 incarnation of the framework. I will not repeat listing the whole breadth of its functionality here, since you can find this elsewhere on the Internet. Neither will I present a point-by-point analysis, just the salient points, short and sweet, which you can expect to be coloured by my personal view. Suffice to say that the ZF (Zend Famework) is based on MVC -you&#8217;d never guessed- and it provides functionality for database access, authentication and access control, form processing, validation, I/O filtering, web services access, and a bunch of other things you would expect from a web framework.</p>
<p>The first thing to notice is that the framework has grown up and I mean this quite literally from a few megabytes in its early days to a whopping 109 MB (unzipped) distribution package. Only about 21 MB are used by the framework itself; the rest contains demos, tests, and&#8230; the dojo toolkit&#8230; an old acquaintance, which is optional. The documentation for the ZF was excellent right from the beginning and it has staid that way. Included is a 1170-pages PDF file, which also bears testimony to the growing size and complexity of the framework. Gone are the days when one could hack together a web application without reading a manual.</p>
<p>One of the first things to realise is that ZF is glue-framework rather than a full-stack framework. This means, it feels more like a library or a toolkit. ZF does not prescribe architecture and programming idioms like many other web frameworks do. This appears to fit the PHP culture well, though it must be mentioned that most ZF idioms come highly recommended, since they represent best OO practices. Another thing that catches the eye is the lack of an ORM component, which may likewise be rooted in traditional PHP culture. If you want object mapping, you would have to code around ZF&#8217;s DB abstraction and use Doctrine, Propel, or something similar. Let&#8217;s get started with this item.</p>
<p><font color="#ff9900"><strong>Database Persistence</strong></font><br />
ZF provides a number of classes for DB abstraction. Zend_Db_Table implements a table data gateway using reflection and DB metadata. You only need to define table names and primary keys. Zend_Db_Adapter, Zend_Db_Statement and Zend_Db_Select provide database abstraction and let you create DB-independent queries and SQL statements in an object oriented manner. However, as you are dealing directly with the DB backend, all your data definitions go into the DB rather than into objects. Although this matches with the traditional PHP approach, it means that you need to create schemas by hand, which may irritate people who have been using ORM layers, like Hibernate, for years. On the other hand, a full-blown ORM layer likely incurs a significant performance cost in PHP, so maybe the ZF approach is sane.</p>
<p><strong><font color="#ff9900">Fat Controller</font></strong><br />
Like many other frameworks, ZF puts a lot of application logic into the controller, and this is my main gripe with the ZF. It seems to be the result of the idea that the “model” should concern itself only with shovelling data from the DB into the application and vice versa. A case in point is the coupling between Zend_Form and validation. This leaves you no option, but to put both into the controller. I think that data validation logically belongs to the model, while form generation logically belongs to the view. If you pull this into the middle, it will not only bulge the controller, but it is likely to lead to repetition of validation logic in the long run. That&#8217;s why I love slim controllers. Ideally, a controller should do nothing but filtering, URL rewriting, dispatching, and error processing.</p>
<p><font color="#ff9900"><strong>MVC Implementation</strong></font><br />
Having mentioned coupling, it would do ZF injustice to say that things are tightly coupled. Actually, the opposite is the case, as even the MVC implementation is loosely coupled. At the heart you find the Zend_Controller_Front class which is set up to intercept all requests to dynamic content via URL rewriting. The rewriting mechanism also allows user-friendly and SEO-friendly URLs. The front controller dispatches to custom action controllers implemented via Zend_Controller_Action; if non-standard dispatching is required this can be achieved by implementing a custom router interface with special URL inference rules. The Zend_Controller_Action is aptly named, because that&#8217;s where the action is, i.e. where the application accesses the model and does its magic. The controller structure provides hooks and interfaces for the realisation of a plugin architecture.</p>
<p><strong><font color="#ff9900">Views</font></strong><br />
Views are *.phtml files that contain HTML interspersed with plenty of display code contained in the traditional &lt;? ?&gt; tags. It should be possible to edit *.phtml files with a standard HTML editor. The Zend_View class is a thin object from which View files pull display data. View fragments are stitched together with the traditional PHP require() or with layouts. It is also possible to use a 3rd party templating system. Given the &lt;? ?&gt;, there is little to prevent application logic from creeping into the view, except reminding developers that this is an abominable practice punishable by public ridicule.</p>
<p><strong><font color="#ff9900">Layouts</font></strong><br />
Layouts are a view abstraction. They enable you to arrange the logical structure of page layouts into neat and clean XML. These layouts are then transformed into suitable output (meaning HTML in most cases). As you can probably infer, this takes a second parsing step inside the PHP application, which is somewhat unfortunate, since PHP itself already parses view components. While layouts are optional, they are definitely nice to have. I think it&#8217;s probably the best a framework can do given the language limitations of PHP, which only understands the &lt;?php&gt; tag. If the XML capabilities of PHP itself would be extended to process namespaced tags like &lt;php:something&gt;, then one could easily create custom tags and the need for performance-eating 2-step processing would probably evaporate. Ah, wouldn&#8217;t it be nice?</p>
<p><font color="#ff9900"><strong>Ajax Support</strong></font><br />
ZF does not include its own Javascript toolkit or set of widgets, but it comes bundled with Dojo and it offers JSON support. The Zend_Json class provides super-simple PHP object serialisation and deserialisation from/to JSON. It can also translate XML to JSON. The Zend_Dojo class provides an interface to the Dojo toolkit and makes Dojo&#8217;s widgets (called dijits) play nicely with Zend_Forms. Of course, you are free to use any other Ajax toolkit instead of Dojo, such as YUI, jQuery, or Prototype.</p>
<p><font color="#ff9900"><strong>Flexibility</strong></font><br />
As mentioned, ZF is very flexible. It&#8217;s sort of loosely coupled at the design level, which is both a blessing and a curse. It&#8217;s a blessing, because it puts few restrictions on application architecture, and it&#8217;s a curse, because it creates gaps for code to fall through. A case in point is dependency injection ala Spring. In short, there isn&#8217;t much in the way of dependency management, apart from general OO practices of course. Nothing keeps programmers from having dependencies floating around in global space or in the registry. A slightly more rigid approach that enforces inversion of control when wiring together the Zend components would  probably not have hurt.</p>
<p><strong><font color="#ff9900">Overall Impression</font></strong><br />
My overall impression of the ZF is very good. It is a comprehensive and well-designed framework for PHP web applications. What I like best about it that it offers a 100% object-oriented API that looks very clean and makes extensive use of best OO practices, such as open/closed principle, programming to interfaces, composition over inheritance, and standard design patterns. The API is easy to read and understand. The internals of its implementation likewise make a good impression. The code looks clean and well structured, which is quite a nice change from PHP legacy code. ZF still involves a non-trivial learning curve because of its size. I&#8217;ve only had time to look into the key aspects, and didn&#8217;t get around to try out more specialised features like Zend_Captcha, Zend_Gdata, Zend_Pdf, Zend_Soap, and web services, and all the other features that ZF offers to web developers. If I had to choose a framework for a new web application, ZF would definitely be among the top contenders.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasknierim.com/120/php/zend-framework/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Performance: Java vs. PHP vs. Scala</title>
		<link>http://www.thomasknierim.com/119/java/performance-java-vs-php-vs-scala/</link>
		<comments>http://www.thomasknierim.com/119/java/performance-java-vs-php-vs-scala/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 08:56:58 +0000</pubDate>
		<dc:creator>thomas</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Scala]]></category>

		<guid isPermaLink="false">http://www.thomasknierim.com/119/java/performance-java-vs-php-vs-scala/</guid>
		<description><![CDATA[The topic of performance of specific programming languages has provided material for endless debates among developers. Proponents of a certain language often cite examples that show their chosen language in a particularly good light. For example, I have come across the claim that PHP and Ruby are performing just as well as Java. Often these [...]]]></description>
			<content:encoded><![CDATA[<p>The topic of performance of specific programming languages has provided material for endless debates among developers. Proponents of a certain language often cite examples that show their chosen language in a particularly good light. For example, I have come across the claim that PHP and Ruby are performing just as well as Java. Often these claims are supported by nothing but a firm tone of voice and a stern mien. Thankfully, we have benchmarks. A playful yet credible approach to performance measurement was taken by <a href="http://shootout.alioth.debian.org/" target="_blank">this website</a>.</p>
<p>It contains an array of typical benchmark algorithms implemented in 35 popular (and not so popular) programming languages all running on various Linux servers. There are many complexities involved in measuring programming languages execution speed. The web development arena adds even more complexities. Much depends not only on how the algorithms are implemented, but also on how the compiler and the server are configured. For example, there are different JVMs, there are script caches, accelerators, server tunings, and what not. The languages I&#8217;d like to compare here are Java, Scala, and PHP. You will find comparison graphs for each of these below.</p>
<p>Three charts:</p>
<p>1. Java vs. PHP<br />
2. Scala vs. PHP<br />
3. Scala vs. Java</p>
<p><img src="http://www.thomasknierim.com/wp-content/uploads/2009/09/benchmarks2.png" alt="Java, Scala, PHP Benchmarks" /><br />
Three bar groups:</p>
<p>1. Execution time<br />
2. Memory use<br />
3. Size of source code</p>
<p>Bar pointing down means: faster performance, lower memory usage, and reduced source size.</p>
<p>Basically, these charts confirm what experienced programmers already know. Both, Java and Scala outperform PHP by several magnitudes. To be precise, Java and Scala execute 28 times faster on average. The performance of Java and Scala is similar, which has to be expected since both languages run on the Java virtual machine. Java gives slightly better performance in some algorithms while its memory requirements are lower. For PHP fans who find these benchmarks disappointing, there is some consolation. PHP appears to be less of a memory hogger, and perhaps more importantly, it performs quite favorably when compared to other dynamic interpreted languages, such as Perl, and Ruby.</p>
<p>You can compare more language benchmarks yourself at the following URL: <a href="http://shootout.alioth.debian.org/u64q/benchmark.php" target="_blank">http://shootout.alioth.debian.org/u64q/benchmark.php</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasknierim.com/119/java/performance-java-vs-php-vs-scala/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Galileo Troubles</title>
		<link>http://www.thomasknierim.com/116/open-source/galileo-troubles/</link>
		<comments>http://www.thomasknierim.com/116/open-source/galileo-troubles/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 01:52:28 +0000</pubDate>
		<dc:creator>thomas</dc:creator>
		
		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[Eclipse]]></category>

		<category><![CDATA[error]]></category>

		<category><![CDATA[Galileo]]></category>

		<category><![CDATA[installation]]></category>

		<category><![CDATA[PDT]]></category>

		<category><![CDATA[trouble]]></category>

		<category><![CDATA[WTP]]></category>

		<guid isPermaLink="false">http://www.thomasknierim.com/116/open-source/galileo-troubles/</guid>
		<description><![CDATA[Another year has passed in the Eclipse universe, and this means another minor release number and another Jupiter moon. Eclipse has moved from 3.4 to 3.5 or respectively from Ganymede to Galileo. Using a small gap in my busy development schedule, I decided to install the latest version this morning. Thanks to broadband Internet, the [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-bottom: 0in"><img src="http://www.thomasknierim.com/wp-content/uploads/2009/09/eclipse-galileo.jpg" alt="Eclipse Galileo" />Another year has passed in the Eclipse universe, and this means another minor release number and another Jupiter moon. Eclipse has moved from 3.4 to 3.5 or respectively from Ganymede to Galileo. Using a small gap in my busy development schedule, I decided to install the latest version this morning. Thanks to broadband Internet, the 180 MB JEE package was downloaded in a breeze and installed in a few minutes. Unfortunately, that&#8217;s where things stopped being easy.</p>
<p style="margin-bottom: 0in">When I downloaded the PDT plugin for PHP development, I found a bug in it that prevented Eclipse from creating a PHP project from existing sources. After some research on the Internet, I found that this was a well-documented bug which had been fixed in the meantime. I tried installing the latest PDT release via the Eclipse install &amp; update feature, but the process came to a crashing halt with a message that demanded some mylyn jars that could not be found. Although I had no idea why PDT required that particular jar, I dutifully installed the mylyn plugins with the required version number.</p>
<p style="margin-bottom: 0in">Unfortunately, this did not impress Galileo, as it now demanded other jars when installing the PDT update. - Perhaps a case of workspace pollution, I thought. - Clearly, it was time for a fresh start. I scrapped the installation and started anew with a blank workspace and a new install location. This time, everything seemed to install fine. I was able to create Java and PHP projects. However, Galileo suddenly wouldn&#8217;t open *.xml, *.xsl, or *.html files any more. It complained that there was no editor for this content type, which appeared fishy since both web tools (WTP) and PDT were installed. I tried to solve the problem by playing around with the configuration, but to no avail.</p>
<p style="margin-bottom: 0in">After several fresh attempts and considerable time spent with looking up error messages on the Internet, I decided to stay with Ganymede. Since I had wasted my entire morning and since I had some real work to do as well, this seemed to be the best course of action. Maybe I will give Galileo another go when an updated distro package becomes available. With Ganymede I never ran into this sort of trouble, despite having PDT, WTP, the Scala plugin and Jboss tools installed. I am still clueless as to what went wrong and I wonder if anybody else had a similar experience.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasknierim.com/116/open-source/galileo-troubles/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Naming Conventions (3)</title>
		<link>http://www.thomasknierim.com/117/software-engineering/naming-conventions-3/</link>
		<comments>http://www.thomasknierim.com/117/software-engineering/naming-conventions-3/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 13:02:02 +0000</pubDate>
		<dc:creator>thomas</dc:creator>
		
		<category><![CDATA[Software Engineering]]></category>

		<category><![CDATA[best practices]]></category>

		<category><![CDATA[class names]]></category>

		<category><![CDATA[identifier]]></category>

		<category><![CDATA[method names]]></category>

		<category><![CDATA[naming conventions]]></category>

		<guid isPermaLink="false">http://www.thomasknierim.com/117/software-engineering/naming-conventions-3/</guid>
		<description><![CDATA[Today I am going to talk about best practices in identifier naming. Before thinking about concrete strategies for devising identifier names, one should answer the following three questions: 1. What (human) language to use. 2. Whether to use a naming scheme or not. 3. How platform and language choices affect identifier naming. While I generally [...]]]></description>
			<content:encoded><![CDATA[<p>Today I am going to talk about best practices in identifier naming. Before thinking about concrete strategies for devising identifier names, one should answer the following three questions: 1. What (human) language to use. 2. Whether to use a naming scheme or not. 3. How platform and language choices affect identifier naming. While I generally don&#8217;t like to use naming schemes for the reasons mentioned in the last article, it&#8217;s almost always a good idea to adopt existing conventions for the specific platform, language and domain one is working in. Certain languages have established strong conventions about how identifiers are formed. For example, nothing keeps you from assigning lower-case names to classes in Java, but it surely raises eyebrows among Java programmers. Likewise, Java enthusiasts would probably look down their noses at code that uses underscores instead of lower CamelCase. Other programming languages, like PHP or Perl, have less strict conventions for identifier names. Whatever the case may be, it&#8217;s invariably useful to honour  widely used conventions and apply them consistently, as it avoids misunderstandings and thus reduces the chance for errors.</p>
<p>Apart from consistency and conventions, the most important point to get right is semantic precision. The identifier name should be stated as clearly and as intelligible as possible, without being overly wordy. Ambiguity is the greatest enemy here, especially when there are several identifiers floating around that have similar, yet subtly different meanings. Consider the following example:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Event</span> event<span style="color: #339933;">:</span> events<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  trainees <span style="color: #339933;">+=</span> event.<span style="color: #006633;">trainees</span>.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">status</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;&amp;</span> event.<span style="color: #006633;">end</span> <span style="color: #339933;">&gt;=</span> time<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Person train <span style="color: #339933;">:</span> event.<span style="color: #006633;">trainees</span><span style="color: #009900;">&#41;</span>
      <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>train.<span style="color: #006633;">passed</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        trainee.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>train<span style="color: #009900;">&#41;</span>;
        trained++;
     <span style="color: #009900;">&#125;</span>
     <span style="color: #000000; font-weight: bold;">else</span> training.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>train<span style="color: #009900;">&#41;</span>;
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">status</span> <span style="color: #339933;">==</span> 0 || event.<span style="color: #006633;">end</span> <span style="color: #339933;">&lt;</span> time<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    training.<span style="color: #006633;">addAll</span><span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">trainees</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This code looks convoluted because of the overuse of the word “train”. What it does is this: it iterates over all workshop events and creates a collection of trainees that have successfully completed a workshop and another of trainees that did not complete a workshop or are still being trained. It also counts the total number of trainees and the number of successful ones. Apart from the ambiguous “train&#8230;”, readability suffers because of non-descriptive variable names and the use of constant integer literals. Here is a more readable version:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Event</span> workshop<span style="color: #339933;">:</span> allWorkshops<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  numOfTrainees <span style="color: #339933;">+=</span> workshop.<span style="color: #006633;">trainees</span>.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>workshop.<span style="color: #006633;">status</span> <span style="color: #339933;">==</span> COMPLETED <span style="color: #339933;">&amp;&amp;</span> workshop.<span style="color: #006633;">end</span> <span style="color: #339933;">&gt;=</span> today<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Person trainee <span style="color: #339933;">:</span> workshop.<span style="color: #006633;">trainees</span><span style="color: #009900;">&#41;</span>
      <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>trainee.<span style="color: #006633;">passed</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        graduates.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>trainee<span style="color: #009900;">&#41;</span>;
        numOfGraduates++;
     <span style="color: #009900;">&#125;</span>
     <span style="color: #000000; font-weight: bold;">else</span> peopleInTraining.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>trainee<span style="color: #009900;">&#41;</span>;
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>workshop.<span style="color: #006633;">status</span> <span style="color: #339933;">==</span> CANCELLED || workshop.<span style="color: #006633;">end</span> <span style="color: #339933;">&lt;</span> today<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    peopleInTraining.<span style="color: #006633;">addAll</span><span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">trainees</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This brief example shows how to transform an ambiguous piece of code into one that can be read and understood quite easily. The question is: what are the underlying principles? Unfortunately, the answer to this question is complicated. Rather than attempting an analysis, I suggest to look at existing best practices that are widely adopted. Steven McConnel describes such a set of practices in his acclaimed book <em>Code Complete (2nd Edition)</em> in Chapter 11, <em>The Power Of Variable Names</em>. He writes: “An effective technique for coming up with a good name is to state in words what the variable represents. Often that statement itself is the best variable name. It’s easy to read because it doesn’t contain cryptic abbreviations, and it’s unambiguous.” In the remainder of this article, I will try to present a summary of Steve McConnell&#8217;s set of best practices.</p>
<p>Describe the “what”, not the “how”. A good identifier name relates to the problem domain rather than to the solution approach or algorithm. For example, the name <em>tmpStateArray </em>might hold an array of communication states of different chat users in a chat application. The name is clearly computerish and algorithm-oriented; a better name would probably be <em>chatStates </em>or <em>communicationStates</em>. Likewise, names such as <em>bitFlag</em>, <em>statusFlag</em>, <em>optionString</em>, etc. should be avoided unless it is totally clear what they mean.</p>
<p>Aim for optimum identifier length. Identifier length is important. It is almost always a compromise between conveying sufficient meaning and maintaining readability; in other words, it&#8217;s always a compromise between ambiguity and length. Consider the number of graduated trainees in the sales department. The name <em>numberOfGraduatedTraineesInSalesDepartment </em>is most unambiguous, but rather unwieldy. The names <em>trainees</em>, <em>salesTrainees</em>, <em>gradSalTrn </em> on the other hand, are more convenient but too short and too ambiguous. A reasonable compromise would be <em>numGradTraineesInSales</em>.</p>
<p>Qualify computed values. If a variable is used for a computed numeric value, such as totals, averages, etc. qualify the variable name accordingly. Examples are: <em>num</em>&#8230;, <em>count</em>&#8230;, <em>sum</em>&#8230;, <em>average</em>&#8230;, <em>max</em>&#8230;, <em>min</em>&#8230; and so on.</p>
<p>Use common opposite names for variables that express the boundaries of an interval, or an operation that involves opposites, such as <em>begin/end, first/last, min/max, old/new, lowest/highest, next/previous, source/target, sender/recipient</em> and so on.</p>
<p>Use letters <em>i, j, k</em> for loop index variables and iterators. This convention is probably as old as C-programming and it is a good practice, since there is no point in inventing fancy names for loop index variables. As always, there is an exception to the rule. If the index is used outside the loop, for example to count records, then a more descriptive name such as <em>recordCount</em> makes the reference outside the loop more readable.</p>
<p>Use <em>is</em>&#8230; or <em>has</em>&#8230; prefixes for boolean variables and methods that return boolean values. For example, the variable name <em>isCustomer</em> expresses boolean semantics much clearer than just <em>customer</em>. An exception to this rule are words that clearly express a yes/no status, such as <em>ready</em>, <em>done</em>, <em>failed</em>, <em>found</em>, etc.</p>
<p>In an object-oriented language, use nouns for classes, objects and interfaces. Use verbs for class methods and functions. Sometimes, it is also meaningful to use adjectives for interfaces or methods, for example <em>Quadratic</em>, <em>Sharable</em>, <em>isQuadratic()</em>, or <em>isShared()</em>.</p>
<p>Avoid scope prefixes unless your language forces you to do so. For example, it was customary in the past to prefix class names or functions with module names, for example: <em>Payroll_EmployeeRecord</em>, <em>Payroll_Allowances</em>, <em>Payroll_Reimbursements</em>, and so on. This practice battles namespace pollution, but it is a very poor replacement for actual namespaces, because it leads to incredibly long and cluttered identifiers. Use this only if your language does not support the notions of modules, packages, or namespaces.</p>
<p>Avoid shadowing. If you use identifiers in nested scopes, don&#8217;t use the same names to avoid shadowing. For example, if you declare a local variable with the same name as a field/member of the class, then the former shadows the latter. This is not a neat programming trick, but a recipe for disaster. It is quite confusing to read, and even more confusing to debug. An exception to this rule would be getters and setters, where the field/member is explicitly qualified with &#8216;this&#8217;.</p>
<p>Avoid reusing variables, unless the semantics are maintained. Imagine you have a variable named <em>count</em> which is used in one loop to count records, and in another to count errors. It may be tempting to reuse the integer already declared, but it is far more readable and maintainable to use two separate integer variables appropriately named <em>recordCount</em> and <em>errorCount</em>.</p>
<p>Make abbreviations readable and unambiguous. For example, the abbreviated prefix <em>rnd</em> is often used to denote a random value, but it could also mean rounded. If it isn&#8217;t clear from the context, write it out; for instance, write <em>randomAmount</em> instead of <em>rndAmount</em>. As a general rule, source code is read more often than it is written, thus readability is more important than writing convenience. With this in mind, if an abbreviation just saves one or two characters, always write out the word.</p>
<p>Create abbreviations that can be pronounced. For example, use <em>stringPos</em> rather than <em>stringPstn</em> and <em>recCount</em> rather than <em>rcrdCount</em>. It should be possible to read program code aloud without twisting your tongue. Apart from the advantage of being easier to communicate, pronounceable identifiers are also easier to remember.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasknierim.com/117/software-engineering/naming-conventions-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Scala Currency Class</title>
		<link>http://www.thomasknierim.com/114/scala/scala-currency-class/</link>
		<comments>http://www.thomasknierim.com/114/scala/scala-currency-class/#comments</comments>
		<pubDate>Mon, 11 May 2009 04:13:39 +0000</pubDate>
		<dc:creator>thomas</dc:creator>
		
		<category><![CDATA[Scala]]></category>

		<guid isPermaLink="false">http://www.thomasknierim.com/114/scala/scala-currency-class/</guid>
		<description><![CDATA[Most of you probably ran into the well-known precision problems with floating point numbers at one time or another. If you haven&#8217;t, consider this example:

1
2
scala&#62; 1.2 - 1.0
res1: Double = 0.19999999999999996

Oops. Shouldn&#8217;t that be 0.2? Yes it should, but since the number 0.2 cannot be represented exactly in binary form, the result is a little [...]]]></description>
			<content:encoded><![CDATA[<p>Most of you probably ran into the well-known precision problems with floating point numbers at one time or another. If you haven&#8217;t, consider this example:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="scala scala" style="font-family:monospace;">scala<span style="color: #000080;">&gt;</span> <span style="color: #F78811;">1.2</span> - <span style="color: #F78811;">1.0</span>
res1<span style="color: #000080;">:</span> <span style="color: #9999cc; font-weight: bold;">Double</span> <span style="color: #000080;">=</span> <span style="color: #F78811;">0.19999999999999996</span></pre></td></tr></table></div>

<p>Oops. Shouldn&#8217;t that be 0.2? Yes it should, but since the number 0.2 cannot be represented exactly in binary form, the result is a little bit less. This problem becomes annoying when Floats or Double values are used to represent money. It gets worse when multiplication or division operations magnify the error, as for example in the case of interest calculations. Simply put, you can&#8217;t guarantee the exactness of calculations down to the cent when you represent monetary amounts as floating point values. The Java language has a type called BigDecimal which solves this problem. It offers arbitrary scale fixed point arithmetics that allows precise financial calculations. Unfortunately, Java&#8217;s BigDecimal class has a rather unwieldy API which is a pain to use. No problem, you may think, because Scala offers a wrapper for BigDecimal that lets you use it like a normal number. That is true, but try this out:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="scala scala" style="font-family:monospace;">scala<span style="color: #000080;">&gt;</span> <span style="color: #0000ff; font-weight: bold;">val</span> b<span style="color: #000080;">:</span> BigDecimal <span style="color: #000080;">=</span> <span style="color: #F78811;">0.1</span>
b<span style="color: #000080;">:</span> BigDecimal <span style="color: #000080;">=</span>
  <span style="color: #F78811;">0.1000000000000000055511151231257827021181583404541015625</span></pre></td></tr></table></div>

<p>Oops again. This doesn&#8217;t look much better. What is more, the BigDecimal wrapper class in Scala has abstracted away the control over rounding behaviour and precision offered by the Java API. Of course, you could follow another approach and use Long values to represent money and scale them to the required precision, say one ten thousands of a Dollar. However, there are a number of problems with this approach. First, the value range is limited by MAX_LONG/scale. Second, you have to do complex formatting every time you print the values. Third, you have to code rounding manually because remainders are discarded in integer arithmetics:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="scala scala" style="font-family:monospace;">scala<span style="color: #000080;">&gt;</span> 59L / 10L
res2<span style="color: #000080;">:</span> <span style="color: #9999cc; font-weight: bold;">Long</span> <span style="color: #000080;">=</span> <span style="color: #F78811;">5</span></pre></td></tr></table></div>

<p>With this in mind, I have created a Scala currency type that offers arbitrary precision fixed point arithmetics with an easy-to-use API. It is based on the Java&#8217;s BigDecimal type - why reinvent the wheel? Let&#8217;s repeat the first arithmetic operation using the currency type:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="scala scala" style="font-family:monospace;">scala<span style="color: #000080;">&gt;</span> Currency<span style="color: #F78811;">&#40;</span><span style="color: #F78811;">1.2</span><span style="color: #F78811;">&#41;</span> - Currency<span style="color: #F78811;">&#40;</span><span style="color: #F78811;">1.0</span><span style="color: #F78811;">&#41;</span>
res3<span style="color: #000080;">:</span> Currency <span style="color: #000080;">=</span> <span style="color: #F78811;">0.20</span></pre></td></tr></table></div>

<p>This time the result is correct. It is correct, because the currency type automatically takes care of rounding. By default, the result is rounded to the second decimal place using the ROUND_HALF_UP rounding mode, which means that 1.555 is rounded to 1.56 and -1.555 is rounded to -1.56. Unlike the rounding for Float and Double values, the rounding is symmetric, which is standard in most financial calculations. If you need a different rounding behaviour – no problem. With the currency type, you have complete control over precision and rounding behaviour.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="scala scala" style="font-family:monospace;">scala<span style="color: #000080;">&gt;</span> <span style="color: #0000ff; font-weight: bold;">val</span> c <span style="color: #000080;">=</span> Currency<span style="color: #F78811;">&#40;</span><span style="color: #6666FF;">&quot;1234.56789&quot;</span>, <span style="color: #F78811;">4</span><span style="color: #F78811;">&#41;</span>
c<span style="color: #000080;">:</span> Currency <span style="color: #000080;">=</span> <span style="color: #F78811;">1234.5679</span>
&nbsp;
scala<span style="color: #000080;">&gt;</span> <span style="color: #0000ff; font-weight: bold;">val</span> d <span style="color: #000080;">=</span> Currency<span style="color: #F78811;">&#40;</span><span style="color: #F78811;">0.1</span>, <span style="color: #F78811;">20</span><span style="color: #F78811;">&#41;</span>
d<span style="color: #000080;">:</span> Currency <span style="color: #000080;">=</span> <span style="color: #F78811;">0.10000000000000000000</span>
&nbsp;
scala<span style="color: #000080;">&gt;</span> <span style="color: #0000ff; font-weight: bold;">import</span> Currency.<span style="color: #000000;">RoundingMode</span>.<span style="color: #000080;">_</span>
scala<span style="color: #000080;">&gt;</span> <span style="color: #0000ff; font-weight: bold;">val</span> e <span style="color: #000080;">=</span> Currency<span style="color: #F78811;">&#40;</span><span style="color: #F78811;">22.78</span>, <span style="color: #F78811;">2</span>, ROUND<span style="color: #000080;">_</span>DOWN<span style="color: #F78811;">&#41;</span>
e<span style="color: #000080;">:</span> Currency <span style="color: #000080;">=</span> <span style="color: #F78811;">22.78</span></pre></td></tr></table></div>

<p>The first expression creates a currency value with a precision of 1/10000 (= four places right of the decimal point) from a string argument where the fifth decimal place is rounded up in construction. The second expression creates a value of 0.1 (10 cents) with a precision of 10<sup>-20</sup> or 20 places after the decimal point. The third expression constructs a value of 22.78 with a special rounding mode that stipulates that values should always be rounded down. The effect can be seen when performing an arithmetic operation:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="scala scala" style="font-family:monospace;">scala<span style="color: #000080;">&gt;</span> e <span style="color: #000080;">*</span> <span style="color: #F78811;">1.1</span>
res4<span style="color: #000080;">:</span> Currency <span style="color: #000080;">=</span> <span style="color: #F78811;">25.05</span>
&nbsp;
scala<span style="color: #000080;">&gt;</span> <span style="color: #0000ff; font-weight: bold;">val</span> f <span style="color: #000080;">=</span> Currency<span style="color: #F78811;">&#40;</span><span style="color: #F78811;">22.78</span>, <span style="color: #F78811;">2</span>, ROUND<span style="color: #000080;">_</span>UP<span style="color: #F78811;">&#41;</span>
f<span style="color: #000080;">:</span> Currency <span style="color: #000080;">=</span> <span style="color: #F78811;">22.78</span>
&nbsp;
scala<span style="color: #000080;">&gt;</span> e <span style="color: #000080;">==</span> f
res5<span style="color: #000080;">:</span> <span style="color: #9999cc; font-weight: bold;">Boolean</span> <span style="color: #000080;">=</span> <span style="color: #0000ff; font-weight: bold;">true</span>
&nbsp;
scala<span style="color: #000080;">&gt;</span> f <span style="color: #000080;">*</span> <span style="color: #F78811;">1.1</span>
res6<span style="color: #000080;">:</span> Currency <span style="color: #000080;">=</span> <span style="color: #F78811;">25.06</span></pre></td></tr></table></div>

<p>In this example, the first operation e * 1.1 yields 25.05. We create another currency object with the same value, however with a different rounding mode. When performing the same operation on the second value f, the result differs by one cent from the first because it was rounded differently. This means that arithmetic operations with currency values that have different precision and/or rounding modes are not transitive. This is of course intended behaviour.</p>
<p>The above examples show simple calculations with non-specific currency values. In addition to the numeric amount, the currency type optionally takes a currency designation in the form of an ISO 4217 three-letter code. For example:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="scala scala" style="font-family:monospace;">scala<span style="color: #000080;">&gt;</span> <span style="color: #0000ff; font-weight: bold;">val</span> salary <span style="color: #000080;">=</span> Currency<span style="color: #F78811;">&#40;</span><span style="color: #F78811;">4789.90</span>, <span style="color: #6666FF;">&quot;USD&quot;</span><span style="color: #F78811;">&#41;</span>
salary<span style="color: #000080;">:</span> Currency <span style="color: #000080;">=</span> <span style="color: #F78811;">4789.90</span> USD
&nbsp;
scala<span style="color: #000080;">&gt;</span> <span style="color: #0000ff; font-weight: bold;">val</span> bonus <span style="color: #000080;">=</span> Currency<span style="color: #F78811;">&#40;</span><span style="color: #F78811;">500</span>, <span style="color: #6666FF;">&quot;USD&quot;</span><span style="color: #F78811;">&#41;</span>
bonus<span style="color: #000080;">:</span> Currency <span style="color: #000080;">=</span> <span style="color: #F78811;">500.00</span> USD
&nbsp;
scala<span style="color: #000080;">&gt;</span> <span style="color: #0000ff; font-weight: bold;">val</span> holidayInEurope <span style="color: #000080;">=</span> Currency<span style="color: #F78811;">&#40;</span><span style="color: #F78811;">2400</span>, <span style="color: #6666FF;">&quot;EUR&quot;</span><span style="color: #F78811;">&#41;</span>
holidayInEurope<span style="color: #000080;">:</span> Currency <span style="color: #000080;">=</span> <span style="color: #F78811;">2400.00</span> EUR
&nbsp;
scala<span style="color: #000080;">&gt;</span> salary + bonus
res7<span style="color: #000080;">:</span> Currency <span style="color: #000080;">=</span> <span style="color: #F78811;">5289.90</span> USD
&nbsp;
scala<span style="color: #000080;">&gt;</span> salary + holidayInEurope
MismatchedCurrencyException</pre></td></tr></table></div>

<p>You can add, subtract and compare amounts in the same currency (or of a non-specific currency value), but when you try to add two different currency values, you get an exception. Alternatively, different currencies could be implemented as different subtypes, as suggested in <em>Ch.20, Programming in Scala (Odersky, Spoon, Venners)</em>. This has the advantage that currency mismatches can be detected at compile time. However, it complicates the design and makes mapping the currency type to a database rather awkward. I think that the disadvantages outweigh the benefits, so I implemented the currency type as a “monolithic” class that knows about all currencies. With this design, it becomes easy to format currency values for output.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="scala scala" style="font-family:monospace;">scala<span style="color: #000080;">&gt;</span> salary.<span style="color: #000000;">format</span>
res8<span style="color: #000080;">:</span> String <span style="color: #000080;">=</span> $<span style="color: #F78811;">4</span>,<span style="color: #F78811;">789.90</span>
&nbsp;
scala<span style="color: #000080;">&gt;</span> <span style="color: #0000ff; font-weight: bold;">import</span> java.<span style="color: #000000;">util</span>.<span style="color: #000000;">Locale</span>
scala<span style="color: #000080;">&gt;</span> holidayInEurope.<span style="color: #000000;">format</span><span style="color: #F78811;">&#40;</span><span style="color: #0000ff; font-weight: bold;">new</span> Locale<span style="color: #F78811;">&#40;</span><span style="color: #6666FF;">&quot;de&quot;</span>, <span style="color: #6666FF;">&quot;DE&quot;</span><span style="color: #F78811;">&#41;</span><span style="color: #F78811;">&#41;</span>
res9<span style="color: #000080;">:</span> String <span style="color: #000080;">=</span> <span style="color: #F78811;">2.400</span>,00 €
&nbsp;
scala<span style="color: #000080;">&gt;</span> holidayInEurope.<span style="color: #000000;">format</span><span style="color: #F78811;">&#40;</span><span style="color: #0000ff; font-weight: bold;">new</span> Locale<span style="color: #F78811;">&#40;</span><span style="color: #6666FF;">&quot;fr&quot;</span>, <span style="color: #6666FF;">&quot;CH&quot;</span><span style="color: #F78811;">&#41;</span><span style="color: #F78811;">&#41;</span>
res10<span style="color: #000080;">:</span> String <span style="color: #000080;">=</span> € <span style="color: #F78811;">2</span><span style="color: #6666FF;">'400.00
&nbsp;
scala&gt; salary.format(&quot;<span style="color: #0000ff; font-weight: bold;">\u</span>00A4 #,##0.0000&quot;)
res11: String = $ 4,789.9000</span></pre></td></tr></table></div>

<p>The currency class offers a severalfold overloaded <em>format</em> method that formats currency amounts according to either the default locale or a chosen locale. Alternatively, you can specify a formatting pattern and/or symbols to use, or you can use Java&#8217;s DecimalFormat class for formatting. Thus you have total control over the formatted output. The currency class can also verbalise amounts in four languages.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="scala scala" style="font-family:monospace;">scala<span style="color: #000080;">&gt;</span> salary.<span style="color: #000000;">say</span>
res12<span style="color: #000080;">:</span> String <span style="color: #000080;">=</span>
  four thousand seven hundred eighty nine Dollars ninety Cents
&nbsp;
scala<span style="color: #000080;">&gt;</span> salary.<span style="color: #000000;">sayNumber</span>
res13<span style="color: #000080;">:</span> String <span style="color: #000080;">=</span>
  four thousand seven hundred eighty nine <span style="color: #F78811;">90</span>/<span style="color: #F78811;">100</span>
&nbsp;
scala<span style="color: #000080;">&gt;</span> <span style="color: #0000ff; font-weight: bold;">val</span> pesos <span style="color: #000080;">=</span> Currency<span style="color: #F78811;">&#40;</span><span style="color: #6666FF;">&quot;1538.20&quot;</span>, <span style="color: #6666FF;">&quot;MXN&quot;</span><span style="color: #F78811;">&#41;</span>
pesos<span style="color: #000080;">:</span> Currency <span style="color: #000080;">=</span> <span style="color: #F78811;">1538.20</span> MXN
&nbsp;
scala<span style="color: #000080;">&gt;</span> pesos.<span style="color: #000000;">say</span><span style="color: #F78811;">&#40;</span><span style="color: #0000ff; font-weight: bold;">new</span> Locale<span style="color: #F78811;">&#40;</span><span style="color: #6666FF;">&quot;es&quot;</span><span style="color: #F78811;">&#41;</span><span style="color: #F78811;">&#41;</span>
res14<span style="color: #000080;">:</span> String <span style="color: #000080;">=</span>
  mil cincocientos treinta y ocho Mexican Peso veinte Centavo
&nbsp;
scala<span style="color: #000080;">&gt;</span> pesos.<span style="color: #000000;">sayNumber</span><span style="color: #F78811;">&#40;</span><span style="color: #0000ff; font-weight: bold;">new</span> Locale<span style="color: #F78811;">&#40;</span><span style="color: #6666FF;">&quot;es&quot;</span><span style="color: #F78811;">&#41;</span><span style="color: #F78811;">&#41;</span>
res15<span style="color: #000080;">:</span> String <span style="color: #000080;">=</span> mil cincocientos treinta y ocho <span style="color: #F78811;">20</span>/<span style="color: #F78811;">100</span></pre></td></tr></table></div>

<p>Finally, the currency class provides a number of convenience methods, such as percentage(), setDecimals(), abs(), fraction(), integral(), pow(), symbol(), getAllCurrencies(), etc., and a number of factory methods and conversion methods to simplify programming with currency values.</p>
<p><a href="http://www.thomasknierim.com/code/Currency.scala" title="Currency.scala">View Source Code</a>.<br />
<a href="http://www.thomasknierim.com/code/currency.zip" title="Download Scala Currency Class">Download source code and API documentation</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasknierim.com/114/scala/scala-currency-class/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Laments of a would-be Ubuntuist</title>
		<link>http://www.thomasknierim.com/113/open-source/laments-of-a-would-be-ubuntuist/</link>
		<comments>http://www.thomasknierim.com/113/open-source/laments-of-a-would-be-ubuntuist/#comments</comments>
		<pubDate>Fri, 01 May 2009 03:21:26 +0000</pubDate>
		<dc:creator>thomas</dc:creator>
		
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.thomasknierim.com/113/open-source/laments-of-a-would-be-ubuntuist/</guid>
		<description><![CDATA[I have been a Linux fan for more than a decade. I used Linux in my own company and projects since 1996  and I was also one of the founding members of the Bangkok Linux User Group. Oddly however, the computer on my desktop still runs on Windows. It&#8217;s a glaring contradiction. I&#8217;ve wanted to [...]]]></description>
			<content:encoded><![CDATA[<p>I have been a Linux fan for more than a decade. I used Linux in my own company and projects since 1996  and I was also one of the founding members of the Bangkok Linux User Group. Oddly however, the computer on my desktop still runs on Windows. It&#8217;s a glaring contradiction. I&#8217;ve wanted to replace Windows for years. There&#8217;s always been a reason not to, mainly because I need to test software under Windows for my customers. Last weekend, the XP installation on my laptop &#8220;forgot&#8221; my user account and with it all account data. Simultaneously, the file system started to behave funny. &#8220;Ah, a sign from above,&#8221; I thought. &#8220;Finally the day has come, I will install Ubuntu on my laptop.&#8221; So I did. Ubuntu Dekstop 9.04 was installed with ease and -even more impressively- it recognised all of my Thinkpad hardware. Even the Wifi connection was up and running without fiddling about.</p>
<p>I should have said &#8220;almost all&#8221; hardware. Unfortunately one piece of hardware refused cooperation with Linux, namely my Novatel USB modem. Since I&#8217;ve come to rely on 3G mobile Internet, this is a knockout criterion. No modem, no Internet. After hours of scouring the Web for possible solutions and  trying out various settings, I gave up in frustration. There wasn&#8217;t anything I could do except zapping the Linux partition and installing old friend XP. To attenuate my disappointment, I will make it a dual boot machine, though. Note to hardware vendors: please take Linux seriously and provide drivers for your nifty electronics. That would make life much easier. I guess I have to postpone my switch-over to Linux for another year. Hopefully I will be able to resist the urge to buy another piece of exotic hardware in the meantime.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasknierim.com/113/open-source/laments-of-a-would-be-ubuntuist/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
