Chitika

Showing posts with label ant. Show all posts
Showing posts with label ant. Show all posts

Friday, September 24, 2004

Ant mapper datatype

Reading Java Development with Ant
Chapter 3 - Understanding Ant datatypes and properties

It's interesting to see that we have these mapper datatypes in Ant. They're very powerful, yet I have not seen many of the developers use them in their build file. I strongly suggest that these mappers be acknowledged, for the efficiency of the build process itself.

These mapper data can be used with the <uptodate>, <copy>, <move> and some other tasks. A good example would be matching a glob mapper with the <uptodate> task. For example, if no production code is updated, then no compilation should be performed.

<target description="compile if src not uptodate" name="compile">
  <condition property="src.uptodate">
    <uptodate>
      <srcfiles dir="{src.dir}" includes="**/*.java">
      <mapper type="">glob" from="*.java"
        to="{build.dir}/*.class"/>
    </uptodate>
  </condition>
  <javac srcdir="{src.dir}">
        destdir="{build.dir}"
        unless="src.uptodate">
    <classpath refid="classpath.default">
  </javac>
</target>


It is a very simplified version, but the purpose is to have a conditional step in the build process, e.g. no compilation should be performed if the class file is already updated, by comparing each java source code's timestamp against the corresponding (as mapped by the glob mapper) class' timestamp.

This book offers a lot of enhancement to the way we use Ant. I hope I can get a chance to read through the rest of the book.

Further Reading:
Java Development with Ant


Wednesday, September 22, 2004

nightly build & extreme programming

Reading Java Development with Ant
Chapter 1 - Introducing Ant

Page 15
"However, every night, one person's computer attempts to build the planet's most popular open-source Java projects from their latest source, using the latest version of Ant as the foundation. When that build breaks because of a change in Ant, the owner of that computer, Sam Ruby, lets the Ant development team know."

What is the percentage of all Java projects in this world are running their nightly builds as early as possible, as soon as the project started?

Having a nightly build, means that the project team can have a great confidence on the results (assuming that they're good), and the project team can also get their feedback immediately (if the results are not good). The nightly build has a great synergy with the continuing integration process, which in the end forces the software to start from a simple running application, and growing in small incremental steps, to always be integrated and refactored along the way, receiving feedback as early as possible, before turning into a production ready application, weeks before the deadline.

Page 16
"The idea is that change is embraced; it is planned for and expected. The software is continually refactored during development to keep it simple, clean, and agile at all times. Change occurs in small incremental steps when using XP, leaving the system ever in a production-ready state."

By doing nightly builds, I believe the whole team is used to having a positive results at all time. Even further, I believe they'll be more adaptive to changes, as they get them daily. I believe the key is to design and code as required, and never to be afraid to refactor. Again, this relates well to having a good unit test mechanism, allowing us to refactor freely, yet safely.

Page 16
"Continuous testing and integration are crucial to obtaining agility inadaptation to change."

Nightly builds, Unit tests, Continuing integration, Change Management & Refactoring...

All of them are keys to successful software development project, I believe. How many of us are courageous enough to cross the bridge to these agile/XP methodologies?

Tuesday, September 21, 2004

up and running, in no time

Reading Java Development with Ant
Chapter 1 - Introducing Ant

Page 14
"Being capable of quickly getting a new development environment up and running is a sign that your project is on the right track."

At a first glance, this may seem to be a trivial task to do. It may be a trivial task for a small scale Java project, but for a large scale J2EE project, this may very well be a non trivial task to do. Can we really perform this consistently even for a large scale J2EE project? The answer to the question remains to be seen.

It's quite a challenge for any Project Manager to make sure that the above quote does happen for his/her project. But, unless a careful planning, and continuing integration is in place, it's an impossible thing to do.

Can we really do it?
Can a new developer who joins the project which started weeks/months earlier, immediately pick up the latest development source code and environment, and set it up in his new PC/laptop, and have it clean compiled and run smoothly within an hour?

I think it's quite a big challenge..