Develop Simply

Ivan K's development musings

Jamming to the Future

It’s been a long time since my last publication, but I’ve not been gone to a deserted island or anything, just working quietly in the shadows. And I think I am at last ready to come out and introduce what I and the Clippings team have been working on for so long. But first a very quick history tour.

The Kohana framework is really great most of the time - great request handling, caching, module management, database query building etc., where I find it somewhat lacking (and I mean like What-the-hell-guys-put-your-shit-together type) - is the ORM. Yes it works for most of the basic use cases but its only a very thin layer over the Database builder. By the time we started the project there was Jelly - a really inspired little ORM that promised a lot and did it with very little clean and concise code. I immoderately fell in love and started using it instead the built in ORM - and it was working great, up until the point I realized that it was a “dead” project and nobody actually added new stuff to it. No problem - I like to extend things - so little by little small pieces of code were added to the project by us and at one point I just decided - this is not Jelly anymore! And so we now have a new feature rich library for handling database persistence - Jam.

While the Jam library is a spiritual successor of Jelly, the internals are quite different because of the loads of bundled up functionality that had to be added. Because it was developed over time over the Jelly code base, some of its design don’t fit particularly well and will probably be replaced by a more consistent interface in the near future. And I had to remove the eager loading functionality (load_with()), which in my tests performed worse than simply loading all the models anyway, however, you gain quite a lot in return - stuff like:

  • Lazy loading of collections - the query is executed at the last possible moment so you can easily cache it in your views.
  • Build in validation in the model, Active record style - no more unhanded exceptions and weird error message file locations, and validation rules are handled much more developer friendly
  • Polymorphism - polymorphic ‘belongs to’ and ‘has many’
  • Uploading files to different back ends transparently (local, Rackspace, FTP), and by different means (Ajax uploads, URLs)
  • Built in behaviors - Paranoid, Sluggable, Nested, Sortable, Uploadable
  • HTML Form builder with automatic errors integration and nested associations

And these are just off the top of my head - there are many many small additions and fixes, and most importantly tons of documentation for the existing functionality.

So take a look at Jam (and the corresponding Jam Auth) and tell me what you think.


P.S. Kudos to Jonathan Geiger and all of the maintainers of the jelly project - it really is a great inspiration. I tried to hold the spirit of jelly true, but with all the new functionality that had to be added I sort of abandoned the idea of “keeping it really small” and went with “add a lot of useful features” approach.