CSLA .NET

From Rockford Lhotka's Expert C# 2008 and VB 2008 Business Objects books

Someone here who works with db4o?

rated by 0 users
This post has 33 Replies | 1 Follower

Top 100 Contributor
Posts 61
RichardETVS Posted: Wed, Feb 28 2007 3:55 AM

db4o is an object database. No row, no tables, no SQL, no need to make conversion between objects and data, the objects are saved in the database as objects (http://www.db4o.com ) .

 

I would like to know if someone, here, uses it in a production environment, with the CSLA framework, and what advices he or she could give.

 

Thanks :)

 

Cordially

 

Richard

Richard
Top 150 Contributor
Posts 44
phucphlq replied on Wed, Feb 28 2007 8:43 PM
I posted an example here
I think
Top 100 Contributor
Posts 61

I am studying it right now ;) .

Do you use both (CSLA and db4o) in a production environment?

 

Richard
Top 150 Contributor
Posts 44
phucphlq replied on Thu, Mar 1 2007 10:16 PM
I like DB4O, but it is slow, small, not exception, not unique field. I only write example on it, I have never used  in a production environment.
I think
Top 100 Contributor
Posts 61
ok thanks for the answer.
Richard
Top 25 Contributor
Posts 219

On the old forum there was quite a bit of discussion about db40, so you might want to try to find it.  Keep in mind that the discussion was a few years ago, but at that time there was a few features still lacking, like a completely robust concurrency model (admitted by the developers).

The bottom line BACK THEN AT LEAST was that it was a fascinating concept but not really quite ready for prime time in an enterprise environment.

I would be really interested if you find out those issues have been resolved.

Dan Billingsley
Top 100 Contributor
Posts 75
Justin replied on Mon, Mar 5 2007 9:34 AM

From what I can tell they have resolved most of those issues and then some. One feature that stands out is transparent activation. It looks like they can instrument our objects so that field data isn't loaded until accessed. If it works as avertised it could eliminate the need to stay away from many data centric designs because of performance and scalablility issues.

As an example that was dicussed at length in another thread an Order object could have a full Customer object reference instead of borrowing fields into the Order using SQL joins undernieth as not all the Cutomer fields would be loaded from the db when you load the Order.

It also supports transactions,online backup, a few different query languages, a "server" mode so it doesn't have to be in-proc, and even a GUI "enterprise manager" now.

Too bad the don't support a royalty free license which pretty much excludes it for my development purposes at this point, otherwise I would spend more time to see if it actually can do some of these things properly.

Justin

Top 10 Contributor
Posts 3,716
Andy replied on Tue, Mar 6 2007 7:08 AM
Justin:
If it works as avertised it could eliminate the need to stay away from many data centric designs because of performance and scalablility issues.


Performance and scalability issues haven't been listed as reasons to stay away from data centric designs.. at least not here.  Smile [:)]
Top 100 Contributor
Posts 75
Justin replied on Tue, Mar 6 2007 10:18 AM

ajj3085:

Performance and scalability issues haven't been listed as reasons to stay away from data centric designs.. at least not here.  Smile [:)]

Hmm, sure didn't sound like Rocky was describing it as poor design but instead impractical because of physical architecture issues, but maybe I misinterpreted this? (from thread http://forums.lhotka.net/forums/3/12361/ShowThread.aspx):

RockfordLhotka:

This is where, with real OO applications, people get into trouble.

 

Are you really proposing that, to get one field of data on Order, you are going to load the entire Customer object?

 

I’ve been down that road, early in my exploration of OO. It sounds so sexy. Total reuse. One object with one set of data. One object to rule them all … and in the darkness bind them. (sorry, I’m a hopeless LoTR geek…)

 

But in reality it is bunk. It simply doesn’t work for anything beyond a handful of users, if that. The performance and scalability ramifications are non-trivial, especially in any sort of distributed environment.

 

You can get away with a lot if the database is on the user’s workstation and so, by definition, there’s one user. But as soon as you start trying to load entire Customer objects to get one field of data for dozens or hundreds of users, and that data must travel even from the db to the app server, you are done for.

 

Rocky

 

 

Top 10 Contributor
Posts 3,716
Andy replied on Tue, Mar 6 2007 10:34 AM
It seems to me that comment is why you wouldn't want to use an OODB vs. a traditional relational db, which is a different (although somewhat related) topic than the 'build business objects based on behavior, not data.'   Regardless of your datastore, you'd still want to avoid data centric designs for your business objects.
Top 100 Contributor
Posts 75
Justin replied on Tue, Mar 6 2007 11:17 AM

