Data-Centric Programming in Modern Application Design

Before you learn about the concept of data-centric programming, you should understand the traditional approach for developing applications on IBM i: program-centric programming.

With this approach, the program has the following responsibilities:

Data Access
Determine the files that are needed and the data access method (usually, record access level (RLA) to retrieve data one row at a time). Also, the program itself determines the relationship between the files, making the database management system (DBMS) of little

Business Logic
The program has all the business rules embedded into the code (either directly or through a copy member). Business logic enforces the referential integrity between files.

User Interface
Show the results of the processing of the data and business rules to the user.

Monolithic applications can be considered as program-centric, but you can also think of modular applications that are built as program-centric. 

Example of the structure of an application that is designed using a program-centric approach:

Data-centric programming in modern application design 1

As you might notice, the program-centric approach has many disadvantages

  • The application is not taking advantage of the DBMS and its future updates and features
  • It is inflexible and cannot adapt to new business needs
  • Business rules are duplicated across various programs. As business rules change,
    programs must be changed or recompiled
  • There are performance issues that are associated with RLA
  • The application must be recompiled if a file changes
  • Database normalization can be inexistent
  • Referential integrity is implicit

Conversely, data-centric programming can be understood as the strategy to solve business problems by taking advantage of the features of the DBMS. This approach proposes implementing more business logic in the database and separating the business logic from high-level application programs. Figure 3-2 shows the basic structure of a data-centric program

Hll program or interface

Data-centric programming aims to take advantage of the DBMS, specifically with the following

Optimizing the access to the data
The application requests data through SQL statements. Then, the DBMS selects the best way to access the data and advises the usage of any indexes that are required to make it more efficient.

Using constraints
With the usage of constraints, you can move business rules from the applications to the DBMS.

With the usage of the DBMS, it is easier to keep normalization at least to third normal form. The DBMS understands the relationships of the tables by use of primary key (PK) and foreign key (FK) constraints. PK/FK relationships are non-business data, usually through the usage of identity columns in each table. An identity column automatically increments when new rows are added to the table, and it is maintained by the DBMS, not by the programmer.

In summary, here are the primary goals of the data-centric approach:

  • Drive as much work down into the database management system as possible
  • Define business rules as part of the database
  • The rules apply to all application interfaces
  • Take advantage of SQL-only capabilities
  • DDL modifications without affecting programs (that is, Index Advisor and others)
  • Evolve the database to meet new requirements
  • Take advantage of new technology and enhancements to DBMS, such as the new
    optimizer (SQE)

The closer that your design meets the above data-centric goals, the more you can take advantage of advanced technology. Here can you see a comparison between program-centric and data-centric approaches

Program centric vs data centric
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}