Quote
"drazen" <draze...@hotmail.com> wrote:
>Hi,
>I am trying to do some more "pure OO" design for database app.
>For single table, it is not that complicated. But how do you do
>master/detail? How to create detail objects - with method from master object
>or as standalone object?
>If I wrote Master.NewDetail then constructor for detail object must be
>hidden/disabled.
>If I do Detail.Create - then I must create number of checks to see if object
>is added to master before I can do any operation with it (like Invoice - if
>I do not know who is customer - written in master- I can not know what price
>for item (detail) should be). And how much this gets complicated if you have
>several levels of details.
Take a look at the composite pattern, and also handling one-to-many
associations and using transient data objects in the OO literature.
Quote
>This all looks to me as too much complications for nothing.
>What do you get if you do code like this? It looks to me like complication
>without much benefit in Delphi. If you do datamodule for data-access
>(datasets) and separate components for bussiness rules enforcing, what do
>you need more?
It all depends of what you are trying to achieve. For instance, if you are
writing a bug-tracking utility that can be put together in a couple of
days. The RAD approach might work just fine there. However, if you
are developing a manufacturing process control system where the
business rules are completely different depending on the various
product lines and hw components used in production, then you need a
way to structure/architect your application to facilitate reuse and
extensibility of those business rules. If you go the RAD way, you end
up with Data Modules and Forms containing a lot of delegated,
context-specific code, serving disparate purposes (poor cohesion), that are very hard to reuse. Choosing a more OO design/architecture
will provide you a better way to reuse, and extend your business
objects. Along with improved cohesion and reduced coupling, which are the fundamental concepts of good ol' Structured Design and OOD.
..
Quote
>Whole picture looks to me like this: somebody is trying to create Delphi
>apps that are internally structured like java (smalltalk) apps. I think that
>this is bad idea. Delphi is not java.
I think you've misunderstood the whole purpose of OO. The
shortcoming (or its virtue for RAD lovers :) of Delphi and its VCL is that
the RAD environment and data-access is build around the dataset
concept, and not a generic business object concept, nor does it
facilitate the building of business objects (well, maybe bold does that,
but I haven't used it yet ;).
Quote
>I did not intend to start flame war. I am just trying to figure out what can
>I get if I try to implement stricter OO design for database apps.
>Anyway, now I will put my asbestos suite on.
>drazen
Delphi zealots may take it as a flame, the way I see it is, if you don't
see a need for a stricter OO design in your application is because the
level of complexity in your application requirements is being met with
your current approach. However, for other apps (like the example
above), the VCL/dataset/RAD approach leaves a lot to be desired.