Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Re: Listing user-written ado files called by program


From   Partho Sarkar <partho.ss@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: Listing user-written ado files called by program
Date   Thu, 8 Sep 2011 09:36:15 +0530

I see that this question does have wider appeal, seeing all the
responses since yesterday!  They have made several suggestions which I
am sure will be useful way beyond my own rather simple requirements.
I am taking the liberty of thanking all the new respondents in this
one message.

Thanks to Stas Kolenikov for his succinct and useful suggestions, especially:

“At the very worst, you can always protect your non-official commands
in place with

capture listtab
if _rc == 199 ssc install listtab, replace
listtab <blah>  “


Richard Williams expressed some misgivings about building programs
which depend on user-written ado files that may or may not be updated.
 This highlights another aspect of the problem.  Thanks in particular
for this suggestion:

“Depending on what you are doing, you might consider incorporating
snippets of code from other programs and include acknowledgements in
the comments”.

I had thought of this, but wondered if this would be quite ethical/proper.


Phil Schumm has very lucidly discussed several points about
“dependency handling” at some length, some of which may perhaps also
be pointers for Statacorp to further enrich the Stata programming
environment:

1.	“…The ideal situation would be to have a way to track these
dependencies (including specific versions) programmatically.  … the
install command (e.g., -net install- or -ssc install-) should comply
by installing those dependencies automatically, or at least issuing a
warning if they are not already installed.

2.	Similarly, it would be nice if there were something like a
"require" command that you could use in a do-file to check for a set
of dependencies (including specific versions).  Certainly, this type
of dependency handling is more important in environments where people
are frequently writing programs that plug into or extend other
programs, or where they are making a lot of use of shared libraries.
There's no reason you couldn't do this in Stata/Mata [though] one
could perhaps make an argument that …the added complexity isn't worth
it.

More immediately , I thank Phil for the following suggestions:

3.	Note that there are two things you can do immediately on your own
to address this issue.  First, WRT dependencies in do-files (or
ado-files that you write for use with a single project only), you can
install them into an ado directory at the root of the project, and
then version them along with the rest of your project code

4.	Second, WRT dependencies for an ado-file you intend for more
general use or to distribute to others, there is no substitute for
writing tests.  You can then distribute these tests along with the
ado-file (e.g., they can be included as part of your package), and
provide users with instructions for running the tests in your help
file.  This doesn't ensure that the user has exactly the same
environment as you used for development, but it does insure that your
command(s) work as intended (which is, after all, the ultimate goal).

Thanks & regards
Partha Sarkar

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index