When does Data Access become Business Logic?

Posted by ojfoggin on 06-Aug-2009 14:48

We had the Progress guys at our work today presenting us with Sonic et al and the first step we have as a result of the meeting is to move towards an OERA architecture.

At the moment we are at a place that works but we would like to move to a better practise architecture.

ATM we have the GUI, an AppServer (this contains procedures with both Business Logic (BL) and Data Access(DA)) and the Database (Progress database).  I am trying to get a better understanding of the separation of a Business Logic layer and a Data Access layer and the line between the two seems very blurry.  Also we are going to be moving towards using ProDataSets.

My confusion comes when I try to implement the set up.

Say (for convenience) we had already set up the system and had Sonic ESB set up etc...

We create a Crystal report to show all of the customers for region 2 and the total value of the orders they had made over the past month.

This then runs through Sonic and eventually gets to our AppServer Business Logic layer and expects an XML file to be output back into Sonic and then out to the Crystal Report.

The output needs to be customer acc numbers, customer name and total order value for the past month.

What then is the interaction between the BL layer and the DA layer and where does the ProDataSet come in?

Initially I had the theory that the DA layer should pass back temp tables, thus...

BL Layer: Go to DA and get all customers for region 2.

DA layer: Query database, create temp table, pass temp table to BL layer.

BL Layer: For each tt-customer, go to DA layer and get all the sales for the past month.

DA Layer: Query database, create temp table, pass temp table to BL Layer.

BL Layer: For each tt-order accumulate the orders to get a total value.

end for each tt-order.

end for each tt-customer.

Define ProDataSet.

Fill ProDataSet.

Output proDataSet.

My manager suggested that this could be done differently however, thus...

BL Layer: Go to DA and get all customers for region 2.

DA Layer: Query DB, create temp-table, pass temp table to BL layer.

BL Layer: For each tt-customer, go to DA and get the total value of sales for that month for this customer.

DA Layer: Query DB, accumulate total orders, pass back total.

BL Layer: end for each tt-customer.

output ProDataSet.

I debated that if you were going to do that then you may as well do this...

BL Layer: Go to DA and get all customers for region 2 and their total order values for the past month in the form of a ProDataSet.

DA Layer: Query DB, Get customers, calculate totals, create ProDataSet, output to BL Layer.

BL Layer: output PDS.

This however makes the BL Layer redundant and we're back where we started but with a void layer in between.

My question is what traffic should be passed between the BL and the DA?  How much processing can the DA do?  (In my final example the DA layer is only accessing data and presenting it in a different way).

In my head I believe that the DA should perform DB queries and copy the results into a temp table and pass the temp table out to the BL.  Nothing more.  Is this correct?

Any help or advice is appreciated.

Thanks

Oliver

All Replies

Posted by Thomas Mercer-Hursh on 06-Aug-2009 16:19

Response moved to the architecture forum here http://communities.progress.com/pcom/message/64161

This thread is closed