Apr 13

aUnit 0.1: Unit Testing Aspects

AOP, Java, Tech 3 Comments »

Good ole Russ Miles has announced aUnit.

The big question, is how long will it take before we see aTest NG! :)

Hi everyone,

The first release of the source and binary distribution of aUnit is now available from www.aunit.org (via Sourceforge). This release contains a framework that piggybacks on the JUnit framework so it can take advantage of the existing JUnit integration with Eclipse. The aUnit framework executes a series of test steps that each present a representative context to the aspect being tested, executing the corresponding advice as required by the test developer.

This release relies on AspectJ 5M2 and Java 5 (due to the use of annotations) but in the next revision I’m hoping that we can put something together that works without the need for annotations (using something like the ASM to construct implicit contexts).

The important thing is that this is a working test framework now with a set of examples available in the source download to show you how to create aUnit tests. I’m now looking to put together some how-tos over the next week or so and then some more comprehensive tutorials as the feature set matures.

Thanks to everyone for their suggestions, especially that AspectJ team. Hopefully now aUnit can mature into something truly useful.

Have Fun and any support in the development of aUnit is greatly appreciated!

Cheers,

Russ Miles

Apr 13

Value types in Java: Striving for the stack

Java, Microsoft, Tech 6 Comments »

I have recently had some .NETers claiming that they do now know how we live on our side of the fence in Java-land, without value types. They laugh in our general direction as they add structs to the stack.

I do understand that value types can be useful. I do understand that it will take longer to dereference an object each time vs. not having to do that bypassing the heap entirely. There are lots of good things there.

However, I am actually quite glad that we don’t have value types. Simple put: Have you missed them? I haven’t! I haven’t run into a performance or scalability issue that was profiled, and the result was “man if we could just put this String on a stack we would be fine”. It just hasn’t been a problem.

On the other side, if you flip through Effective C#, you see items dedicated to value vs. reference types. Sneaky methods like EqualsReferences vs. EqualsValues. Subtle differences. Common mistakes.

So, give me partial classes, and true delegates, but keep your value types :)

Apr 12

Go Multidimensional with AOP and Annotations

AOP, Java, Tech No Comments »

Ramnivas is ready to take you to other dimensions in part two of his articles in the AOP@Work IBM developerWorks series: AOP and metadata: A perfect match, Part 2: Multidimensional interfaces with metadata.

In the first half of this article, I introduced the basics of the new Java

Apr 12

Core Data: Room for a Java port?

Apple, Java, Tech 1 Comment »

Apple keeps on trying to make it easy for developers to develop top quality applications. In Tiger they are introducing Core Data, which is a managed object model.

Basically it gives Cocoa a nice simple way to develop a model that doesn’t just map to some database.

Core Data lets you create an ERD with Interface Builder, which acts as a model.

Data Store Formats

In Tiger, Core Data support three different kinds of data store formats to save managed objects contexts to. These formats are:

  • XML file format
  • Binary archive file format
  • SQLite database file format

Each of these formats has its strengths and weaknesses. The XML format is a good testing format as it is fairly human readable. The binary format is not human readable, but provides better performance than the XML format. Both of these formats are atomic

Apr 12

Caller context and list.add(..).add(..).add(..)

Java, Perl, Tech 12 Comments »

One of the first things that bugged me about Java when I first started to use it was a small thing. Why didn’t add() return the list (or Vector back then) so I could chain the calls together.

I wanted to be able to:

Vector v = new Vector().add(”foo”).add(”bar);

The same goes for having chained set* methods:

foo.setA(a).setB(b)

We see this used, especially in certain packages such as Hibernate.

One feature that I liked in Perl was the ability to know about the callers context:

my $scalar = @list; # or function which returns a list

is very different to:

my ($element) = @list; # or function which returns a list

Sometimes I would love to do the same in this world and say “If the caller of my set method wants the object back, give it, else we are in void world and that is fine too”.

Of course, I don’t think this would happen :)

Another way to make me a little more happy would be to give me named parameters, but that doesn’t give me the same power.

Apr 11

Process, Threads, and Scaling

Java, Ruby, Tech 22 Comments »

Jon Tirsen took some time out of his day surfing in Oz to write about the FastCGI approach to scaling vs. the Java way.

Watching the talk on the Ruby side of the house has been a blast from the past for me. I remember a LONG time ago, testing a Perl based web application under FastCGI and mod_perl.

One of the big problems at the time was damn leaks. One advantage to the old fashion CGI environment, is that a programmer can be very sloppy and get away with it. You forgot to close something? Weren’t a good boy with some resource? No matter, the proc will die in a sec anyway.

Moving to the new model changed all of that, and people found a LOT of bad things in their code.

At the time mod_perl was a big winner over FastCGI, and I have been surprised to see how it has grown up.

There are obviously pro’s and con’s in the process/thread game. That is why Apache 2 has the nice hybrid approach, and you can choose your strategy depending on the platform you are on etc. All processes are not created equal. Ditto for threading. Remember running WLS without the native ‘performance pack’ enabled? Holy slowness :)

We are also seeing a lot of great things coming out of the JVM vendors such as JRockit to give us the best of both worlds. Hopefully we can all learn from eachother…

Apr 11

YACMS: Container Managed Swing

Java, Tech, UI / UX 222 Comments »

Ben had to add another CMS acronym didn’t he. He has been talking about the idea of taking the tough threading stuff out of the path of the Swing developer.

