I have developed an interest in getting DB4O to work with scripting languages, as regular readers of this blog will know. I have had less time this week than I would like, but I will be posting some examples of DB4O working with Jython.
 I have been thinking of building a small web-enabled repository using Jetty or Restlets with Jython and DB4O. Sorry if this does not happen instantly, but it will happen.
I also want to return to Ruby on Rails running on JRuby – I would like to look at integrating DB4O support with Active Resources. It would be nice to define a model and get DB4O CRUD at no additional cost – this seems like a worthwile effort, and it would be good to get experience with Active Resource.
Then, after tackling RoR and Jython, I would like to try my hand at using DB4O from Quercus. Quercus is an implementation of PHP that runs on the JVM, giving PHP the ability to use Java libraries like DB4O.
Later, I would also like to try to use DB4O from Grails, another Ruby on Rails derivative that runs on the JVM using Groovy. The possibilities for DB4O are huge – DB4O can go wherever the JVM can go.
It looks like Microsoft’s common language runtime approach is taking the Java world by storm – the JVM is becoming the new CLR. For a long while now, it has been possible to author applications in multiple languages and run them under .NET or Mono. I think that is a good idea. Java is on the right track – it has to become easier to write applications that run on the JVM.
Obviously, DB4O is available in any language that runs on the CLR. However, I just want to make note of the trend of running scripting languages on the JVM – this opens the doors for DB4O in many important ways.
When I has some solid code, and a tutorial to go with it, I will begin posting in the DB4O forums.
I will provide details later – I will probably also post to the DB4O forums – but here is the readers digest version: I have found that Jython and DB4O can play well together.
It was easy enough to create an instance of any Java class, use it, and save it using DB4O. However, I was unable to save my own objects, even if I inherited from another Java class. There is a way to compile these classes such that they can be used in a Java project, but that seemed like an extra step to me – I wanted simplicity.
To keep things simple, I created my basic classes using Java, and then I created a jar of the class files. I was able to create instances of these using Jython, I was able to use them, and I was able to save them. That seems good enough for now. I had hoped to find a way for someone who had little or no knowledge of Java to create classes and save them, but I still think my approach is useful.
If one is prototyping a new application, Jython is good if you want to write less code, and if you want to quickly develop your ideas. I will demonstrate this by recreating examples from the DB4O tutorials. Jython is a good glue, and I hope to show how it can be useful.
I expect that my approach will work with JRuby as well, which means that DB4O could be made available in Ruby on Rails running on the JVM. There is probably a good way to create something that looks and acts like Active Record for objects that works with DB4O. Active Record shows that you do not have to use SQL if you do not want to – the next step is to show that you do not have to use an RDBMS is you do not have to.
Watch for code and examples when I have time.
In my previous post, I mentioned in passing that I like Python better than I like Ruby; therefore, I am more attracted to Turbogears than Ruby on Rails. That statement is true. I also stated that I could change my mind as I got used to Ruby on Rails.
One of the features or characteristics of Rails that could make the difference to me is number of plugins that are available for Ruby on Rails. The community has been very active. I have just started using the streamlined plugin – I will let you know how it goes.
Update: streamlined seems a little temperamental. I am sure I am the source of the errors, but my expectation is that frameworks should just work. I am displeased. I am getting the following error:
rake aborted!
undefined method `Join’ for File:Class
I can roll my own code in the time it would take me to figure this out. Rails may have an advantage because it provides many plugins, but they have to be very easy to use. And, there has to be some quality control. Perhaps a rating system by people who are currently using each plugin – perhaps there is one out there. Oh well – I will continue using a plain old scaffold for now.