Tuesday, October 29, 2013

More On the Simplifying Development Of Addons

In my last post on simplifying add on development all the exposed mechanics of building class (or interface) structures was driving my nuts.  One of the things I don't like about Roo is the API.  However the beauty of open source is I can do something about that.  It's put up or shut up time.

So I did something about it.  And in my last post I presented a facade class that wrapped the complexities of Roo API allowing simpler, and at least to me, more comprehend able method declarations.  My focus there was methods because I was implementing a bunch of ITD methods.  The transformation worked out well.  I was pleased with the result.

But the transformation left me questioning other code that I wrote.  Sure I did methods but what about classes?

I went back and looked at prior code. It wasn't as bad as I imagined but there were opportunities to clarify.  Principally the lesson there was; sure the methods worked out neat but what about classes and fields?  And that made me do back and redesign implementation to support the missing pieces.

Adding support for classes and fields rounds out the primal components needed for Java components.  However another aspect for manipulating these structures is the in addition to creation of elements we also need to handle modification of those complements too.

All of this of course meant and end to having one class do all.  I was stretching it before on that front and with the added functionality that was out of the question.  So the resulting code is now a collection of classes.  This in turn means handling multiple files and that in turn mean packaging.  Now I have split all this out on a separate project since I am anticipating that I will reuse this code in additional add-on's.

The source code now resides at; https://github.com/DanRepik/RooUtils.

Currently, the organization is simple there are builders for ITD's, classes, methods and fields.  All these builders extends from a parent class 'IndentifableAssetBuilder'.  Since all of these Java structures can have annotations this parent class provides common handling of that aspect.

Enjoy.

No comments:

Post a Comment