Where interfaces fall down...
A few of us at work are working on a fairly sizable equipment control application. Because various pieces of the equipment are pluggable and a single piece of equipment can actually perform several different tasks, we broke the equipment down in terms of interfaces. So far, that has been a great decision… until yesterday.
We need to present some information to a GUI about some of the limits of the equipment. However, the equipment classes were designed to accept a connection (either via GPIB or Ethernet). The hope was that the equipment would receive a fully constructed connection object, and be able to use it right away. But here’s where the problem lies. To get the limits of the various interfaces presented by the equipment we don’t need a connection, and more importantly, may not know everything that we need to make a connection. However, these are parameters that are intrinsic to the equipment itself. So, we’d like to throw those into the interface and access them as class methods. Unfortunately, you can’t do that. In Java, you must have an object to obtain a reference to an interface. That means we either put this stuff somewhere else, or we don’t connect and initialize on construction. Bummer. Yet another instance of where Python would have Just Worked.