#2152 [ANN] afIoc v1.3.0 - Proxies and Aspects!

SlimerDude Wed 29 May 2013

afIoc v1.3.0 now released!

A powerful "Inversion Of Control" (IOC) framework

This version brings Proxies and Aspects in to the mix!

Proxies

A proxy implementation is dynamically generated for any service fronted by a mixin. Creation of the real implementation is delayed until the first time a method is called on the proxy. This helps reduce cyclic / recursive injection issues.

This also allows thread scoped services to be injected into const application scoped services. All method calls on the thready service are then routed (via the proxy) to the correct instance. See the Request and Response services in afBedSheet for real world usage. You can inject these anywhere and they'll always call the appropriate impl.

Aspects

Intercept any calls made to a proxied service! Then change the parameters, alter the return value, catch Errs and generally do what you will with it!

Why? Contrived real world examples include parameter logging, transaction wrapping and service authorisation. I'm sure you can think of more! See @Advise for more details.

.

For the record, I see afIoc v1.3 as now being feature complete. As the road map for a core IOC / DI framework went, v1.3 is what I envisioned. Future releases will, more than likely, just be tweaks and bug fixes.

Have fun!

LightDye Mon 12 Aug 2013

Hi SlimerDude,

Is there a PetStore-like application built using your frameworks afIoc and afBedSheet that I can use as a reference to start a new project from scratch?

SlimerDude Mon 12 Aug 2013

Hi LightDye,

In short, no there's not. :(

I was wondering the other day though, what would be more useful: an example app (as you suggested) or a cookbook with example code snippets of common useful scenarios. (The latter could go on the BitBucket wiki.)

afBedSheet (by design) is pretty low level though and mainly concerns itself with HTTP handling. It does nothing in the way of HTML templating and form validation, which you need for a complete web app.

I've been thinking about Fantom webapps in general, and I believe there are still some libraries missing:

  • Templating: Current options tend to be either web::WebOutStream or Mustache which tend to be two opposing extremes. As such I'm in the middle of an afIoc Embedded Fantom (efan) library - think of EJS for Javascript and ERB for Ruby.
  • Scripting: Something Tales and Fanquery did, was attempt to merge the discrete boundaries between server code and Javascript. I'm looking at a similar library for afBedSheet, but one that doesn't tie you into specific JS libs or versions. It's early days still, but I'm hoping it'll pave the way for seemless ajax client->server eventing. (Don't worry if it sounds vague - it is!)
  • WebSockets: This is more of a nice to have, but still, I'm working on it and should have a preview release out soon.

If the scripting lib works out, then I think complete web apps will be a real possibility. Until then, I hope efan and websockets will make web dev more fun!

Steve.

SlimerDude Mon 12 Aug 2013

Oh, there's a mini app used for testing in the BedSheet source. That may be a good place to start for some common routing examples. These are the web tests.

LightDye Tue 13 Aug 2013

Wow!, all this looks very promising, I can't wait!... hmmm, actually I can and I will. In the mean time I'll have a look in BedSheet source for the test app. Thank you.

Login or Signup to reply.