Jump to content

Advice On Creating an API


Recommended Posts

Hi,

Finally I have gotten round to doing some work on a package of code that I would like to end up in the Lava CR.

It is an API to allow use of the ClearCase source control in LabVIEW. I am not sure how many people will find it of interest but just doing this has been a learning experience for me.

I have used Ton Plomp's Mecurial API package as inspiration, thanks Ton.

A lot of the code I have had and been using for a couple of years, but making into an API that anybody can use has changed how I have to look at the code. I have now done quite a bit of functionality, but I have a general question and would like some advice.

Thought the example below is a specific the questions it ask can generally be applied to a number of my VI's

I have a VI GetExtendedPathName.vi that gets for a file or folder the ClearCase extended pathname for example my.vi@@\main\dev-ats-23\4, in getting the information I also find out if the file or folder in question is checkedout and also some other possible information about that VI.

So the first question is should I provide both the extended pathname and the file 's checkedin / checkout state as output in the same VI or should I separate this out into two VI

GetExtendedPathName.vi & IsObjectCheckedOut.vi even thought the code within each is basically the same I am just ignoring one of the possible output.

I know I could write a private GetObjectInfo.vi which is called by two public VI's GetExtendedPathName.vi & IsObjectCheckedOut.vi but at the top level user view should there be two VI or one. I currently only have one VI but I feel this is wrong.

Second question is on how to address error's in particular predictable error's. So in the example above in order to get this information the file or folder I am looking at needed to be a ClearCase object (i.e. added to the repository at some time), so one possible error is if the user trys to get this information on a file that is still not added into the source control system. In this case should I return the error " −2911 The specified file is not under source control" or as I know what that error means should I clear the error and set a FP flag "File is View Private" true.

The second question also applies to things like checkin or checkout file if you try to checkout an already checkedout file should you error or clear the error and flag that file is already checkedout.

I hope these questions make some sense and I would appreciate other peoples views on this.

I suppose a final question is would anyone actually be interest or find such a package useful.

cheers

Dannyt

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.