What are the best practices for database development with Delphi?

前端 未结 6 1123
陌清茗
陌清茗 2021-02-02 00:56
  1. How can I use the RAD way productively (reusing code). Any samples, existing libraries, basic crud generators?
  2. How can I design the OOP way? Which design patt
6条回答
  •  长发绾君心
    2021-02-02 01:45

    For large applications, I use the tiopf object persistance framework. That lets me deal with objects rather than datasets and swap databases easily. Most of my business logic moves into the business object model (BOM) and my forms are pretty dumb. tiopf has a few ways to connect the BOM to forms; persistance aware controls, Ttidataset for data-aware controls and Mogel Gui Mediator classes for connecting to normal controls.

    For small and quick apps, I just use data modules and database components. The main things to remember are:

    • Put as much code in the data modules (and as little in the forms) as possible.
    • Do multiple data modules broken down by functionality eg the email module, the income module, the invoicing module...
    • Test, test, test

提交回复
热议问题