Business Helper Classes
From RemObjects Software
This is a Data Abstract Feature topic
Feel free to add your notes to this topic below.
Data Tables don't support persistent fields. The reason behind this choice has a lot to do with the quality of the code of applications using a purely RAD (event-driven) approach, and the difficulty of isolating business oriented code into reusable units.
Data Abstract solves that problems (and others) through the use of strongly-typed datatables, strongly-typed business processors and business helper classes. In a way, this is similar to what ADO.NET allows you to do with strongly-typed datasets, but the concept was extended a lot.
Strongly typed data tables are returned by type, casting a normal datatable to specific business interfaces so that you can access their fields as properties, or call the additional methods you might need to add.
The purpose of business helpers classes is to implement property getters and setters and provide a base class to inherit from. You will then create one or more descendants and implement your business code in separate units.
The association of TDADataTable and TDABusinessProcessor to a business helper class is accomplished by setting the BusinessRulesID property to match the value used in the RegisterXXXRules call in the initialization section of the units:
initialization RegisterDataTableRules('ClientRules.Customers', TBizCustomersClientRules); RegisterDataTableRules('ClientRules.Orders', TBizOrdersClientRules); RegisterBusinessProcessorRules('CustomerID', TBizCustomerIDRules); end.
When you do this, the data table and the business processor will create an instance of the class associated with that ID (see the 2nd parameter of RegisterDataTableRules and RegisterBusinessProcessorRules) and let those handle the support for the business interface you are trying to use in your code.
So, Data Abstract strongly-typed data tables and business processors greatly improve the readability and integrity of your code by adding type safety to your data tables. Through the use of business helper classes and interface type-casting, you can say good-bye to messy data modules and start designing your systems using pure and clean object oriented techniques in a RAD way.
The architecture of Data Abstract allows you to clearly separate client and server-side business rules and reutilize shared blocks whenever needed. Finally, Object orientation becomes a RAD experience for multi-tier data-access.
For more details and sample code see the DA06 - Strongly Typed DataTables and Business Helper Classes article.
See Also
Product: RemObjects Data Abstract
Current version: Data Abstract 'Vinci' (5.0)
Lists — Glossary — Features — How To — Drivers — Components — Tools — Samples — Articles — Architecture — Issues
