views:

486

answers:

10

Hi,

I am pretty new to programming(just finished University).

I have been thought in the last 4 years about Object Oriented development and the numerous advantages of this approach.

My question is

Isn't it easier to use a pure Object Oriented database in development applications?

Why Object Oriented database are not as much diffuse as relational?

From my point of view makes sense to use OO database, the latter will avoid the numerous construction necessary for the mapping of complex objects on the tables.

+6  A: 

There are no advantages to using this approach when you already have a relational database already that is many gigabytes in size is storing 20 years of data already and has hundreds or thousands of tables. This is the real world of many business applications. Databases are used for a lot more than Object mapping of your particular application. The database will still exist long after the applications you write are gone. Bite the bullet and learn relational databases as they aren't going away any time in the next 100 years.

HLGEM
If everybody had bitten the bullet, there would've been zero innovation today. I'll take that bet. They said the same about Geocities.
Shyam
There is a great deal of difference bewtween Geocities which the tiniest of tiny percentage of teh population used and something that virtually every business in the world that uses computers relies on for their information.
HLGEM
I am always amazed by how visionary was Mr.Codd's work. 30 years and still rocking, for an IT concept, it deserves the Nobel prize. I think there is room for the other (OO...) models, but as you said, RDBMS are far from dead.
iDevlop
The Geocities statement is pointed at 'the 100 years from now'-bla bla bla. I don't say we should replace everything for little reason. I say to always encourage change and innovation. Progress is progress (and a RDBMS), no matter how small. And my opinion is, once there are very good reasons to change (money, solutions), a business is always ready to play, unless its course is set to sink somewhere on the way.
Shyam
Hmmm... Geocities / RDBMS... yeh, that's an apples to apples comparison. There are certain inventions which have lasted a hundred years even in today's fast paced world.
Stephanie Page
There are also ideas that have lasted a hundred years, and should have been killed on the spot...
Chris Lively
A: 

There is no good reason for this, especially with the uprising of ORM (Active Record) usage and the pains of the mapping. Object Orientated Databases are faster and better in many ways. The reason for not being popular is need. So far, RDBMS have been doing a good job and in large businesses, the greatest pain is called 'migration'. As with most technology, the need of the user is the primary objective, and Object Orientation is usually not the selling point. Speed perhaps, but expensive hardware and proven RDBMS tuning can achieve performance as well.

Also people who are skilled in this area, would have to be trained again (which costs a bunchies). Not to mention al the expensive consultants who learned evil PL/SQL...

I would say, be a first mover. Like Mahatma Ghandi said, be the change you want to see. Funny, you just made me want to Google for an open source OO-DB.

Shyam
@Shyam: 90% of developpers or DBAs have no clue of what is Active Record. That concept is very young.
iDevlop
I absolutely disagree. Many Zend/Rails developers either love it or hate it. But I agree with the DBA's though, which is also a reason why OO-Databases aren't that popular, because most benefits are for developers.
Shyam
A: 

Another issue is language support. What about the languages that aren't object oriented? A good database needs to be accessible by everyone, no matter what language. Thats why a lot of language specific databases fail, because their market is only people of that language.

There is also the migration factor. MySQL's biggest users are long time users. Migrating to a completely new database system with a completely different fundamental design with a large existing one would be very expensive and give little reward.

TheLQ
No only littel reward, but probably will create problems that currently do not exist as new bugs are introduced
HLGEM
+2  A: 

