Software Development Kit
to the Delphi-Win32 and Free Pascal compilers
Home > Wiki > Overview

Overview

english (en) | português (br)

To build an application with PressObjects, it's important to have basic understanding of its frameworks and how they relate to each another.

Contents

Data Type, the main framework

The data type (PressSubject), or Subject, are a set of classes that are the base of the application's business objects.

This framework is made by the TPressObject (base for a business class), different types of attributes, the PressModel object that maintains information of the business classes and attributes used by the application, and various auxiliary classes such as Metadata and Memento.

Read more information about the business class this article.

If you come from TDataSet, read this article

Metadata

All business classes have more information that can be stored in RTTI. For this reason PressObject's data type has classes to interpret and store the business classes' metadata.

Read more about the creation and use of the metadata in this article.

Memento, or SavePoint

Changes made in a business object can be monitored in case the data from a previous point in time is needed. This resource is called SavePoint, it implements the Memento pattern, additional information can be found here.

MVP, the presentation framework

The MVP framework is responsible for the presentation of the data contains in the business objects. For those that know the TDataSet family, the data type framework replaces a descendant of TDataSet (TTable, TQuery and descendants of TField) and the MVP replaces the DBware controls, although, completely object oriented.

Even though an MVP framework is very complex, an interface to PressObjects' MVP is very simple to use and to optimize. A combination of four simple steps (which will be simpler one the Project Explorer is complete):

  • Create a presenter class for the business object. For example, TProduct gets TProductEditPresenter class that will be used to change the TProduct object.
  • Overload a virtual method of this class to link every business object's attribute with a form's visual control. One line per attribute;
  • Register this class in the initialization section of the unit, linking it to its respective business object.
  • Create a form with simple controls (Edit, StringList, ComboBox, CheckBox, etc) and register it with its presenter class (in this example, TProductEditPresenter) in the initialization section of the unit.

Read more about MVP in this article

OPF, the persistence framework

PressObjects has a robust set of classes to assist you to persist and re-instantiate your business objects (PressOPF ). Just create a configuration file (or have the data in static form in the application, see the options here) and make the DDL for the database with the framework's help.

Once the database is created and the connector is configured, a simple Session.Store(Product) verifies the connection and checks the transaction, it generates the necessary DMLs for the database to save or update the object, including compositions and aggregates (lookup, master-detail, etc)

Read more about persistence in this article.

Creating an application

Creating an application requires some special modifications, such as changing the traditional Application.Run. More details about this topic is available here.