Client-Service-Server Model

Polysemes, synonyms and homophones

Naveen Muguda
6 min readDec 26, 2021

Natural languages like English are nuanced. In English, a word can have different meanings(polyseme), different words can have the same meaning(synonyms), and different words can have the same pronunciation but different meanings(homophones).

These nuances can occasionally cause confusion in thinking and conversations. A fictional illustration can be found here.

Service, a polyseme

The word Service is a polyseme and two of the associated meanings are

  1. the action of helping or doing work for someone.
  2. a business that offers a particular type of help or work

The two meanings are contradictory, the first refers to work, while the second refers to the provider of work.

Client-Server Model and Service-oriented Architecture

The following snippets are from the Wikipedia

In computing, a server is a piece of computer hardware or software (computer program) that provides functionality for other programs or devices, called “clients”. This architecture is called the client–server model. Servers can provide various functionalities, often called “services”, such as sharing data or resources among multiple clients, or performing computation for a client.

In software engineering, service-oriented architecture (SOA) is an architectural style that supports service orientation. By consequence, it is as well applied in the field of software design where services are provided to the other components by application components, through a communication protocol over a network. A service is a discrete unit of functionality that can be accessed remotely and acted upon and updated independently, such as retrieving a credit card statement online. SOA is also intended to be independent of vendors, products and technologies.

Note the contrasting meanings associated with Services in the above paragraphs. They correspond to 1 and 2 from the previous section.

These multiple meanings can create gaps in communication and cognition. In the rest of this post, a model is presented that unifies, formalizes, and builds on the concepts from these two schools of thought.

Client-Service-Server Model

The class diagram shown above captures the essence of the Client-Service-Server (CSS) model. Every element provides one or more services, it consumes one or more services provided by others.

Here are some key ideas

  • Service is a first-class construct
  • The server and client are roles these elements don.
  • In a context, an element can be a server and in another, it might be a client.

Cardinality

In the class diagram shown above, there are two key takeaways w.r.to cardinality.

  • a server can provide multiple services
  • service can be provided by multiple servers

Key Differences

Note the difference between definitions in the CSS and CS models. In the CS model, the terms are used to refer to elements, while in the CSS model, they describe roles.

Also, observe the differences with the service-oriented architecture. The servers of the CSS model are equivalent to the services of the SOA world and the services of the CSS model are similar to the service interfaces of the SOA world.

Pervasiveness

The CSS model is a high-level and pervasive model and can be applied in the areas of procedural programming, object-oriented programming, component-based development, service-oriented architecture, and distributed systems.

Software elements like methods, objects, and microservices are servers. Their reason for existence is to provide service.

Service flavors

Services come in many flavors. A service can be confined to a single request(search function), It can span across multiple requests(LIFO), can span multiple threads (bounded buffer), involve multiple clients(workflow) can involve multiple machines like tiers of distributed systems.

Patterns/Idioms viewed from CSS lens

A key takeaway from the CSS model is the potential decoupling between clients and servers. This allows different kinds of transparencies some of which are listed below. Transparencies shield clients from server-side concerns like load, location etc.

Implementation Transparency

There need to be mechanisms to route service to a server, two such are 1)service locator and 2)dependency injection. The service locator is illustrated in the below class and object diagram.

Distributed Systems

The CSS model manifests in multiple ways in distributed systems. Some of which are illustrated below.

Replication Transparency and Load balancing

Load balancing is a service provided, where the server(load balancer) manages a set of instances and routes traffic to them while balancing the load across them. The load balancer utilizes the services of each of the instances.

This service is similar to the concept of replication transparency in the sphere of replicated data stores.

Shard transparency

Data in databases can be partitioned. Where shards contain mutually exclusive and collectively exhaustive data. The sharding information can be static or dynamic. This information can be hidden from the clients. This is done by using a redirection service as shown below.

Service Discovery

In a service-oriented architecture, especially when containers are employed, the location of servers can be dynamic. The need to locate them is a cross-cutting concern. This is encapsulated as a discovery service in distributed systems. A service that is aware of the location of all other services.

Composability of services

Services can be composed together into richer services. If the discovery service remembers the location of load balancers. Then clients can get a combination of discovery and replication transparency as shown below.

We can create a chain of services, that progressively raises the level of abstraction. This style can be exploited in the evolution of software, where starting with objects, one can proceed to build components, distribute them, and then make them microservices.

Conditional, progressive service presentation

A user is provided the capability to add items to a cart, only if there exists more than one item, will the user be provided the capability to check it/them out.

Similarly, we can provide services based on services earlier consumed or other state. This pattern is usually adopted in workflow/orchestration systems. The HATEOAS concept of REST is another application of this pattern.

More Architectural patterns

Other (advanced) architectural patterns like embedding, redirection can be reasoned with the CSS model.

CSS model and schools of programming/design

Interface-based programming, Component-based software engineering, and Design by Contract are programming styles that highlight the distinction between services and servers and advocate the 1:n and m:n cardinality of relations mentioned above.

Both the interface-based and component-based programming styles emphasize coupling to services and not servers.

Summary

This post introduces the Client-Service-Server model, which is a refinement of the Client-Server Model. It promotes Service as a first-class construct and decouples servers from clients.

The focus on services facilitates different kinds of transparency as well as separation of concerns.

The model can be applied in the reasoning of both single and distributed systems as well as different schools of programming and different levels of abstraction.

--

--