pcdshub / lightpath

LCLS Lightpath Module
https://pcdshub.github.io/lightpath
Other
4 stars 9 forks source link

Simplify Device API #106

Closed ZLLentz closed 2 years ago

ZLLentz commented 4 years ago

Expected Behavior

API should be simple, extensible, and easy to maintain/apply to new devices.

Current Behavior

It is difficult to extend and maintain the API, both here and on existing devices, because it is built around creating a new method or property for each new feature. To my knowledge, the current API involves the following: .insert(), .remove(), .inserted, .removed, .transmission, .subscribe(SUB_STATE), .branches, .destination, .md.z, .md.beamline

To my knowledge, these are also not documented fully. It is easy to accidentally remove or change the behavior of one of these methods and break lightpath.

Possible Solution

Instead of overloading many methods with special meanings that lightpath expects, limit the number of interface points and name them clearly so that it is clear what they are for.

Quick "didn't think for super long or consult anyone" proposal:

Context

Some devices in pcdsdevices no longer work in lightpath because we adjusted them slightly.

klauer commented 4 years ago

I like the proposed solution. Some random thoughts/ideas:

I may be missing something here - feel free to clue me in if so:

ZLLentz commented 4 years ago
tangkong commented 2 years ago

We reworked the lightpath interface in #133, incorporating much of the spirit of this issue.

It took a while but we did it!