Post XtC thoughts: Frameworks /

Post XtC thoughts:

Frameworks / Infrastructure code / Plumbing, call it what you will. It should be easy, really easy to use. If the framework coders have to perform unnatural acts to ensure that the users of the framework don’t have to, so be it. That’s part of the appeal anyway (or is that just me?). Writing frameworks is something of a masochistic activity in that sense. Producing something that is so easy to use its almost a no-brainer. Hard to use frameworks won’t get used. Or if they do, they’ll probably be misused. Its a tough balance. You want to make the lives of developers using your framework easier, without making their decisions for them, or taking away control.

AltRMI is a good example of a framework done well – its what RMI should have been. Simple exterior, clever interior.

Paul Hammant had some wise words to say on interface / implementation separation. So important for reuse, testability, just about everything thats worth having. The collections stuff from Java 1.2 being a good example:

 Map myMap = new HashMap(); 

What if I want a map that survives restarts?

 Map myMap = new PersistentMap();

Done and dusted. No client code ever needs to know. The counter example being java.io.File. What if I want to slot in a caching file layer? or some other data source that pretends to be a file? Out of luck…

Want reusable code? Interface – implementation separation.

BTW did you know that

BTW did you know that in JSP 2.0 you can create blocks of JSP code as ciustom tags or as variables and pass them into other JSP blocks. So you could pass the header & footer blocks into a JSP page or custom tag. This might be worth bearing in mind in your ‘composite view framework’ from a previous post. Is that what the ViewBeans project is gonna be? [James Strachan’s Radio Weblog]

Something along those lines. The general idea being that a web designer designs components, ‘pagelets’, small chunks of HTML, whatever, with placeholders for the data. Each ViewBean class is mapped to a different HTML component. The page is constructed by pulling the fields out of each bean in a list and merging them with the components. The completed HTML is then appended to the output stream. The therory being that the object graph in memory determines how the page is built. No logic on the page at all. Not quite sure how (or even if) it will work yet, but that’s half the fun…

Thank goodness for Radio’s blog

Thank goodness for Radio’s blog by mail functionality. Otherwise I’d be risking
serious withdrawal. I’m also going to look incredibly prolific when all the
posts arrive at once!

James Strachan has put up a link to me, cool! Returning the favour, you can
find his current blog here, and his new one here. I’ll add a link to
my luminary list once my technical tribulations have been resolved.

First off, this is being

First off, this is being written on tuesday morning – there may be a delay
before it appears on the site due to an unfortunate confluence involving a new
pc, a missing keyboard and a broken network card. Sigh.

Upon skimming my last few posts, there does seem to be a preponderance of .NET
related stuff. Russell Beattie made the point best.
Very funny!

It appears I may be suffering from shiny new toy syndrome. Always a danger when
there are so many toys to choose from. I plan to put together a more detailed
piece on .NET / C# vs. Java in the near future, and I promise I’ll say bad
things about it! C#’s inheritance mechanism for example. Its just wierd.

Microsoft are offering a 60

Microsoft are offering a 60 day trial
of Visual Studio.NET. Mine should be arriving early next week.

What I’m most interested in trying is the java
language conversion assistant
plugin. Although why they felt the need to
make it require VS .NET is beyond me. A stand-alone conversion tool makes far
more sense from the perspective of persuading java developers to at least
evaluate .NET.

Note that I’m not trying to evangelise either platform here. Language is a
tool. Java is top of the heap today. It won’t always be so. I don’t know if
.NET is the thing that will topple java, I also don’t know whether it isn’t.
Time will tell.

I’ve been looking for a

I’ve been looking for a while for a decent composite view framework for java web apps. Most of the ones I’ve seen so far tend to focus on the view as being a single JSP / Velocity page etc, with dynamic bits inside the page doing conditionals etc. Using taglibs can push some of the logic out of the page itself, but the focus is still on simple pages where the iteration is limited to repeating rows in a table. What if I want the ‘list’ part of my page to contain an arbitrary number of heterogenous components, that have different data fields and need to be displayed differently?

Forgetting trivial things like ‘can it be done’, what I’m considering is to build up a simple composite object model, essentially a collection of beans, whose fields are either strings or other simple beans. What I’d like to do then is go through the collection, select a template for each bean, and insert the bean’s field values into the template. When one of the fields is another bean, lookup the view for that bean, and recurse as necessary. When you get to the end of a bean’s fields, append each populated template to the output stream.

In theory this should allow the designers to design each visual element independently (as a JSP for example), and the overall view would effectively assemble itself based on an object model in memory. No need for conditionals, iteration, or any of that other stuff on the page. Do all the logic in the code, assemble your beans, and splat them onto the page.

Its all a bit speculative at the moment, but I’ll mull it for a while until I realise that it can’t work or (even better) find one that someone prepared earlier.

Grid computing. Supposed to be

Grid computing. Supposed to be the next big thing. I’m sure it will, although

possibly not in the same explosive fashion that the internet was. The internet

was a brand new thing – a whole new paradigm in communication and connectivity.

Grid computing is essentially a new means of using the existing ‘net

infrastructure. An evolution rather than a revolution.

The forerunners of the grid are already starting to appear. The SETI-at-home

project, P2P file-sharing etc. Its not too great a leap from sharing MP3s and

parcelling out pieces of the sky for signal analysis to active collaboration of

distributed nodes to solve complex problems or provide services.

There are a few projects working in this area, the ones I can remember off the

top of my head being:

The JTrix project.

Gaia from The Mind

Electric.

[Insert obligatory cyberspace/the matrix homily here].