Now, after badgering us all about it, he blogs about it.

If a project can pull of the vision, it can only be a good thing. It is arguably necessary for Swing to be what it wants to be. With all the complexity that EJB brought, one of the nicest features was that the container would handle threading for you.

Let’s bring that to Swing, but let’s not call it CMS ;)

Apr 08

Maven 2.0 Technology Preview Release

Builds, Java, Tech 11 Comments »

There has been a lot of talk on the release schedule of Maven in the past (remember people desperate for 1.0 final? :). Now we have people asking to see the new and improved Maven 2.0, and we have a tech preview release:

The first Maven 2.0 Technology Preview release is now out.

Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information.

http://maven.apache.org/maven2/

We’re looking forward to hearing your feedback, ideas, and (to a lesser extent :) bug reports.

If you need help with the release, please consult the documentation frequently as we continue to update it, and subscribe to the [email protected] mailing list. For more information, please see http://maven.apache.org/maven2/about.html#get-help

We welcome contributors to the Maven project – if you are interested in helping out, please get involved!

Thanks to everyone who has worked on this release!

– The Apache Maven Team

Features

Maven 2.0 has the following major features:

  • Simple project setup that follows best practices – get a new project or module started in seconds
  • Consistent usage across all projects means no ramp up time for new developers coming onto a project
  • Superior dependency management including automatic updating, dependency closures (also known as transitive dependencies)
  • Able to easily work with multiple projects at a time
  • A large and growing repository of libraries and metadata to use out of the box, and arrangements in place
    with the largest Open Source projects for real-time availability of their latest releases
  • Extensible, with the ability to easily write plugins in Java or other scripting languages
  • Instant access to new features with little or no extra configuration

The following features are available in Maven 1.0 and will be available and much improved in Maven 2.0 through the coming releases:

  • Deployment and release management
  • Comprehensive project information and reporting
  • Website and documentation building tools

On the reasons/goals

You’ve seen above the goals that Maven aims to achieve, however there have also been questions about why Maven 2.0 is rewritten from the successful Maven 1.0. In summary, the main goals of the new Maven 2.0 architecture are:

  • To be simple to use – it should be more obvious and consistent about how things are working
  • Fast – a new architecture and smaller memory footprint make it as fast as possible
  • To be able to implement the features demanded that were not possible under the Maven 1.0 architecture

Unfortunately, to reach these goals – we’ve had to sacrifice backwards compatibility to do this. Instead of making many small incremental changes that would break compatibility often over time, we decided to build on a new, solid base that can be reliable for the future, and also to maintain the existing Maven 1.x product to ensure that existing users are not left out in the cold.

Apr 08

Apache Beehive PageFlows vs. Spring WebFlow

Java, Lightweight Containers, Open Source, Tech, Web Frameworks 5 Comments »

Way back in time I worked on early releases of BEA’s Portal server. At the time they had their own MVC framework webflow, and it was a little painful to use (Remember the Rational ROSE tools for the Commerce product?).

However, that was many many years ago, and it has gotten better each release.

Now a lot of the same learning, is in place with Apache Beehive NetUI and PageFlows frameworks.

The Spring guys came out with a WebFlow component, which covers some of the same ground. How do they compare? At a high level their pro’s are:

Spring WebFlow:

WebFlow, although immature, does have an interesting goal in that it works on top of ANY web framework, and isn

Apr 07

AspectJ 5 M2

AOP, Java, Tech 4 Comments »

The AspectJ train keeps rolling. The team has announced the second milestone release:

We’re pleased to announce that AspectJ 5 M2 is now available for download at

http://www.eclipse.org/downloads/download.php?file=/technology/aspectj/dev/aspectj-1.5.0M2.jar

The changes in AspectJ 5 M2 since M1 are numerous, and the highlights are listed below.

* Full source compilation of Java 5 programs (with the “-1.5″ option)
* New Xlint warning when advice does not affect any join points (and the @SuppressAjWarnings annotation to suppress it) (-1.5 only)
* @this,@target,@args forms changed from @this(@Foo) to @this(Foo)
* Full support for annotation binding as context in @this, @target, @args, @annotation, @within, @withincode
* Declare annotation (declare @field, declare @method, declare @constructor, declare @type)
* Declare soft does not soften runtime exceptions
* pertypewithin instantiation model
* performance improvements resulting in reduced compilation times
* aspectpath has been extended to accomodate directories as well as jar/zip files
* many, many bug fixes

The AspectJ 5 Developer’s Notebook has been updated to reflect the updates. So many people have contributed ideas, suggestions, and bug reports to M2 that it’s impossible to list you all – but you know who you are, so thank you. Come 1.5.0 final we’ll put together a roll-of-honor :)

For examples of some of the new features in action check the following links:

* http://www.aspectprogrammer.org/blogs/adrian/2005/03/event_driven_ar.html
* http://www.aspectprogrammer.org/blogs/adrian/2005/03/ramnivas_on_ann.html
* http://www.aspectprogrammer.org/blogs/adrian/2005/01/making_concurre.html

and also the AspectJ 5 Developer’s Notebook: http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/ajdk15notebook/index.html

Thanks and stay in touch,
The AspectJ Team.

Some of these features are really great. I love the @annotation stuff, and the pertypewithin instantiation model.

aspectpath has been updated. I wish that these classpaths could be directories that CONTAIN .jar files too (as many people have wished).