Last time I had to develop a standalone application which would rely on a database, I had to design the whole data model, deploy it into a RDBMS, implement DAOs for CRUD operations and, only then, implement my business logic.
Nowadays, things are so easily made that any dumb ass with access to Google and a Java/C# compiler can do that in no time (RoR developers, stop your urge to coment right here, please)! With C# or Java and db4o, or Java (version 5.0 or later, for JPA) and Derby you can forget data modelling and deployment and go directly for code development. Just create your classes, and start implementing your business logic.. Your database will be magically generated, deployed and persisted!
So, you have almost for “free (as in code)” the following capabilities:
- Persistence;
- Transactional operations (ACID);
- Object-Oriented querying;
- Standalone or Client/Server environment;
- Minimal footprint;
I recommend everyone, even the ones developing enterprise applications to give some time to these technologies. Perhaps you’ll learn something about flexibility and easiness.
Take a look at one C# example:
using System;
using Db4objects.Db4o;
public class Test {
static string _file = "store.db4o";
// A very basic db4o example that demonstrates
// automatic schema generation and Query-By-Example
public static void Main(string [] args) {
using (IObjectContainer db = Db4oFactory.OpenFile (_file)) {
db.Set (new Pilot ("Michael Schumacher", 101));
db.Set (new Pilot ("Rubens Barrichello", 99));
db.Commit ();
IObjectSet pilots = db.Get (new Pilot(null, 101));
foreach (Pilot p in pilots) {
Console.WriteLine (p);
}
}
}
}
public class Pilot {
string _name;
int _points;
public Pilot(string name, int points) {
_name = name;
_points = points;
}
public override string ToString() {
return _name + "/" + _points;
}
}