LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to design architecture for framework that supports different protocol

We are developing a framework using LabVIEW. We have separated the framework into the front end and back end and any communication protocols like gRPC, Rest APIs or TCP can be used. To achieve multiple protocol communication functionality, for each utility, we had to go with class architecture to override methods based on the communication protocol used. For example, let’s take a calculator I have front-end UI, client, server, and backend. To support multiple protocols, the design comes as below.

Class_Arch.JPG

Pros:

  1. Scalable any other protocols

Cons:

  1. Large source code maintenance. Even for a simple calculator, we have 4 base class

We would like to know if this is the right approach to switch between protocols or is there any other better approach to easily switch protocols
Please add your thoughts. Thanks in advance

0 Kudos
Message 1 of 3
(982 Views)

You might consider using composition instead of inheritance to define which protocol is used. So when you create your "calculator" you pass in a "protocol" object that it uses to communicate with others. Please excuse the bad uml:

 

avogadro5_1-1697500667594.png

 

The objective I would be going for with this is to not have to define every method in every protocol, do what you can to keep them generic to reduce the burden of changing them out.

 

0 Kudos
Message 2 of 3
(917 Views)

Thanks avogadro5

This pattern helped to solve the issue 😊

 
0 Kudos
Message 3 of 3
(856 Views)