O'Reilly logo

Expert Delphi by Paweł Głowacki

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building data-driven user interface

The data access logic has been implemented and it is available through the IToDoData interface. This should be the only way for the user interface logic to access the data. That is why we are going to implement the GetToDoData method in the main form's unit that will return the reference to the data access interface. See the following code:

uses uDMToDo; 
 
function TFormToDo.GetToDoData: IToDoData; 
begin 
  if DMToDo = nil then 
    DMToDo := TDMToDo.Create(Application); 
  Result := DMToDo; 
end; 

In this way, we have achieved a truly pluggable architecture. If we decide to change the underlying database access logic, database access framework, or the database platform, we only need to make sure that the new implementation ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required