views:

1121

answers:

3

I want to develop mysql database application using dbexpress to develop from scratch or work with existing databases. To create reusable layers what patterns-components should I use. I want the app to be scalable to n-tier easily. Tried google search for ready frameworks but I found nothing much informative (some lack documentation, some lack examples).

Something in the veins of famous java frameworks i.batis or hibernate would be useful. I'm familiar using such a framework in PHP to develop xml defined business objects. I tried to convert it to Delphi but it is much of a work.(Abstraction with delphi strict typing makes everything hard for my exprerience level.)

Also ruby on rails activerecord-like implementation may be useful.

I could never be clear about trashing dbaware components or not.

I tried to implement some design patterns to separate layers (data access/connection), (business objects), (gui), but with no success. What I try to achieve is to mimic lego (I can use any database engine , any delphi database technology(bde, ado etc.. dbexpress is a must, others are optional). Also I may use xml (mybase or native), text files (csv-like, legacy parsing code)

I may need single tier, client/server and n-tier.

Also I may need some kind of web service implementation (the client side may be any technology apart from delphi executable , so I think generating xml, wsdl easily is necessary)

The data access layer is the most important part. It must be flexible because other frameworks will be developed upon it (user authentication, app configuration etc...).

  • I may challenge to develop my own simple framework (I don't know what to follow: database adapter pattern, db connection factory, mappers, data access objects etc..)
  • I can use an existing one (instantobjects not applicable. not work with existing db schema). Some of the others I tried lack dbexpress support or I could not understand the configuration.
+1  A: 

At my company we use the tiOPF framework to achieve this. It uses several patterns to separate the GUI from the object model. It includes a database layer to connect to almost any database or text file.

To link the non-data-aware controls to the model there are several mediators available. With some more experience you canwrite your own mediators. We have written several mediators to link to the DevExpress controls, for instance.

The documentation of concepts behind the framework is good. For all other questions there is a newsgroup that is frequently visited by all core developers.

Have a look at the tiOPF website!

birger
Does it support dbexpress by default or should I develop some kind of adapter myself?
I think it does support dbexpress. if not, it wouldn't be too hard to add a persistance layer to support it. I have a worked example at http://sourceitsoftware.blogspot.com/2008/02/tiopf-new-persistance-layer-walkthrough.html
SeanX
Say I'm a beginner in OOP style development (did lots of stuff deadly repetitively using datamodules etc.. the Borland way), and tiopf seem really hard for a starter. I had experience with instantobjects it seemed much convenient apart from the fact that it imposes some built in functionality on the database structure. (i.e. you have to convert your existing schema and data into it)For your example, I' definitely give it a try, but I think tiopf should have dbexpress support at the first place.
You use dbexpress to connect to a database. tiOPF can also connect to almost any database, but it won't use the dbExpress drivers. I think instead they use the ado drivers. We have used tiOPF to connect to ms sql, firebird and MySQL. So you probably will have no problems connecting to your own favorite dbms!
birger
+3  A: 

If you would like to build Delphi n-Tiers solutions, that be access from diffrent clients (Non Delphi), you have these options:

  1. RemObjects' DataAbstrct.
  2. kbmMW
  3. MIDAS/DataSnap built in Delphi
Mohammed Nasman
+4  A: 

Mohammed's response covers the n-Tier part of your question. The part about being similar to i.batis or hibernate pushes you towards object-oriented persistence frameworks like tiOPF which are a somewhat of a different beast.

Here is the list of persistence frameworks for Delphi that I am aware of at this time. I believe CG also did some sort of persistence demo at Delphi Live so there might be something else on the horizon.

FWIW - I have used InstantObjects (IO) in several commercial products (albeit in a non-standard way) and am working on a port to Delphi 2009. PressObjects is by one of the IO developers and I recently joined that project since it looks interesting. I would not discount frameworks like tiOPF, Jazz etc since YMMV. I would be doing these frameworks a disservice by commenting since I have not used them beyond simple test cases.

David Taylor
Yeah, the CG part is called Wings by Pawel Glowacki. Not available yet. I think for Delphi 7 it would not be available either . Any idea about using tiopf with dbexpress
Bold / ECO seem much more powerful and well documented. But definitely not free for all occasions.I have symphaty for InstantObjects and tiOPF but with a few glitches
I tried instantobject again. The video tutorial was somehow misleading for me when I first tried it. This time I was more successful as a start. However, I have difficulty in the concepts of stored-embedded objects and using part(s)-reference(s) programmatically. Maybe I am not modeling the right way (instantobjects way)
IO takes a bit to get used to for sure. The Stored/Embedded is a very useful feature. Stored -> maps to a table, Embedded -> Not mapped to a table, possibly persisted in a field as binary or XML. I use Embedded extensively for polymorphism (base classes Embedded) with the concrete model classes marked as stored. I also use embedded to automatically serialize complex object graphs and store the result as XML in a blob. Let me know if you want to discuss IO further. Also be sure to check out PressObjects SDK (by another IO developer)
David Taylor
After a few days battle I seem to be able to progress with IO. Finally I could succesfully store an object with a reference to another object (simulating my lookup table), I believe the data access/persistance mechanism is now standardised. Apart from the field "class" being added to each table, IO meets my requirements well. I designed a few screen with my old tarzan-ish style in no time. Now I'd continue on the MVC and likes path to have more reusability and ease of coding.