SandstoneDb – Simple ActiveRecord-style persistence in Squeak
16 July, 2008
Ramon Leon has released a tool he uses to simplify the development of Squeak applications. Called SandstoneDb, it’s a simple MIT-licensed object database that uses SmartRefStreams to serialize clusters of objects to disk.
Ramon needed “a simple, fast, configuration-free, crash-proof, easy-to-use object database that doesn’t require heavy thinking to use …[and] that allows me to build and iterate prototypes and small applications quickly without having to keep a schema in sync, or stop to figure out why something isn’t working, or why it’s too slow to be usable.”
By combining ideas from ActiveRecord and Prevayler, he’s certainly made it simple to use: define any objects that you want to persist as subclasses of SDActiveRecord and save your image to ensure the proper directories are created. To persist changes to your objects, call #commit on them. All data is written to disc when committed, and loaded into memory on startup.
There is a cost to this: Ramon notes that the object graph is rebuilt on startup, leading to an impact on startup times; holding all the data in RAM also means that there are practical limits on how much data you can manage in this fashion. He’s happy that this solution meets his needs when developing and deploying applications for his customers, but he’s leaving open the option of a future implementation being disc-based.
There’s a lot more information, including the philosophy behind SandstoneDb, a guide to the API, and usage notes at Ramon’s blog.