How To Love ZODB and Forget RDBMS - Part I
Created by adytumsolutions . Last modified 2004-03-01 17:50:20.
Learning the ZODB and overcoming Fear of The Unknown
By: Duncan McGreggor
Editor: Casey Duncan
Well, every tool has its place, so we don't really mean that you forever leave Relational Databases behind... just set them aside for a few minutes. Like all matters in Code Foo, it is best to approach ZODB with beginner's mind - abandon all preconceptions, if only for a while. Rest in no-mind... Zen mind...
We will discuss the following in this small series of HowTos:
Why Should I use ZODB?
Why do we need another ZODB Document?
This is an excellent question. Here's why: most people new to Zope come in with a background in Relational Databases. RDBMS are easy to get: they're "just" lots of tables; they're kinda like spreadsheets all strung together, related in different ways. Over simplicity, yes; but that's they way our little brains file it away when we're not looking. At the same level, these brains don't know what to do when someone says the words "Object Oriented Database."
Tables are easy to see, easy to think about. We can wrap our heads around their purpose. We can draw a picture of them. Yet, we can't do the same thing for Object Oriented Databases. Why not? Well, they're "weird" and "scary"; they're like a black box we throw our data in and hope, at some point, we can get it out. We can't draw a picture of them, we think we can't ask them a simple question (SQL) and get a simple answer. (Side note: Casey Duncan is actually working on a project that allows one to do just that: query ZODB databases in a SQL-like manner. Stay tuned; he's almost done!)
So, this document is an effort to introduce OODBS to those people new to them, new to Zope, and other curious future ZODB gods and goddesses. We want you to love them as much as we do. We will show you that a ZODB is not scary or weird. We're going to put windows on the black box so you can peer in there to your heart's content. There are all kinds of features you will come to love while getting to know ZODB. And, if you've ever done work with BerkeleyDB, GDBM, or other file-based databases, you will be quite delighted with the speed, ease of use, and ease of administration in dealing with ZODBs.
One more thing before we move on to the second part of our ZODB tutorial: conceptual assistance. Ever heard of LDAP? Directory structures in a file system of your favorite OS? You can think of OODBMS like that. They are hierarchies, of sorts. Instead of files or directories, they contain objects. But if you start there - the ZODB is like a file system - you will be ahead of the game and ready to play.
It would be very helpful to your understanding of ZODB if you have a grasp of Object Oriented Programming and Python. If not, don't worry :-) It's okay. This tutorial is not meant to give deep understanding into any subject, but rather to provide a mechanism by which you can begin familiarizing yourself with ZODB in a practical manner. We encourage you to not read this tutorial, but rather participate in it. Follow along and type the lines of code, even if you don't quite get it. Watch it in action, participate through to its conclusion, and slowly start building an intuition for these new concepts. Once you finish it, go through it again and see if you are more comfortable with the concepts... check your intuition to see if it's growing ;-) Then head off for the nearest python and object oriented programming tutorial to satisfy that natural and growing curiosity.
On to Part II