.NET Remoting and Delphi - Distributed Architectures
(Page 2 of 11 )
A system divided in two or more executable modules running on different machines, processes, or AppDomains is said to use a distributed architecture. Processes and AppDomains are mentioned because marshalling would still be required.
Although it could be argued that a single executable divided in several units also represents an example of a distributed architecture, we'll stick to examples in which some form of marshaling is required.
Distributed architecture had existed for a long time before .NET Remoting was created. These systems and the technologies used to build them have been the foundation for the design and implementation of what is now available in Delphi for .NET and the Microsoft .NET Framework. Each of these architectures makes use of one or multiple remoting technologies to perform remote communication.
Client/Server
This is the earliest and most well-known distributed architecture. Delphi applications using technologies such as dbGo, Interbase Express, or the Borland Database Engine/SQL Links are client/server.
This type of architecture is usually referred to as two-tier in which a client is responsible for the presentation of the data (that is, using data-aware controls such as TDBGrid) and a server for the retrieval and storage of it.
Although this architecture is simpler to understand and use than others, it has several problems that are critical in today's Internet enabled world:
It usually only works in local area network(s).
It cannot efficiently serve thousands of concurrent users.
It is not easy to update and maintain: Because each client requires a permanent connection to the database and most business logic is contained in the clients themselves, whenever a change is due, all clients need to be redeployed.
Figure 29.2 illustrates a client/server model.

Figure 29.2
Client-server model.
Peer-to-peer
Peer-to-peer indicates networks without a central server in which each computer acts as a client and a server at the same time. A Windows workgroup without a domain server is a peer-to-peer network, for instance.
This type of architecture generally only works in local area networks and depends on frequent UDP broadcasts to make each node aware of the status of the others. These broadcasts are normally not possible over the Internet. Figure 29.3 depicts the peer-to-peer network.

Figure 29.3
A peer-to-peer network.
Gnutella or Napster are forms of hybrid peer-to-peer systems in which each node communicates with a server to find out about the existence of other nodes and then initiates direct communication with each.
Although convenient for file sharing and chat programs, this architecture fails to provide benefits to regular, data-oriented applications.
Multitier
Multitier is the preferred type of distributed architecture today. Delphi applications built using technologies such as DataSnap or Windows DNA are multitier. You will use .NET Remoting to develop multitier systems in Delphi for .NET.
This type of architecture is commonly referred to as three-tier, where a client communicates to a process on a remote server and this, in turn, communicates with an RDBMS located on a different server. This is shown in Figure 29.4.

Figure 29.4
Multitier distributed model.
The key aspect of this type of architecture is the presence of the middle tier. Middle tiers are usually composed of two layers:
Data access—Responsible for querying and updating the underlying data source. It can perform data caching to improve performance and minimize access to the database. It can abstract the RDBMS engine dialect and provide a simple object-oriented API for the business layer.
Business—Normally composed by objects accessible from the clients through Remoting. These objects perform data validation, transformation, in-memory calculations, and so on.
Data access and business layers could reside in different application domains or simply be placed in one. In general, using one application domain makes things easier, although you might opt for a more marked division in a few cases.
An example could be providing a hot-swappable data access layer that works as a plug-in and can be replaced at runtime or during installation without the need to recompile the business layer.
The next section lists some of the most evident advantages of multitier systems.
This chapter is from Delphi for .NET Developer's Guide, by Xavier Pacheco (Sams, 2004, ISBN: 0-672-32443-1). Check it out at your favorite bookstore today.
Buy this book now. |
Next: Benefits of Multitier Application Development >>
More .NET Articles
More By Xavier Pacheco