Re: How to do non dependence on database vendor?




"Brett" <wrote...
> "Bjorn Abelli" wrote...

>> You could actually get away with only a single proxy if you use
>> reflection... ;-)
>>
>> Through reflection you can dynamically load the ADO.NET-driver, using
>> some kind of "ini-file" to let the proxy know where to look for it, which
>> classnames are used for the driver, connection-strings, etc.
>
> However, there would be a performance hit to using Reflection. Also, I
> like the interface approach. Everything in classes that you can
> instantiate. Would that better than an INI file and Reflection...both of
> which are going to be slower?
>
> The interface approach seems more scalable and contained.

I would rather say that both approaches really are heavily based on
interfaces, though with reflection, your implementation would be more
flexible, as you wouldn't even need to implement a new concrete proxy for
each new DB.

For the performance hit, I would say that it possibly could be neglectable,
as it could be "reflected" at only the startup of the application, but that
also depends on the design of the rest of it...

>> I would still look at the "data layer" from both perspectives, i.e. from
>> the "Business Perspective" and from the "DB-perspective".
>>
>> What do I need to store persistent?
>>
>> That would make up a layer between the business logic and the data layer,
>> focusing on storing and retrieval of the explicit data, but free from
>> other considerations in the business logic, and free to make use of
>> different DB-approaches. Though it would be dependant on the rest of the
>> business logic, it frees the layer from the details of SQL, if you in the
>> future want to make use of another DB than those supporting SQL.
>
> I'm still not seeing what exactly this other abstraction layer is. I
> understand the use of a proxy (interface) and how that allows me to
> support multiple databases using standard SQL. Say now I have another
> database that uses non standard SQL. I add another proxy class for it.
> Now what exactly needs to be done on this other higher level abstraction
> layer to support the non standard SQL? Perhaps example with psuedo code?

Well, you have possibly already thought of it, but included it into your
business logic. This kind of layer is often considered a part of that layer
as it's so dependent on the classes in the business logic.

What I mean is simply an interface to the storage/retrieval of the data.
This can be done in several ways. One way is similar to the proxy variant
above, but foremost the use of a distinct interface for this, makes it
easier to change it afterwards anyway.

In short...

interface MyBusinessStorageManager
{
ArrayList GetCustomers();
ArrayList GetProducts();
ArrayList GetOrders();
boolean SaveOrder(Order o);
...
}

....which in turn is implemented by a class that *calls* the classes with the
SQL or others...

// Bjorn A



.



Relevant Pages

  • Re: How to do non dependence on database vendor?
    ... >>> You could actually get away with only a single proxy if you use ... >> The interface approach seems more scalable and contained. ... >>> layer, focusing on storing and retrieval of the explicit data, but free ... >>> the future want to make use of another DB than those supporting SQL. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: What do People do to avoid Tight Coupling?
    ... > have the GoF Design Patterns book, which does not mention the Separated ... > Interface Pattern as such; perhaps under a different name. ... The proxy allows you to avoid coupling, have fair performance, and expose ... >> Although the Domain layer duplicates all the properties, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: The biggest mistake in classical optics
    ... Take an interface between two media, calculate reflection and transmission coefficients, and then take 3 media, and ditto. ... For example, if it's a high-index layer between 2 identical media, then there's a 1/2 wave phase shift between the reflections from the front and back of the interface, and these destructively interfere as the thickness -> 0. ...
    (sci.physics.electromag)
  • empty interfaces via reflection
    ... Is it possible to force a class to implement a (empty) interface via ... reflection only... ... the problem is I want to create a Proxy but want ...
    (comp.lang.java.programmer)
  • Re: The biggest mistake in classical optics
    ... Take an interface between two media, calculate reflection and transmission ... For example, if it's a high-index layer between 2 identical media, then ...
    (sci.physics.electromag)