ajj3085:
It seems to me that comment is why you wouldn't want to use an OODB vs. a traditional relational db, which is a different (although somewhat related) topic than the 'build business objects based on behavior, not data.'   Regardless of your datastore, you'd still want to avoid data centric designs for your business objects.

Exactly wheres does that mention a OO vs relational DB? Now please explain why we should avoid a data centric design and  borrow fields from the Customer and put them on a Order if performance a scalability were the only issue? Do you do this at the table level too, replicating customer fields on the order table and keeping them in sync with the master customer table?

Almost every argument against a data centric design is based on performance issues which is understandable and exactly why I still use behaivor based design.To me behavior based design is a compromise in most situations and breaks encapsulation and reuse but must be done to implement a working and performant system today.

A system like db4o with transparent activation could remove many of the performance implications of a data centric design leaving you with choice for the best model given your particular application.

 

Top 10 Contributor
Posts 3,716
Andy replied on Tue, Mar 6 2007 12:19 PM
Justin:
Exactly wheres does that mention a OO vs relational DB?  Now please explain why we should avoid a data centric design and  borrow fields from the Customer and put them on a Order if performance a scalability were the only issue? Do you do this at the table level too, replicating customer fields on the order table and keeping them in sync with the master customer table?

http://forums.lhotka.net/forums/permalink/12361/12659/ShowThread.aspx#12659

At that point, the discussion changes to using an OODB vs. a relation db.  The post you quoted was part of that thread of discussion.  Data centric design is perfectly fine at the database level.  You do things there you wouldn't do when doing behavior based design on the business layer.  The reverse is also true.

Justin:
Almost every argument against a data centric design is based on performance issues which is understandable and exactly why I still use behaivor based design.To me behavior based design is a compromise in most situations and breaks encapsulation and reuse but must be done to implement a working and performant system today.


That's not the arguments for behavior based design that I've seen here; the arguments are that the behaviors (which are dictated by use cases) are where the maintainablity problems come in, and behavior based design is meant to help with maintainablity issues (as is OOD).  The desire for reuse is counter to maintainability.  In the thread link above, you will find Rocky explain how we want reuse, but at the same time reuse is bad.  Behavior based design doesn't break encapsulation, because the behaviors are what is being encapsulated.  There's only one object that gives the behavior you want.

Justin:
A system like db4o with transparent activation could remove many of the performance implications of a data centric design leaving you with choice for the best model given your particular application.


Again, I don't think behavior based design is an attempt to gain performance.
Top 100 Contributor
Posts 75
Justin replied on Tue, Mar 6 2007 12:53 PM

ajj3085:
http://forums.lhotka.net/forums/permalink/12361/12659/ShowThread.aspx#12659

At that point, the discussion changes to using an OODB vs. a relation db.  The post you quoted was part of that thread of discussion.  Data centric design is perfectly fine at the database level.  You do things there you wouldn't do when doing behavior based design on the business layer.  The reverse is also true.

In the post I quoted Rocky was replying to this post: http://forums.lhotka.net/forums/permalink/12361/12663/ShowThread.aspx#12663 which was purely a question about OO logical design not about which persistence technology it would be implemented on. Rocky's response characterize this as "sexy" but impractical because of performance and you are somehow interpreting this as an argument against an OODBMS's? It seems to me it is describing limitations of current RDBMS technology backing OO designs, but perhaps Rocky would need to clarify.


ajj3085:

That's not the arguments for behavior based design that I've seen here; the arguments are that the behaviors (which are dictated by use cases) are where the maintainablity problems come in, and behavior based design is meant to help with maintainablity issues (as is OOD).  The desire for reuse is counter to maintainability.  In the thread link above, you will find Rocky explain how we want reuse, but at the same time reuse is bad.  Behavior based design doesn't break encapsulation, because the behaviors are what is being encapsulated.  There's only one object that gives the behavior you want.

Again in Rocky's response the only argument against the "sexy" design was performance issues, but even he describes it as "Total reuse" which has a direct impact on maintainablity no?

Your still dodging the question how does borrowing fields at a sql level in the Order-Customer example provide better maintainablility or is it only for performance reasons?

