Write your code with extensibility in mind

Discussion created by TimCarmichael Champion on Nov 4, 2016
Latest reply on Nov 7, 2016 by Bryan Owen

Some time back, I wrote some ACE code to calculate the sunrise and sunset times for assets we have based on the latitude, longitude, time zone and whether the asset observed day light savings time or not. The particulars (latitude, longitude, DST flag, time zone) are stored in an AF table; the attributes are selected in the various elements.

The actual PI tags are stored in the module database


After it was implemented (approximately 20 assets in multiple regions - all of the assets on one PI server), the same requirement arose for another set of assets - similar arrangement, different PI server.


The number of assets has grown and I've finally had time to go back and get the items current - create the PI tags, populate the AF elements, update the AF table, etc.


Ultimately, the AF table will be loaded from an external source and a formalized process will be put in place to add elements as needed, etc.


But.. the original code has not been significantly changed since inception. Plan your work so that it can be easily reused in another environment.


How have you implemented these concepts of re-use?