Ten years ago I looked at object-oriented database design (for a personal project) and discovered that they were not very good at doing certain kinds of searches easily or quickly (say "find all people whose last name starts with 'S'), although of course there are a lot of relational queries that are not needed in an object-oriented database. Also, at the time object-oriented database were not really ready for large scale deployment (which admittedly was not a concern of mine). I believe that newer ones have fixed that problem, but there still is a lot of intertia and good ORM's make using a relational database relatively easy.

However, there is a movement away from relational databases, see the NoSQL movement. I believe the Google does not use a relational database (but also not object-oriented, rather something proprietary and distributed).

Kathy Van Stone
Google developed BigTable which is a key/value store, they also use mySQL databases for some purposes.
Zero Cool
A: 

"I have been thought in the last 4 years about Object Oriented development and the numerous advantages of this approach."

Question for you :

has anybody, during those 4 years, made any serious attempt to teach you anything about the relational model ? Has any of your teachers ever mentioned "relation", "tuple", "predicate", "relational algebra", "constraints" or any of all those many, many other terms that are not entirely irrelevant in the world of data management ?

For if not, then you have not been taught, you have been brainwashed. In that case, the best favour you can do yourself is to try and get the effects of that brainwashing undone ASAP. "An introduction to relational theory" by Hugh Darwen might be a good starter.

Erwin Smout
Though I agree with you in practice, I disagree with you in spirit, I think you're the one who's been brainwashed to believe that set-based is the only way (maybe I'm putting words in your mouth). Hierarchical data systems are just as valid, and key/value systems are starting to take over large swathes of the data processing landscape. Relations, tuples and constraints are not unique to set-based relational databases.
Chris Kaminski
The hierarchical and network data models were common before relational DBs appeared. The fact that they have since been largely abandoned speaks volumes about the superiority of the relational model for most business uses.
TMN
-1: no reason to talk down and condescend to someone whose asking a genuine question.
Juliet
Agree Juliet. Erwin's points are valid but they are lost in his approach.
Stephanie Page
+8  A: 

Having worked for an Object Oriented Database company in the past (www.objectstore.com) - and currently - I think I have a fair insight on what makes them great, and what makes them no-so-great.

Great:

No object-relational mismatch. If you want to store object x in memory to a persistent store, ObjectStore can do it with near-realtime guarantees. Our product has been used by many companies to meet brutal time requirements that would be tough with relation databases or ORM engines.

No object-relational mismatch - you develop in objects, you think in objects, you store in objects.

No-so-great:

ORM: Object relational managers have pretty much made Object databases irrelevant

Schema evolution: Change a class to add a field, and now you have to morph an ENTIRE database. ObjectStore has gotten smarter about this over the years, but it's still a pain point for many OODBMS.

Bad:

Tool support - this is what made OODBMS a non-starter for most places. Everyone today can take Crystal Reports or Access or Excel and churn out bucketloads of reports. With an OODBMS, you would have to build this logic through a programmer, and we all know how fast that's likely to happen when you need your budget report to take into account some xyz parameter that you didn't think of at design time.

Tools are why OODBMS failed in the marketplace. Not technical superiority or performance or language support (ObjectStore supports C++/Java/.Net and had support for COM to support any IDispatch languages like VB, Perl, etc.).

So I've said some disparaging things here, particularly about a product I really like. But ObjectStore is awesome at very specific tasks, but a poor choice for building a webapp. Though at one point, it was driving the inventory management backend for Amazon.com.

Chris Kaminski
I wouldn't say that you get rid of the object-relational mismatch with ORM. ORM make RDBMS usage with a statically typed domain model bearable, with OO databases, you get this out of a box, so it doesn't really fit into the category, otherwise good points. With ORM you still need to think about hierarchy mapping, query transalation from criteria/JPQL to SQL, lazy loading etc.
Timo Westkämper
OODBMS have many of those same problems. Even though ObjectStore can load an entire object tree automatically for you, can you imagine what that would do? Accounts->emails->orders->shipments->line-items->descriptions... So Lazy-Loading is still a concern. Then there's locality of reference (memory pages) and object allocation to worry about. The work to reap the benefits often just doesn't make sense - unless you need that 5ms guaranteed response time.
Chris Kaminski
A: 

One reason why adoption of Object Oriented databases is so slow is that are aren't many scalable OpenSource alternatives. For RDBMS there are for example MySQL (Oracle owned now), PostgreSQL and many more.

Another problem is that at least for Java the standard APIs for RDBMS access JDBC and JPA for the ORM part have bigger companies behind and are better known. JDO for object oriented database access is a standard, but not as popular.

Object Oriented databases have in most cases a stronger API or language lock-in than RDBMS, which is another reason why bigger companies with multiple platform and language investments stay with RDBMS.

For me personally popular OpenSource OO databases would be a reason to invest more time into trying them out.

Timo Westkämper
Transparent language support is tough. It would probably be easier to build on in Java today with annotations, but 10 years ago it wasn't.
Chris Kaminski
+7  A: 

As you state, you're fresh out of college and have just been intensely indoctrinated in The One True (Object-Oriented) Way. If on the other hand you had learned declarative programming, database design, and set theory, you'd realize that the relational model is a perfectly adequate approach, well grounded in theory, while OO is a more pragmatic approach that was invented mostly in industry rather than academia. As it happens, most interesting research and development on database problems is being done by people with more of a math background, for whom the relational model is the more natural way to work with data. As a result, RDBMSs tend to be more stable, scalable, and trusted than their object-oriented counterparts. Object-oriented databases, much like XML, are often used in an ill-advised attempt to make data conform to the programs that use it, instead of the other way around.

Daniel Pryden
Exactly, see http://stackoverflow.com/questions/3007766/what-sort-of-schema-can-i-use-to-accommodate-manual-date-based-data-entries another case of a programmer trying to fit a data model to his UI. The data has a model already, defined by the requirements, not by the fields in his UI.
Stephanie Page
+1  A: 

Database is not just about storing and retrieving objects, otherwise OODBs and Document DBs would have taken over the world. Other usage contexts / aspects include:

  • Aggregating data and doing complex bulk data processing / manipulation. RDBMSes are very good at this.
  • Other important aspect is concurrency / isolation (i.e. transactions). RDBMSes are very mature in this area.
  • Another aspect is indexing to ensure fast queries.
  • Another aspect, like "Chris Kaminski" mentioned above is being able to evolve your schema over time while preserving the data.

Finally, there's a bit of industry inertia going on, with major vendors not willing to bet money on something the clients are not ready to pay for, and the clients waiting on sidelines until major vendors join the game.

zvolkov
+2  A: 

Apologies for not being able to add this as a comment in the place where it really should appear.

But the following constitutes a personal attack on me, and I invoke my right to respond.

"Though I agree with you in practice, I disagree with you in spirit, I think you're the one who's been brainwashed to believe that set-based is the only way (maybe I'm putting words in your mouth)."

FWIW, I have most certainly NOT been "brainwashed" into what you might probably call "the relational religious belief". Brainwashing is when some tutor says something, and the student blindly and brainlessly accepts that as the sole truth without any form of critical thinking. In fact, I have even never been taught the relational model. In fact, I have had to discover all that all by myself. It is a recorded matter of fact that I have expressed severe criticisms toward Date's opinions on the subject of view updating. (correction : "was" a matter of recorded fact. The page seems to have been removed from the site where it was published. Probably has everything to do with the fact that Date has indeed abandoned the view updating position I criticized.)

So I think I have every reason to say that any claim that I ever let myself be brainwashed, is outright propostrous. You are free to think as you please, but if you publicly express any gratuitous and based-upon-nothing personal opinions, I hope you are also enough of a grown-up to see them rebutted by facts and admit it.

The reason why hierarchical and network models have been superseded by the RM, has been amply documented in entire libraries full of books on the subject. I invite you to inspect those carefully.

As for "key-value is taking over the market" : you are completely free to take "the market's most common opinion" (that is : the mediocre majority of too-lazy-to-think-for-themselves fools who are quite happy to let themselves (and their opinions) be led by the Ellisons and Gateses and Jobses of this world) as the main yardstick for what is valuable and what is not. I personally find that a foolish thing to do, but that's only my personal opinion. I copy-paste here some observations made by someone who faces the horrors of EAV and Key-value almost every day of his professional life :

BEGIN QUOTE

I work on an application that uses the following "EAV model" (at least, the "EAV model" as I understand it) for many, but not all, logical tables:

R1 {EAV_RELVAR_NAME*, ... } R2 {EAV_RELVAR_NAME*, ATTRIBUTE_NUMBER*, COLUMN_NAME, DATA_TYPE, ...} R3 {EAV_RELVAR_NAME, ATTRIBUTE1, ATTRIBUTE2, ATTRIBUTE3, ..., ATTRIBUTE50}

In which one might see the following values: R1 { {'STATE_CODES'} }

R2 { {'STATE_CODES', 1, 'STATE_NAME', 'CHAR(30)'} , {'STATE_CODES', 2, 'STATE_CODE', 'CHAR(2)' } }

R3 { {'STATE_CODES', 'ALABAMA', 'AL'} , {'STATE_CODES', 'ALASKA', 'AK'} ...}

Basically, "EAV relvars" are created/altered/dropped with inserts/updates/deletes into R1 and R2 (as compared to DDL). This is a trimmed down version of our overall model: there are additional columns in R1 and R2 to specify eav-primary-keys, eav-foreign-keys, business rules, etc... all enforced by procedural code embedded in the "one true front end" of the model.

This morning, I was privy to a 20+ man-hour ordeal that resulted when System A thought CODE_XYZ would be in ATTRIBUTE2, but System B actually defined it into ATTRIBUTE3... I had to laugh at the fact that I was half-listening to the conversation, and half-reading this group's discourse on EAV.

Last month, I got to put in an emergency update (16 man-hours plus "bad marks" for the application) to change ATTRIBUTE16 from 'MAY 2010' to 'MAY-2010' for 430 user-entered data points.

About 5-10% of our code releases are accompanied with "Monday-morning runtime-error cleanups", because EAV_RELVARs were not coded into R1 or R2 identically in production as was done in test/development (both application code and DDL is migrated with strict-versioning software control... our EAV model is not tied down to such bureaucracy as it "allows" developers to set up their EAVs autonomously in dev, test, and prod.).

Last year, I spent a solid 3 weeks tuning replication software exclusively to deal with the lack of a primary key on R3.

I once had to apologize for the inability to put an index on ATTRIBUTE4 of EAV_RELVAR_NAME_x, as it was messing up the performance of a different program that used EAV_RELVAR_NAME_z.

Two years ago, after several years of sinking hundreds of hours perpetually tuning complex queries which needed to join to R3, I finally spent 3 months splitting R3 into hundreds of physical partitions (one per EAV_RELVAR_NAME), in order to give the DBMS optimizer the stats needed to see that there were, e.g., 50 'STATE_CODES' and 200,000 'LOCATION_CODES'. I was congratulated for the ingenious solution, though the irony was missed on everybody when I pointed out that, with this change, there would be a new policy whereby adding a new EAV_RELVAR_NAME would entail running a script which added an associated partition to R3 (yes, with DDL).

My clients want a new front end for loading data into R3 for one of their EAV_RELVAR_NAMEs (while enforcing all appropriate constraints and security), and they want to know why it will take 4 months to build.

I often point out that I could rewrite the entire EAV system in a fashion that was superior in every way, using the dynamic-DDL against data dictionary instead of DML against R1 and R2, but I'm always informed that we're "committed" to this approach (there was a 7-figure up-front expenditure to build it, and we'd have to rewrite 98% of our codebase to switch to stand-alone tables), and that the ends don't justify the means.

END QUOTE

If you really believe that such scenarios are an improvement over RM, then by all means go ahead. Don't blame me for how much it hurts when you finally bang your head into the wall.

Erwin Smout
You really blunt your defense by presenting such a long dissertation.
Stephanie Page