|
Think tank
[
vmassol
]
10:25, Wednesday, 19 December 2007
Jason Hunter was kind enough to set up a Markmail site for XWiki. Markmail is a mailing list archiving tool with a powerful search feature. What sets it apart from other such tool IMO is the UI and speed/quality of search. I especially like the ability to see who's sending the most mails to a list and the nice syntax coloring display of emails (in addition to the thread view). Another nice feature is that emails are indexed a few seconds after they have been received by the list (compared to several hours with other tools). I love it :)
[
vmassol
]
08:19, Tuesday, 18 July 2006
It would be nice if there were a tool that could verify that you have correctly added This tool could be based on Clirr or JDiff for example. It would also have an option to fail the build if there are new methods without a Do you know if such a tool exists?
[
vmassol
]
13:52, Monday, 17 July 2006
The experience that I'm relating here is part of an exploratory refactoring that I'm currently doing on the Cargo code base. Till now we were using Java File objects for representing J2EE archives or container installation and configuration directories. This is ok but it makes unit testing a little bit complex when it comes to unit testing File operations. The reason is that you need to define a location on your local file system where you're going to read/write files to, clean up the files, etc. Here's a method we had (it expands a JAR file):
Here's how I've transformed the method by removing all
The interesting part comes now. Because it was a bit hard to create a unit test for the original
Notice the use of the "ram:" URI scheme. This one of the many filesystems supported by VFS and it means that all file operations will happen in a virtual file system in memory.
Also note that VFS doesn't currently support creating Zip files so we're using the JDK's The other nice thing is that by introducing VFS to this
[
vmassol
]
09:54, Thursday, 13 July 2006
(Updated 2006-07-14: Added section on discovering modules and added disclaimer at the end) IntelliJ IDEA has revolutioned the IDE landscape by adding "intelligence" to IDEs. A few days ago I did a thought experiment by asking myself the following question "how feasible would it be to build a project without knowing any meta-data about it?". In other words, is it possible for a build tool to be intelligent enough to build a project without build files nor POMs. Said differently, is it possible to figure out a project's POM automatically? Let's review some required typical meta-data information and see how they could be guessed. Source locationsIt is possible to guess where sources are by looking for Note: An interesting thing here is that to be intelligent we'd need the help of the community to add new rules to the discovery process. For example imagine that a new testing framework appears; we'd need to add it to the Test Discovery Rules. Thus, this type of intelligent build system would need to rely a lot on the community and thus would need to get its data from an online repository that could be edited by the community. DependenciesHow do we detect project dependencies? One relatively way is to parse the sources that we have found above and find all external imports. Then query ibiblio to find matching package names (this information is present in Maven POMs on ibiblio). Now for guessing the version, there's no easy magic. A first approach would be to get the latest released version of the dependencies we've found. Project typeProject types can easily be guessed by looking at some files. For example if a SCMSCM can easily be guessed by looking for special files on the filesystem of the project. For example we would look for DevelopersOnce we got the SCM URL we can then query the SCM to get the list of all developers. Project nameThe project name could be the name of the top level directory and the version could be set arbitrarily to 1.0. Actually we could even check ibiblio to see if the project is already on ibiblio, get the latest version there and increase the minor number by one as a first order guess. Another strategy would be to query the SCM and look for tags and deduce existing versions by parsing those tags (there are some usual conventions for naming tags so it should be possible to make a good guess). Modules and artifactsDiscovering the different modules of a project is probably one of the hardest thing to do. If you look at different projects in the wild I believe there are not that many directory structures out there. Maybe 10-15. Thus it should be possible to register knowledge of these structures and let the tool discover which ones matches the closest with the project at hand. This would also allow to deduce the different artifacts that have to be generated. Of course it won't be perfect as there are projects which generate several artifacts and which may be in the same module. Again it's a question of doing 80% of the job and leaving 20% to be done manually. Additional informationOf course, the information found above are just guesses. In most cases they could be correct but of course we would need to offer a way for the user to edit them and to add any missing information. ConclusionI believe it should be possible to create such an intelligent meta-build project which could be used to generate files for one of the existing build system such as Maven, Ant, etc. For example it could create an internal POM file on which Maven could then be executed to produce the build results. At a minimum such a tool could be used to convert existing projects to Maven. I wonder how intelligent it could be but I guess it could go pretty far. Disclaimer: Of course, such a tool would be bad from a conventions stand point. One of the great strength of Maven has been to standardize the directory structure of projects. I can go to any Maven project and I know exactly where stuff will, what will be generated, etc. Are there other information which you think could be guessed automatically? Can you think of better algorithms to guess some of the information shown above?
[
vmassol
]
10:07, Friday, 17 March 2006
Current wikis are great. However when used as development wikis I have found some limitations which are hampering their use. Please note that my experience is based on using Confluence and XWiki and other wikis may support some of the features mentioned below. Here's my top wishlist for development wikis and for Confluence and XWiki in particular:
I have quite a few other suggestions for improvements but I feel those are the major ones when it comes to using a wiki as a project development wiki. Let's hope wiki vendors are listening... :-). Are these also on your wish list?
[
vmassol
]
13:48, Sunday, 12 February 2006
I see 2 use cases where ensuring binary compatibility is a must:
Enforcing binary compatibility in the buildThe automated build is a nice place to enforce binary compatibility as the build is something executed by the indiviudal developers before checking-in and it's also executed by the continuous integration build. Thus any binary incompatibility can be quickly discovered. Or course this doesn't replace tests which can also help discover breakages. However the problem is that with all the nice refactoring IDEs we have now, it's easy to refactor the tests at the same time as the code and thus introducing a binary incompatibility is not always noticed. A good strategy to discover an incompatibility is to compare the current code with the latest released code. This is what Clirr is doing. Clirr currently sports an Ant and Maven1 integration. The good news is that there's a Maven2 plugin in the work (more on that when it's released). However using a tool is only good if there's a strategy behind it. Strategy for using ClirrHere is what I believe can be done to automate binary compatibility checks in the build:
Note: On the Cargo project we've tried to do this, even though there's still room for lots of improvement. Actually our main issue on Cargo is not detecting binary incompatibilites but rather deciding to release a 1.0 version which would mean that from then forward we would aways look for a deprecation solution rather than break binary compatibility. We've always pushed back this 1.0 release because our API has been changing quite frequently but we're now nearing a 1.0 version. When that comes we'll turn Clirr on to fail the build upon breakage. I'll let you know how it goes...
[
vmassol
]
08:55, Saturday, 21 January 2006
I'm currently writing my third book and I'm starting to notice a pattern. Whenever I write a book about a tool/framework to which I have access to the sources, the code ends up being better. The way I work goes like this: I start writing about a topic. If it's taking too long to explain it, I consider that something is wrong about the code. I modify the source code so that the document I'm writing has the minimal required size to explain the topic. The good thing with a book is that what you're explaining has to be simple and not convulted which leads to this nice effect of improving usability of your code. I get a bit of the same result when I write project documentation but not to the same level. This is probably simply because writing a book is a more involved process, you dedicate more time to it and thus you want it to be as perfect as possible (and thus as readable as possible). I guess nothing here is new. This is all about having a user of your code. Tests are "users" of your code and thus leads to better design. I guess documentation can also be a "user" of the code and thus help improving it. If you're writing some framework/tool, consider writing a book for it and if you're diligent in your writing your code will end up being better! As an added benefit your users will love you... :-)
[
vmassol
]
18:30, Friday, 4 November 2005
Amazon has released a beta of the Mechanical Turk. It allows a program to programatically ask a question to a human and wait for the answer. Here's an example (copied from Google Blogoscoped):
This is really like the Matrix except that the humans get paid a little bit of money (but in the end that's close to getting fed) and it's other humans that controlling the programs... until we have web services using other web services using the Mechanical Turk. Then who's controlling who is going to be hard to decide :-) Source: Google Blogoscoped.
[
vmassol
]
18:49, Wednesday, 26 October 2005
I'm working on automating a J2EE build using Maven 2 and I'm in need of a Maven 2 plugin to do the following:
The ideal situation would be to find an existing Java framework that would already perform all or some of those steps. Then I could easily create a Maven 2 plugin wrapping it. So far I haven't been able to find such a tool. If you know any please suggest them! Here's what I have found so far below. Please note that I have probably made mistakes while filling this table and I'd be happy to be corrected...
Again, let me know if you know some tools that are not listed here. If no such tool exist, an idea I have would be to add support for databases in Cargo. Indeed Cargo is meant for manipulating any kind of containers. It happens that the first type of container we've implemented are J2EE containers but it should work for any other type and the interfaces should remain the same. WDYT?
[
vmassol
]
18:19, Wednesday, 13 July 2005
I've just tried today Copernic Desktop Search (CDS). I've been using Yahoo Desktop Search (YDS) for several months now and I'm very happy with it. It has some issues though like it's putting my laptop on its knees when it performs indexing, it has no Windows taskbar integration, etc. I wanted to see how CDS fared against YDS. Here are my findings after one day of using CDS. Please note that this is definitely not long enough to have a definitive opinion on the topic but I thought I'd still share what I've learnt today. General opinionCDS is a very good desktop search. I was very impressed. It seemed perfect at first and then slowly I started finding some little flaws compared to YDS. Still it is extremely good. It has all the features you'll find in YDS and Google Desktop Search (GDS). Pros of CDS vs YDS
Cons of CDS vs YDS
Some minor details:
ConclusionIf only it could have a better view layout and be faster to display results it would be perfect. Its killer features are really its CPU-friendly indexing for me and the immediate availability of new resources in searches. I've just noticed that YDS has released verson 1.2beta yesterday and I'm installing it. For now, I'll still keep using YDS which is still my favorite. YMMV.
[
vmassol
]
15:22, Saturday, 30 April 2005
Clirr is one of these tools that would deserve to be known better. I have mentioned it several times in other posts but it's really the first time I get to use it in real. It rocks! I'm about to release Cargo 0.5 and I wanted to get an exact list of the API modifications we have done compared to version 0.4. Here's the kind of output Clirr gives (the full output is available here):
Even though we're using JIRA with an Iteration-Driven Development strategy (IDD) it was still a very interesting exercise to verify that we had not missed any issue by running Clirr on the source code. In addition, it provides a more detailed view of what exactly has changed in term of API which our JIRA report does not provide. The next step would be to use it to fail our build whenever someone introduces a public API break. It would be quite easy for us because we've cleanly separated non-public API from public APIs by using internal packages (see the Cactus API design rule to see what it means). Of course sometimes, you want to voluntariy add a breaking change. That's legitimate but it has to be controlled. The strategy would be to have the build fail and then if the change is voluntary to exclude it from Clirr. Well done Lars!
[
vmassol
]
16:29, Thursday, 7 April 2005
Where is Ant heading in the future? I would be very interested to learn more about this. I've been using Ant for several years now and I've always been a happy user. However these days, I'm no longer using much the XML scripting side of Ant but I'm using heavily the Ant Java API; what I'm interested in are the Java Ant tasks. I think this is really where the value of Ant is. All those years of implementing the base building block for a portable OS Java API have created a very useful Task set. I think every Java application that needs to do copying, deleting a directory, spawning a Java application, etc should use these tasks. There's no point in reinventing the wheel! For example, you may think that deleting a directory is simple. But it's not so easy. Have a look at the Delete Ant task source code. You'll find portion of code like this one:
Would you have thought about this? Probably not and you would have been right not to as this only happens in some rare occasions. But when one of your users reports it, it's going to be darn difficult to identify and fix. Personally I'd rather depend on a stable and well tested library rather than recode it myself. The problem is that the Ant tasks are a bit too much linked to the execution engine (the XML scripting engine). For example reusing an Ant tasks requires you to create a Project object. This in turn drags loggers, the Ant classloader (in some cases) and possibly other objects. I know it's possible to use Ant from Java (I've been doing it for a long time now) but I'd love it be even easier to do so. Instead of writing:
I'd like to be able to write:
I don't want to see the get/setLocation, get/setTaskName(), get/setDescription() and in general all methods from Task.java. What I'd love to see is Ant moving in the direction of providing completely reusable Tasks that have 0% dependencies on the Ant engine. This means that loggers, classloaders would be passed to the Ant task by the program who uses it. I'd like to see Ant provide 2 distributable jars: one containing the XML scripting engine only and one containing all the pure java beans Ant tasks that can be reused in any Java application. I'd like to see Ant separate into 2 subprojects: one for the XML scripting engine (let's call it engine) and one for the Ant tasks (let's call it tasks). The reason for the 2 projects is to ensure there's no dependency in the direction tasks->engine. I'd like to see Maven2 use those completely reusable Ant tasks instead of recreating them (this is a wish I'm addressing to both projects, not just Ant! :-)). I'd like to see those Ant tasks being a JSR and incorporated in a future version of the JDK, thus providing a higher level API that the best classes from the JDK. Is that where Ant is heading today?
[
vmassol
]
11:21, Friday, 11 March 2005
I may be dense but I've just realized today that there is a potentially simple way to increase participation to an open source project. That's always been one of the questions on my mind: how do I make my open source projects more successful? For me a successful open source project is one which has a rich developer community. How do I make this possible? There are of course several ideas to make this happen but the one that dawned on me this morning is that the project has to reduce its complexity (by making it more modular for example). Indeed, the barrier to participation is often due to the fact that a user who wants to participate will need to understand the whole design, how the different classes are entangled, what effect a change here will have on the rest of the project, etc. Thus, if we make the project more modular a contributor who wants to participate will only need to understand the design of a given 'module'. A 'module' would need to have some good-to-have characteristics:
Interestingly one way to implement the 'very loose coupling with other modules' characteristic is by using a Service Architecture. This can be done for example by using the Dependency Injection pattern and/or using a lightweight container - PicoContainer, Spring, etc). This is probably obvious stuff but I've just realized that it's not only good design practices but that it'll also help open source projects attract more contributions. Of course that leads to another topic which is when to accept contributions and how to maintain them in the long run but that would be another discussion...
[
vmassol
]
09:28, Friday, 11 March 2005
Continuing with my current build-mania, I'd like to propose the idea of a distributed build architecture. I'd love to see my favorite continuous integration tools (CruiseControl, DamageControl and Continuum in the future) support this notion in the future (I know they're thinking about it already!). So what is the need for a distributed build?I can see several use cases:
A proposed architectureDisclaimer: this only ONE potential solution. There are lots of other solution probably even more valid than this one. Please feel free to add your ideas as comments to this post.
It could work as follows:
Of course there would be several details to sort out, like should we send 2 Requests object for each build need so that we can compare the results and only accept the result if they match, etc. ConclusionI think this type of distributed build could be especially interesting for open source projects in order to build an active community around a project. This would be yet another way in which people can contribute to an open source project: by lending some of their machine CPU to perform continuous integration builds of this project. This usually makes sense as open source projects may be low on hardware resources and lending some would help. Of course it also bring its challenge of security issues that would also need to be implemented... Would you like such a distributed build system? I personally prefer this architecture over one where the orchestrator directly sends build requests to build agents as I find it more scalable and more flexible.
[
vmassol
]
10:44, Wednesday, 12 January 2005
The conceptThe typical local builds that developers run on their machines work by building the subproject they're working on but also all the dependent subprojects it requires. Usually, as building all dependent subprojects takes a lot of time, the developer infrequently checks-out other project sources and build them on demand. His focus is on his subproject that he's making modifications to (and rightly so!). This strategy has the following drawbacks:
Because of all these problems, I have been using a different approach on my current project for the past 2 years. This was mostly motivated by the fact that the project is a big project (close to 100 developers) and we were hitting the issues mentioned above. I have called this strategy "Binary Dependencies Build". If you're interested this is an approach I have presented both at TSSS2004 and at Javapolis 2004. Here is how it works (click on image for a larger picture):
Imagine that you have a "trading" subproject that depends on 2 other subprojects ("partners" and "referenceData"). The idea is that your local build will NOT build them from sources but instead will download their latest version that work from a remote artifact repository (a location where the result of the subproject build is located). In order to accelerate even further the build, the versions downloaded are stored locally. In our example, the latest "partners" jar is already available locally and is thus not downloaded but the "referenceData" one is not. It is downloaded and then stored locally. The "trading" subproject is built using these binary dependencies. This is all fine but there is a burning question: How do I do continuous integration with such a system? Won't the binary dependencies be old versions when I get them? The solution to this is to have a continuous build server that continuously build subprojects and puts their artifacts in the remote repository. Note that there are put in the repository only if their build passes with no errors. This ensure that there are always fresh versions available and that they are as "good" as they can get. Doing it with MavenThe good news is that this feature is built in Maven. Maven implements this support of artifact repositories (local and remote) and it supports the process of automatic download of artifacts not available in the local repository. Usually Maven will verify first in the local repository if the artifact's version exists and if so will use it. However, if an artifact's version contains the "SNAPSHOT" keyword, Maven will always check if there's is a more uptodate artifact in the remote repository. This allows implementing easily the strategy defined above. ConclusionWe've been very happy with this solution so far. I think there are 2 key points in making this work:
[
vmassol
]
12:28, Friday, 31 December 2004
Here's a non-ordered list of the main problems causing build-breaks that we had found on the current project I'm working on (Note that this list is now a year old and that we have fixed some of them - Unfortunately the majority still remains...). I've added some possible ideas on how to fix them.
[
vmassol
]
15:18, Wednesday, 29 December 2004
Let's create Unbreakable BuildsOut of my last two development projects, one had a strong sense of quality and excellence in general and continuous build failures were the exceptions (about 3-4 per week for a 30 developers team) and the other one was quite the opposite and everyone was surprised when the continuous build was passing (there were about 5 build breaks a day as an average for a 40 developers team). I'm sure this is also pretty common to other projects. Obviously the best is to build (pun intended) a build awareness in the team. However, you'll need strong evangelists for this to happen who may not always be available and other circumstances may make this difficult. A thought struck me about a year back: what if we were able to prevent the continuous build from failing by design. There's a French saying that goes something like "it's better to cure than to heal". I think this is definitely a good idea to apply to continuous build failures. Why not make a continuous build system that cannot fail. At that time I thought it was a nice idea (I had meant to blog about it but I forgot) but I could not see very well how it could work. Now a year after, I really think it's a nice idea and I'd like to explore it. The architectureA potential basic architecture is shown in figure 1 (click to get a larger picture).
The general principle is to catch the commit data before they get committed to the SCM, to perform a build and to perform the actual commit only if the build is successful. Here are the detailed steps:
AdvantagesHere are the following advantages of such a system:
Questions/IssuesI'm sure you're now burning with tons of remarks/questions showing why it wouldn't work :-) Here's what I've currently thought about. If you have any opinion or other questions, I'd love to hear them. Q: What happens if someone else also commits a change to the same file?It works in the same way as usual. The build kicker will try to "merge" the changes after having done a workspace update and if it cannot, the user will get an error explaining that the merge failed. The user will then need to perform an update on his local machine and resolve the conflict. Q: Imagine I perform a commit and I start working on a new feature. Then my commit is rejected because of a failure. How do I fix this without loosing my current changes?Answer 1: This is actually relatively similar to what you're currently doing. Imagine you're committing something. Then you start working on something new and the continuous build tells you 2 hours later that your change has broken something. The difference is that your changes have been committed so you can easily create a new workspace and fix it there. We could do the same here by having the pre-commit hook actually make your changes available through a URL (sent in the commit answer) as a patch so that it is easy for you to apply it to a fresh new checkout. Answer 2: You wait till the build is finished on the server. You can perform other activities like documenting, reading, thinking, designing, writing new classes, new tests, etc. Basically you work on stuff that do not conflict with the past changes. Actually this is probably what you're currently doing when your build is running as it is eating all your CPU... Q: Doesn't it take too long to build?You need to ensure your build is taking as little time as possible. I think 5-10 minutes should be ok. The best way to achieve this is probably to use binary dependencies instead of rebuilding dependent projects (a la Maven), except maybe direct dependencies. You'll still need a continuous build running continuously to produce fresh binary dependencies. I guess it's also best to use an SCM client that can do asynchronous commits in order to let you continue working while the commit is in progress. Q: What if I want to modify an API but I wish that each projects modifies its own files?Several options:
The interesting point here is that you *want* the API breakage to be detected as the default instead of the opposite. ConclusionIt seems to me this would be particularly useful on big projects with lots of developers. It should also be useful to introduce continuous integration on an existing project as it lowers the discipline required by everyone. Obviously this is just an idea that I haven't tested yet. I'm very keen to see this in action. If any of you has any experience please share it. I'm planning to spend some time trying to implement it. If you're interested to help out, let me know too.
[
vmassol
]
11:11, Saturday, 4 December 2004
When working using a Time-boxing approach with JIRA there are some typical issue-smells that I have noticed appear frequently. In order to perform good deliveries it is important to fight them.
Let me know if you have found other important issue-smells when using JIRA!
[
vmassol
]
19:43, Wednesday, 17 November 2004
IntroductionAutomated tests are good. Automated Functional tests are even better as they are the proof that your application is working. In addition, with automated functional tests you can also automate your delivery process. However, writing automated functional tests is hard. The main reason it is hard is because you need to control your execution environment (database, application server, etc). Cargo is a framework that you can use to automatically install, configure and execute J2EE containers. Thus it allows you to control your execution environment (for the J2EE container at least) and permits completely automated functional tests for J2EE applications. ExampleLet's walk through an example. Imagine we wish to start up Tomcat 4.1.31 before such test runs. Here's what we could write:
Step 1 is optional. You can also rely on the container being already installed on the test machine if you wish. However, it's nice to completely automated the testing and assume nothing (or very little - We still need an OS and a JDK on the machine). In this example we're fetching the Tomcat 4.1.31 installation from the web. We could fetch it from our intranet or from a location on the machine or from our SCM. In Step 2, we have not told Cargo what container Configuration to use. Thus Cargo will use a default Configuration and it will configure it so that your container will execute in a temporary directory that it will create in your OS system tmp dir. If you wish to control this you can use:
in step 3, we create a Cargo wrapper around a physical WAR and we add it to our container so that it is deployed when the container starts. We then start the container (step 4), perform any testing we wish (step 5) and ensure the container is always stopped at the end of our test (step 6). If we wish to start and stop the container only once during our whole test suite we can use a standard JUnit TestSetup. ConclusionThis is just a short introduction to Cargo to demonstrate how easy it is to start/stop a container. The API is of course richer. Also, we're showing here how to use Cargo for functional testing of J2EE application but Cargo is also meant to be used by any application that requires a container to be up and running. It could also be used by IDE plugin writers, etc. For more information on Cargo, please see the Cargo website and join us on the Cargo mailing lists. You'll be warmyl welcomed! :-)
[
vmassol
]
15:50, Friday, 5 November 2004
How often are you trying to debug some Java application to find that you can't continue your debugging easily because the code is entering into some third-party library? At that point, either the library is open sourced and you can rush to download the source, modify the code to add some How good would it be if there was an application (let's call it a Logifier) at which you could throw a jar and it would return a new aspectified jar on which it would have weaved some Logging aspect that you could configure! This would allow us to realize the full power of aspects: an external Java application that was not built with logging can now be converted to log things for us... So who wants to be the first to build such a handy application? :-) Does it already exist? Update 7/11/04: I've just remembered reading about AntFlow on TSS. That would be an excellent way of implement this. Imagine a hot folder called "logifier" and any jar you drop in there is automatically logified using an AspectJ/AspectWerkz/etc Ant task and a common logging aspect such as this one! Now that would be cool. It could be a good coding exercise for the next OSSGTP.
[
vmassol
]
10:34, Monday, 1 November 2004
AnalysisI've just tried Omea Pro (build 353) and I've got to say it's very promising! It's hard to explain what Omea is... I think it can be viewed as two things:
After using it for 2 days, here are the pros I have found:
Here are the thing to improve I have noticed (please remember that it is beta software):
Now the real questions is how should I use it? As a search tool? But then it's a bit heavy to be left sitting idle on my desktop. And it's too heavy to start it on demand (it currently takes 30 seconds to 1 minute to start - I'm sure it'll be improved in the future). As a productivity tool? Possibly, although it's missing some of the features I use in my specialized tools. For example:
ConclusionI currently don't think I'll be able to keep Omea open all the time as it's too heavy to have both Outlook and Omea open at the same time. Also, I don't like the fact that I have to stop using my favorite Feed reader (NewzCrawler). I really do not want to manage 2 feed tools and tell each one which feeds I have already read. Of course, I could simply not use the feed feature of Omea. However I feel that using Omea just for searching makes it loose a lot of its attraction. If I just want a search tool, I can use Goodle Desktop or Lookout (even if they are less powerful they are probably good enough for my daily needs). I think the real challenge for JetBrains is to make the tool good enough in each domain (mail handling, feed reading, etc) so that it can be used instead of the dedicated tool. That means that you would use Omea for day to day activities and the specialized tool from time to time only when you need one of the power feature. Of course, this is a huge challenge for JetBrains and honestly I am not sure if it is achievable. Anyway, the tools is promising and intriguing enough so that I'll follow the different builds to see how it evolves. If you're using it, please drop me a note on how you use it and how you handle it vs the specialized tools. Thanks Update 04/11/2004: I've just tried build 358 and I am extremely pleased to report that the memory consumption has decreased a lot: whereas it wasa before 300MB for me, it's now 140MB. Good job!
[
vmassol
]
10:22, Thursday, 30 September 2004
On one of my projects at work we have moved to JIRA 3 (beta). We moved to benefit from the new custom workflow feature. Unfortunately it was missing one key feature we wanted: the ability to send notification emails on custom workflow transitions (I've just been told by Atlassian that this is a feature they're currently working on). To remedy this and thanks to Atlassian's support, I've decided to delve in the JIRA Java API and develop a workflow function plugin to implement email sending. I have to say that JIRA 3's extensibility is great! JIRA can almost be seen as a full fledge foundation for developing project tracking applications, in the same spirit as Eclipse is a full fledge foundation for developing java applications (RCP). Both Eclipse and JIRA come with a default application using this API to demonstrate their power (the IDE for Eclipse, the issue tracker for JIRA). Note that the new plugin system in JIRA has several similiarities with the Eclipse plugin architecture. Of course, I'm sure JIRA still has a lot of ground to cover to expose a plugin API covering all domains of issue tracking (i.e. allowing to replace all parts of the JIRA issue tracker) but it's going in the right direction. Here is a short tutorial on how to develop a workflow function plugin. Note that you should also check the Atlassian tutorial on how to develop plugins. The source code is available here and the plugin jar is available here. Setting up the projectHere's the directory structure I have chosen for my plugin. Please also note that I have used Maven to perform the build (extremely easy to setup as Atlassian is also using Maven and they have all their jars in a Maven remote repository on http://repository.atlassian.com).
A plugin is composed of several files (it is packaged as a JAR at runtime):
The maven.repo.remote=http://repository.atlassian.com,http://www.ibiblio.org/mavenThe [...]
Generating the plugin jar is as simple as typing The Worflow Function plugin extension pointHere's what the
What you have to understand:
The Java APIThe Plugin Factory classWithout further ado, here's the skeleton for the
Those 4 methods are called by JIRA itself:
Here's a look at the
As you can see, the variables The Plugin Function classHere's the code that implements the plugin feature (in our case the sending of the notification email):
The The parameters have the following meanings:
Deploying and executing the pluginDeployment is a simple as dropping the plugin jar in In the following image we can see how JIRA has automatically discovered our plugin and extracted information from the plugin descriptor to make them available at the right extension point in JIRA:
Here is the page (using the
Here is how our function is displayed (using the
I hope you got a good feel of what's possible to do with the JIRA API. Note: For those wondering, I am not affiliated with Atlassian at all. I simply happen to like their tools (JIRA, Confluence) and I like the spirit of their team.
[
vmassol
]
12:06, Saturday, 3 July 2004
The need for source code communicationWhen you're working in a team one of the most important aspect of development is to know what others are working on, what they are modifying. Indeed, in development everything is tied one way or another:
Basically, I need to know whenever some source file on which my work depend on is modified. Of course, I could rely on verbal communications: "Hey Joe, I'm gonna work on this files for the coming 4 hours". Sure, that'll work too. However it's not a scalable solution (Imagine a project divided in 5 teams of 10 persons each) and it works only if the participants are acutely aware of what each developer is depending upon which is near impossible. In addition, if the team is distributed it becomes virtually impossible to communicate such small events in any efficient manner. There has to be a better solution. And there is! There are actually 2 solutions I know of, one better than the other. Solution 1: Diff emails on SCM commitThis first solution involves setting up a server-side hook in your SCM. Most SCMs supports executing a script upon source check-in/commit. Just write a script that sends an email containing the diffs between what the user is committing and what already exists in the repository. The reason for the diff is that we're interested by what's different and not by the full content. This is what is done in most open source projects. Here's an example:
The problems with this solution are:
Solution 2: RSS feedsThis solution involves setting up some kind of server that will generate RSS feeds for the developers. Implementing this could be quite involved. Fortunately there's a tool called FishEye from Cenqua that does exactly this. It's an improved viewcvs. Most importantly it allows developers to generate RSS feeds on any resource (any directories and any files). Here's what the HTML view looks like:
Then here's what you get in your favorite feed reader (I'm using Newz Crawler here):
Clicking on the diff link generates the following view:
Note: Please note that FishEye currently only supports CVS. Other SCMs like Subversion are planned in the future. ConclusionIt is relatively simple and very effective to set up a way to notify developers about changes happening in the repository. I would even suggest that not doing so is a "communication anti-pattern". In order for it to be the most effective possible, developers should not be "spammed" by tons and tons of diff information. Thus to prevent this spamming you should consider 2 options: using RSS feeds instead of emails and allowing developers to choose their feeds. There are obviously some feeds that should be more "mandatory" than others. For example, the one notifiying of database schema change, the one notifying of build changes and the one notifying of public API changes. It's important, as always, that there is a champion in the team, explaining to others the benefit of these feeds and how they should be best used. Otherwise the power of them may exist but it won't be harnessed.
[
vmassol
]
08:50, Wednesday, 21 April 2004
Pattern Testing is the concept of automatically verifying the good application of architectural/design patterns in code. It uses AOP to perform this feat. Pattern Testing is a concept I started researching in 2002 on a big project at work. At that time, I was already using Checkstyle and PMD to perform verification of rules. However, I was finding them limited in several ways:
The result was the Pattern Testing project on SourceForge. It's implemented using AspectJ. It contains some pre-made Pattern Tests but more importantly it lets you write your own. There is Maven plugin that makes it easy to run any Pattern Test on any mavenized project. The possibilities of Pattern Testing are endless. Here's an example of a rule that says that we do not want to instantiate business classes (i.e. a class that extends BasicBC). That's because they are instantiated by factories/service managers:
I used Pattern Tests for some time on that project at work and then I changed job. I was still interested in the concept but with my other open source involvements I didn't take the time to work on it as much as I wanted. Thus it became a bit abandoned. However, these past weeks, I have found renewed interest in the concept for several reasons:
Are any of you using Pattern Testing too?
[
vmassol
]
11:32, Thursday, 8 April 2004
As part of my day work, I've met CAST Software in France. They are really nice guys. And they have a very good product suite that analyzes application source code and produces different kinds of reports (quality and reverse-engineering/browsing). The really nice part is their open architecture:
It's nice for the following reasons:
Compare this to existing open source tools (or not open source for some) like Checkstyle, Clirr, PMD, Findbugs, jcoverage, Simian, Clover, etc. They all use their own parsers and more important their own persistence format for storing the parsed data. Even though they almost all offer an XML report format, it's already processed data (as opposed to raw parsing data). Thus it is very hard to reuse the information from these tools to offer a higher level integrated view. It's also a lot of work for these tools to develop all the necessary parsers. What would be really nice is the creation of an open source project that does the following:
If such open source project existed, we could have parser projects which could parse Java code, .Net code, Hibernate configuration + code, Struts configs + code, AspectJ Aspects, etc. These parsers would user the common API to store parsed data in the common storage format, thus making the data available to other projects, such as the one mentionned above (Checkstyle, PMD, etc). These projects woud be analyzers and would use the common API to query parsed data and generate reports for their domain of work. With this, we could build nice analyzers that could completely check for full architecture best practices, across technologies and across frameworks. Do you think such a project would work? Note: Maybe CAST should open source this part (storage model) and keep as closed source their added value Parsers and Analyzers? :-)
[
vmassol
]
19:36, Thursday, 1 April 2004
I've been reminded of this idea by some posts on the Cactus mailing list. I'd venture that at least 50-70% of the the questions asked have already been answered in some form in the past, are available in the Cactus documentation or are easy to answer by some generic rule. I think it could be fun to train a bot to answer these questions. For those that the bot couldn't answer, the user would be redirected to the mailing list where Cactus experts would find the answer and train the bot so that it gets better next time. It should be possible to have rules that would generate the following kind of dialogue:
It would be cool! My only worry is that it would take too long to create the AIML files. But maybe not. Any experience? What would be even better would be that the bot would learn from the mailing list posts itself. However, that's probably science fiction at this point in time... Note: The image was borrowed from Alicebot.org
[
vmassol
]
08:58, Friday, 19 March 2004
I'm using SharpReader and I don't whether the following is true for other readers. Whenever a blog entry is updated by its author it appears in bold (indicating a change) and in italic (indicating that it's an update). However I have no clue what modifications were done to the entry and most of the time I don't have enough energy to read again the full entry trying to figure out by myself what has changed. What would be really nice would be that the RSS reader shows a diff, highlighting the changes (as it's done for CVS commit diffs).
[
vmassol
]
22:30, Monday, 15 March 2004
All continuous builds have a common point: when a project fails we have to find out why. There can be several reasons:
Solving case 1 is relatively easy. However, solving case 2 is usually quite difficult. How could we make it easier? Here's a proposal for improving continuous build tools: When a project goes from a "success" build state to a "failure" build state, perform a source diff (using CVS or whatever SCM used) between the 2 dates on both the project itself + all its dependencies. Then generate a report showing all the changes. This should allow to get a clear view of all the things that changed and that led to the build failure. This strategy seems especially well suited to continuous build systems as these builds are executed often and thus the differences between 2 builds should be small enough to get a clear picture. Has anyone done this already? Does it work? Note: I have suggested this idea to the Gump project. I would be very eager to see how it works out. Implementation details:
Limitations:
[
vmassol
]
09:06, Wednesday, 18 February 2004
Warning: Don't take this comparison too seriously... ;-) It's a bit like comparing apples and oranges and I'm sure the analogy breaks quite quickly if you pursue it too far. However, I do believe that the contained message is true. I've just realized that collaborative offshore and EJB have a common point: they are both using a distributed model. By collaborative offshore, I mean teams developing on both sides (onsite and offhsore) and interacting continuously to build a system. I've been working on 2 big offshore projects so far for the past 2.5 years (working with an Indian partner) and I've found that there is an organizational model that does not work well: onsite people directly managing developers (Figure 1). In the same way, calling directly Entity Beans from the client side is a bad practice because 1) it involves a lot of network round-trips and thus is inefficient and 2) it does not allow changing the implementation without affecting the client (Figure 2).
What is the solution we have used for EJBs? Answer: introduce a facade (Session Bean) which "manages" the underlying components (Figure 3). I've found that it is the same with collaborative offshore: there is a strong need to always introduce a local Project Lead (Figure 4).
It probably sounds very obvious but very often there is an initial tendency by onsite managers new to offshore to directly manage offshore "resources" (in order to reduce support costs). So far, whenever they've tried, it has failed (although we told them it wasn't a good idea but it seems some people need to see it by themselves to believe... ;-)). I wonder if there'll be a time in the future where our communications skills will be so great that it will allow direct managment across the wire. Probably... but this is still in the future... Has this also been your experience?
[
vmassol
]
09:18, Monday, 16 February 2004
Applying a working build strategy for testing against a database is not easy. It depends on the complexity of the database model, it depends on the size of the teams. However, I've found that the strategy described below is the one that has worked the best for the projects I have been involved in:
On the other hand, here are strategies that have not been working so well for me in the past:
Is that also your experience?
[
vmassol
]
08:23, Wednesday, 11 February 2004
I'm revisiting an old entry I posted about a year ago about Starteam woes. The reason is that the project I'm working on is delivering a first release soon and we'll be attacking the second leg of the journey... and it maye be time to lobby for a source repository change... :-). Thus I need to prepare my ammunitions again. By running it through you guys I hope to flesh out the inaccuracies of my points and possibly find new arguments in favor of... CVS. Yeah, I am biased! Here's what I feel is wrong with Starteam:
Any more? Any inaccuracy in there (I'm sure there are as I am biased!)?
[
vmassol
]
20:22, Tuesday, 10 February 2004
I've just learnt that there was a name for "a computer-generated test that humans can pass but computer programs cannot". It's called a captcha. You can see those on some web sites during registration. Here's an example:
Some of my Octo workmates are developing a java framework for generating captchas called JCaptcha. What I find interesting is one possible use of captchas: preventing spam. More specifically the idea would be to use captchas to prevent blog spam. It means that people who enter blog comments would need to be humans. What I don't know is whether blog spam is being done manually by individuals or if it's automated. In any case this solution will prevent automated blog spam which is a good first step! The JCaptcha project has just released a beta version. I guess one next step could be the creation of a MoveableType plugin. Then I would hope to convince Bob to let us try it on Codehaus blogs :-) Update 18/04/04: It seems that James Seng beat me with this captcha idea. Not only the idea but also an MT implementation. In addition, he's created yet another MT plugin for preventing comment spam by implemeting an MT Bayesian filter.
[
vmassol
]
15:28, Tuesday, 10 February 2004
I've started thinking about what would be the best possible IDE back in 2001. At that time, I had tried Sun's Jini and liked it quite a lot. I linked the 2 concepts (IDE and Jini) and came up with the idea of a Jini-based IDE. At that time I started writing down some ideas (here and here). However I did not pursue this idea as creating a full fledged IDE is a master achievement and I did not have the time nor the wish to do so! However, even today in 2003, I still think it had some nice ideas that I would like to see in existing and future IDEs. Here are some ideas about this Jini IDE:
Of course, this is a bit utopic as we would need to overcome several difficulties:
Of course, this IDE of the future could be implemented in a technology other than Jini (P2P, Web services, etc). I still believe Jini is way ahead of web services but they are catching up slowly on security, transactions. To my knowledge there's still no notion of "leases" in web services, nor of code that moves around the network and can execute locally. What do you think? Is that Jini-like IDE something you would also like to see in the future? Update: This blog entry has been reposted on TSS (several interesting comments).
[
vmassol
]
10:34, Monday, 9 February 2004
Imagine you have a continuous build system in place and that it builds automatically your projects every few hours. When the team is large it can be quite challenging to coach all team members in being careful about the build and that before committing code, people need to run the build locally on their machine first. There are also other problems, like the build works locally but not on the continuous build machine. Anyway, I've found that there are different kinds of projects. Some where the build is taken very seriously and a build-aware mentality quickly spreads and others where people do see the value of the build but have more difficulties taking it very seriously (leading to lots of build failures). One idea that I've had is to use a physical artifact to represent a build success or a build failure. People like to see and touch things. Doing some research I've found the Ambient Orb which seems close enough to what I have in mind:
(Image stolen from ThinkGeek) The idea is that the orb will turn more and more red depending on the number of projects that failed to build during the past cycle. I have yet to buy one and try it but I like the idea. Has anyone done this already? Can it be done easily with the Ambient Orb? Are there devices other than the Ambient Orb on the market (for example, I don't need the wireless radio network connection at all especially as I live in France)? Update: This blog entry has been reposted on TSS.
[
vmassol
]
16:11, Sunday, 21 December 2003
Cactus v2 architecture
RationaleWhy a new architecture? Several reasons:
Architecture choicesThese are the high-level architecture choices on which Cactus v2 will be built:
High level architectureThe Cactus system is composed of 3 parts (see figure 2):
Cactus test case exampleHere is an example of a typical Cactus test case using AspectWerkz 0.9. Please note that this example is a work in progress and is non-functional at this stage. We're also working towards simplifying the syntax for test case writers: We would like to be able to write the following (not yet supported by AspectWerkz but we've had commitment from the AW team that they will make modifications to support it! :-)). The difference with the previous sample is the removal of the inner aspect class + the typed poincut interception. Detailed designThe detailed design of Cactus v2 is shown in figure 5 below.
It works as follows:
Some additional comments/ideas:
ChallengesThe following challenges await us:
Please challenge us to improve our design! :-) Disclaimer: Please also note that, at this point in time, this architecture and ideas are only mine and do not represent (yet!) the official view of the Cactus project. I am proposing it to the Cactus project members.
[
vmassol
]
12:29, Monday, 1 December 2003
Currently the Cactus project is a framework to help unit test J2EE components (and mostly Servlet/JSP/Taglib). I'd like to expand its goal and make it a framework for building in-container testing solutions. Cactus would still offer an implementation for J2EE component testing but it will also open up an API for plugging other implementations. Some ideas are shown on the diagram below.
For this to happen, the core helper classes will have to be separated from the HTTP protocol implementation and the existing Cactus TestCases. 2 SPIs will appear:
Moreover, the Cactus integration modules (aka front-ends) will also need to provide clearly-defined extension points to help automate the whole process of starting the container, deploying components, running the tests and shutting down the container. I'm currently working on the Cactus code to make the 2 SPIs surface. The first test drive of these new SPIs will be to implement support for EJB TestCases.
[
vmassol
]
12:10, Sunday, 9 November 2003
Joel Shellman has coded an extension (easymock-patch-1.0.jar) of EasyMock which allows to mock class (and not only interfaces). To use it:
Here's an example. First let's start by the class we wish to mock:
Here's now the class we wish to test (it uses the Calculator class):
Now, here's our test of
Note: I don't know how to instantiate a constructor taking primitive types. Don't know if it is supported. That's nice. However, there are a few drawbacks I can see:
So it's not a silver bullet but it will certainly help in cases where you have no control over the sources (like when using third-party libraries.
[
vmassol
]
08:32, Saturday, 27 September 2003
Let's imagine you wish to perform unit test for code that calls the database. Let's also imagine that you want to test in integration, i.e. verify that the SQL query does actually goes to the database and returns database data. The traditional approach is to:
There are several disadvantages to point 2:
One solution that our project team discussed yesterday is about using transaction rollbacks. It would work as follows:
I was suprised to see no mention of this on the articles mentioning database unit testing (http://www.dallaway.com/acad/dbunit.html, http://www.dbunit.org/bestpractices.html). The reason may be that there are some glitches with this technique that make it impossible to use in practice... I'd like to know what you think? Have you done this before? Notes:
[
vmassol
]
19:54, Saturday, 30 August 2003
The mock object strategy is nice but how do you apply it when you have some existing code that uses tons of static calls, does not have setters prepared so that you can introduce your mocks, etc? One solution is to use AUT: AOP Unit Testing! (hehe... yet another acronym :-)). Let's try that by writing a unit test using AspectJ for an EJB. Let's imagine we want to unit test
the following
Note that the nasty calls to Our challenge here is to unit test this method in isolation from the rest. Here are the corresponding unit tests:
one to verify it works when there is no exception (
Note: I highly recommend using Eclipse 3.0M3 and the latest AJDT plugin if you wish to run this code. The AJDT works great for writing AspectJ projects. That's quite nice and it works nicely but as you have noticed the test code is neither very easy to write nor to read. What I would love is a dynamic language geared towards writing these kinds of unit tests! Could Groovy provide that? That would be soooooo nice!
[
vmassol
]
14:49, Saturday, 30 August 2003
James Strachan has posted a news about starting a new dynamic language for the java platform called Groovy. He mentions using it for writing unit tests a la JUnit. I think that's an excellent idea! On most projects I've been on, writing good unit tests often comes late in the development. Usually people write functional or integration tests but rarely unit tests which test code in isolation from the rest. And once the design best practices have been decided and lots of code has been already written, writing unit tests is hard because it requires severe refactoring and design changes. The hard part is the introduce mock objects in the code under test. Some code uses statics, other instanciate domain objects instead of them being passed to it, etc.
Of course, extreme TDD practictioners would say that it is much better to refactor the code under test so that it become more flexible and better able to support change. That's true but that's difficult to practice for the majority of projects and difficult to apply if the project has not been started the TDD way. What would be nice is to have a dynamic language geared towards introducing easily changes to the code so that it can support the mock objects approach. There is a unit testing framework out there that does almost this; it's called AgileTest from Polygenix. Maybe Groovy could extend the ideas from AgileTest and become a generic dynamic language to easily insert mock objects (among other things)? Sprinkle this with an AspectJ-like syntax and you've got something quite nice! I know I'm probably changing the original idea but what I'd love to have is a language purely geared towards unit testing What do you think?
[
vmassol
]
17:53, Tuesday, 26 August 2003
About 2 years ago, I discovered the Concept Map idea and I began to do a simple proof of concept as shown by the following diagram.
Note that more thorough examples are available from the NASA web site. I would like to revive this idea and start drawing some concept maps about the JUnit ecosystem. I would like to have some of these maps in my JUnit in Action book but I would also like to set up a collaborative web site gathering all knowledge around JUnit using these concept maps. This is all nice but the software I used then (IHMC Concept Map Software) is now very old (2001), the GUI is flaky and the software does not lend too well to distributed updating of the maps on the web (it uses a custom server which opens a specific TCP/IP port and thus does not easily allow updates behind a firewall, etc). I need your help! My questions to you are:
Thanks!
[
vmassol
]
09:47, Sunday, 13 July 2003
I have been coding in java for the past 6 years and I thought I knew the language and platform quite well. Well, two days ago I was proved wrong as I discovered a new facet of it that I wasn't aware of: binary compatibility... There is a good article called Evolving Java-based APIs by Jim des Rivieres. It's a complex subject that not a lot of persons are aware of and which is extremely important if you're a framework writer. Let me give one example. Imagine you have a Now, if you think you can safely refactor the Indeed, code that has been compiled with the first version of the framework will
have a reference to What it means is that preserving binary compatibility is difficult and is something that strongly impacts how you design your APIs. Using delegation has to be preffered over class inheritance as it will allow you to change the implementation without breaking binary compatibility. That's what was new to me. So far I had been designing simply using the OO concepts and choosing the pattern the most adapted. Now, I've discovered that I also need to introduce the binary compatibility aspect in the picture and that it drives my design choices! Evolving Java-based APIs is really difficult...
[
vmassol
]
21:55, Sunday, 8 June 2003
Here are some persons that will be blogging from JavaOne 2003
If you know others blogging from JavaOne, let me know and I'll add them.
[
vmassol
]
09:12, Monday, 2 June 2003
Some time ago, I blogged about Subversion. One of things I noticed was the lack of a good Eclipse plugin. Daniel Bradby has informed me he has just released an Eclipse plugin for Subversion. I haven't tried it yet... If you have I'll be happy to know what you think. Update 22/07/2004: There is now a TortoiseSVN wrapper plugin for Eclipse which seems quite nice.
[
vmassol
]
11:05, Saturday, 17 May 2003
Having project documentation written in XML (xdocs) and stored in the project's CVS is great as it allows changing the style without chasnging the content. It also allows to easily write directly the docs in XML format That said, lots of persons do find that writing xdocs is a pain. Moreover wouldn't it be nice if end users could easily contribute to the documentation? Here's a solution:
Nice, no?
[
vmassol
]
09:13, Tuesday, 13 May 2003
Scott Stirling has posted a nice followup of the initial StarTeam woes I posted some time ago.
[
vmassol
]
11:24, Monday, 12 May 2003
I knew I was missing something! For some time I've had this feeling that everyone was enjoying some way of getting interesting news that I wasn't aware of... Now I know it was true... :-) I've, at last, discovered the joy of RSS syndication. This is a revolution for me. I was used to opening my browser every morning and scanning my favorite sites... No longer. I'm now using FeedReader, a very nice windows application that automatically polls your favorite RSS feeds and displays them in a nice manner. The other nice features are
To get you started, here is my list of subscriptions (FeedReader format). Drop this file in your Update:: I've just discovered that there are some other very nice RSS feed readers (I haven't tried them yet though): Syndirella and SharpReader. Update:: Thanks to Scott Stirtling for the best RSS Feed Reader / News Aggregators Directory he's seen.
[
vmassol
]
23:07, Monday, 5 May 2003
This morning I've started reading about Subversion. I am very excited and have a few reservations. On the positive side:
On the negative side, it is still missing the following to be perfect:
[
vmassol
]
23:06, Monday, 5 May 2003
I have been working on a new project with the StarTeam SCM. Here are the drawbacks I have found when using Starteam vs CVS/Subversion:
|