#1 2025-10-05 17:13:52

sgavrilov
Member
Registered: 2019-05-24
Posts: 22

Managing interface declarations of many separate services

Hello,

I have stumbled into a minor problem indirectly related to mORMot services.

A service via interface requires a file that declares the interface: this file is a part of the service implementation on the server and has to be referenced (in "uses") by the clients that use the service.
If there are several separate services and several different clients that use them, the version control (GIT in my case) and directory structure become not so obvious.

A direct approach would be to have a sub-directory with all interface declaration files as a part of each service implementation project and to include names of these directories in the client Delphi projects ("Search Path" in the project options). This is simple and straightforward but if a client uses many separate services then it has to include as many directories. I suspect this will slow down the build process (especially, if there are quite a few search directories of the components in the Delphi Library config already).

It would be great to "map" all these sub-directories into a single one and reference just it but it looks that this is not possible. I tried to use symlinks to "map" individual source files into a single directory but they are easily broken by unintentional edits while working on the clients.

How do you manage interface files of many separate services? Do I over-complicate the situation? smile

Best regards,
Sergey

Offline

#2 2025-10-05 19:15:30

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,224
Website

Re: Managing interface declarations of many separate services

In the "clean architecture" model, the services interface are defined in the domain layer, and implemented outside.

Defining the interface within the service implementation is not a good pattern, as you found out. It is even some kind of breaking the abstraction principle itself.

Please also refine if you can't split your interfaces by genre, e.g. "application", "domain/model", "infrastructure" for the clean architecture/KDD/DDD model.

Offline

#3 Yesterday 18:41:15

sgavrilov
Member
Registered: 2019-05-24
Posts: 22

Re: Managing interface declarations of many separate services

Thank you for the completely different perspective! I looked more at the technical aspects and missed the design considerations.

I am going to move the interface declaration files to a separate GIT project and reference its directory both from the service implementation projects and from the client projects.

And it looks like I have to re-read parts of the mORMot documentation related to the general design principles more thoroughly...

Offline

Board footer

Powered by FluxBB