openopc2 icon indicating copy to clipboard operation
openopc2 copied to clipboard

Improvement: OPC server statefulness in OpcDaClient

Open jamesbraza opened this issue 1 year ago • 1 comments

In openopc2.da_client.OpcDaClient, there is some awkward statefulness:

open_opc_config = OpenOpcConfig()
open_opc_config.OPC_SERVER = opc_server  # Pretend no env vars for now
opc_client = OpcDaClient(open_opc_config=open_opc_config)
opc_client.connect(opc_server=opc_server)

The statefulness comes from:

  • Having to embed opc_server into OpenOpcConfig, only for OpcDaClient never to use self.opc_server
  • Having to pass opc_server again to opc_client.connect

Just pointing out this is awkward, and to me indicates room for a better design.

jamesbraza avatar Jan 12 '23 19:01 jamesbraza