I could link many sources that point to data centric designs being a better philosphy just as you could about behaivor centric, but since it seems to be an open debate and I would rather hear your arguments as to why behaivor centric is always a better solution, especially how replicating the same properties across multiple classes improves maintainability.

ajj3085:

Again, I don't think behavior based design is an attempt to gain performance.

So now it has nothing to do with performance? Again how can you argue replicating properties leads to less maintence and has nothing to do with performance?

Top 75 Contributor
Posts 99
I don't think the idea of "borrowed fields" or breaking data encapsulation has anything at all to do with one design philosophy over another. In the cases that you both point out this is done only for one reason, performance. Just because you are doing the "Behavior" thing doesn't mean you should ignore traditional data encapsulation.
 
There is only two reasons, I believe, CustomerName would be a field in Order. 
 
1. Because it should be based upon business rules.
2. Because it is more efficient/faster to retrieve that one piece of data than it is to retrieve the customer data as a whole and use only one piece of that data.
 
Those are the only two reasons I can think of doing it. The first one is valid and there isn't any extra risk outside the risk imposed by the rules themselves.
 
The second one has some risk associated with it and that risk has to be acknowledged and understood.  And this is done all the time in both Data and Behavior centered design.
 
I think the question is if the performance lost doing the “right” thing could be either eliminated or ignored which way should/would you design the objects?
 
I personally think that to “borrow” a field when there is no performance gain (or the gain is unnoticeable) is just silly.
 
And I know that using a customer increases the coupling of the objects.  Just insert the interfaces needed to make the coupling as loosy goosy as your heart desires. That still doesn’t mean that “borrowing” fields is the best thing to do, design wise.
 
But it is necessary many times so I don't think it is a bad thing.  I just don't like seeing it justified by a design credo.
 
And I have gotten into arguments about this before. In those arguments I didn't really understand what others where saying. My point then was that just about everybody does data centric design whether they admitted to it or not.
 
What I should have said is that "Just about everybody lets data affect their design."
 
So I agree with ajj that the support of behavior oriented design is not for performance reasons. But those that do push the behavior oriented design do say that the data in the object is only there to support the behavior and nothing else.
 
And that is where things get confusing, I believe. The fact that they focus on the behavior of a class means that having a few extra fields that also appear in other classes does not seem to bother them.  They also take for granted that using real, honest to god aggregation/composition and enforcing strict data encapsulation is a performance killer. And they understand that in reality breaking encapsulation often does not hurt maintainability of the application. Especially since in almost all cases the data storage is a RDBMS and THAT is what will ensure data integrity.  After all one of the main points of data encapsulation is to maintain data integrity.
 
The db4o OODMS does NOT have the built in data integrity goals of a RDBMS. It has object integrity goals. So borrowing fields is a bit of crazy talk. I suppose you can do it but with my, admittedly small, experience, the idea scares me. In db4o there is no way to get varCustomerName from the customer object without loading the entire customer object. It is relatively easy to retrieve the Customer object at the same time Order is retrieved. All you have to do is set the activation depth correctly and the customer object would be retrieved when you retrieve the order object.
So my advise to the original poster is this.  First db4o will hurt your brain at first if you are used to RDBMS.  With db4o the code, and the code alone, is responsible for data integrety.  This fact can kill you. 
 
Second problem, don't even hope to have a effecient ad-hoc reporting solution.  I shudder just thinking about trying to do that. And to have an efficient reporting solution even when you know exactly what needs to be looked at takes a lot of up front effort. And remember you cannot easily update things like zip or area codes because there are no set operations. If you are used to the powers of an RDBMS you are going to cry at times at what is lost with a OODBMS. 
 
But there will also be many times that you won't be able to wipe the smile off your face because everything just feels "right in the eyes of god".
Everything is switchable if you think about it.
Top 500 Contributor
Posts 21
Igor replied on Tue, Mar 6 2007 10:09 PM

IMO behavioural design is not about performance, and maintainability is not about data integrity.

Behavioural (= single responsibility) objects are simpler, the code is easier to understand (and THEREFORE to modify=maintain).
 
Borrowing fields and duplicating data do not constitute significant maintenance issues; convoluted and/or duplicated procedures do.

 

Page 1 of 3 (34 items) 1 2 3 Next > | RSS

Please contact Magenic for your .NET consulting
and CSLA .NET mentoring needs.
Please consider making a donation to help support the ongoing development of CSLA .NET.

Make donation through PayPal - it's fast, free and secure!
Why donate?
Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems