Forum OpenACS Development: Package Documentation: How can we tell if a package is fully documented?

Please post here your view on what things are needed in an openacs package that would make it fully documented.

This is for next week's openacs chat and is part of a proposal for providing lists of packages which are fully documented and which are not, primarily for the benefit of new users.

These are the items a package HAS to have in my opinion:

- User Documentation explaining what the package does and how it works.

- Developer documentation that talks about how the package is implemented and its design.

- API is well documented through the use of ad_proc.

- SQL is documented with comments throughout the files.

-Roberto

Roberto wrote: API is well documented through the use of ad_proc.

By using documentation tags:

  • @param
  • @see
  • @author
  • @creation-date
  • @return
  • @error

/Bart

Collapse
Posted by Andrew Piskorski on
Well, we'll definitely have to get the query browser to support the query dispatcher, as Tom J. and Mark A. just pointed out here. I usually use Emacs to read OpenACS code, only occasionally using the query browser for special cases (generally for search), so I didn't even realize yet that it doesn't support the XQL files.

I was wondering about one more thing: After years of using the older ACS toolkits (4.2, 3.x, 2.x, etc.), I only started using OpenACS with its multi database support and XQL query dispatcher fairly recently. One thing I've noticed, is that with the SQL in the separate xql files, as I scan through the Tcl source code the database commands are often so short that I just miss them entirely.

E.g., take this old style (Oracle only, SQL in the Tcl file) query:

set static_page_id [db_exec_plsql do_sp_new {
  begin
  :1 := static_page.new(
    filename   => :sp_filename
    ,title     => :page_title
    ,folder_id => :parent_folder_id
    ,mime_type => :mime_type
  );
  end;
}]
With multi-datbase support, it becomes just:
set static_page_id [db_exec_plsql do_sp_new {}]

I hate the idea of leaving obsolete, non-functional SQL in the Tcl file - doing so has already bitten me more than once. But, is there some other convention that would make the Tcl source code more transparent?

For example, maybe including a marker like this to catch the eye when scanning through code:

set static_page_id [db_exec_plsql do_sp_new {
  --
  -- SQL
  --
}]
Or, maybe even run some tool to copy the query out of one of the XQL files, and put it back into the Tcl file as a comment, so that it's very clear that this SQL code in fact doesn't and can't do the real work at all:
set static_page_id [db_exec_plsql do_sp_new {
  -- begin
  -- :1 := static_page.new(
  --   filename   => :sp_filename
  --   ,title     => :page_title
  --   ,folder_id => :parent_folder_id
  --   ,mime_type => :mime_type
  -- );
  -- end;
}]

Or perhaps there's no advantage to any new changes or conventions like this at all, and the current system is fine. For you folks who have been dealing with XQL files for a long time now, what do you think?

Andrew,

I have noticed Lars using code like this

set foo [db_string get_foo {*SQL*}]

Which is basically what you suggested, just shorter.

I definitely think this is a good idea. You also very quickly know if the query dispatcher cannot find your XQL file.

This wasn't me, that was Vinod who ported the blogger to Oracle. I use the db_string foobar {} form. :)

I've personally gotten used to looking for the db_ commands, and I appreciate the fact that the code takes up fewer lines so it's easier to see the big picture.

I agree, though, that the situation is not ideal. Swapping between foo.tcl, foo.xql, and foo-yourdb.xql to find the corresponding DB statement is annoying. I like the idea of a script to put the DB statements into the tcl file, but I don't think it's realistic, because that would make all your files locally modified and confuse CVS. Besides, then you start relying on it, and when you forget to keep your xql files and your tcl files in sync, you're going to waste time finding the problem.

I think we should modify the api-browser, though, so it does some regexp'ing on db_ statements to bring the query inline. Maybe that would encourage more people to use the API-browser, and in turn encourage more people to improve the API-browser to include things like links to "real" documentation, overview documentation ("why is the API for this package designed like that"), etc.

/Lars

It would be awesome to have an emacs function that switches to the query at the current cursor position. Oh well, just dreaming ...
Well ... long ago my goal was to make the query browser do what Lars describes: bring the query inline.  Allow you to browse in one or the other RDBMS modes with perhaps the option of viewing both (tagged with the proper RDBMS id) - this would be a help for someone trying to understand new code in all its glory in the context of all supported RDBMSs.

If anyone wants to tackle this I think it would be great to add for 4.7.  I don't think it would be that large a task.  It's never bubbled high enough up on my own personal task list for me to get started, though.  And of course the longer I live without such a tool the less I feel like I need it :)

Maybe it would be nice if the sql argument were folded into the args list. then, for regular old db_* commands you would have:

db_1row statement_name [args...]
db_0or1row statement_name [args...]

Note there is already some inconsistency in the db_* commands. db_1row just takes args. Could every command be migrated to that format and be backwards compatible?

Hi,

Whichever we decide lets make it a standard.  Atleast about 6 months ago the decision was "SQL".  See my Things 2 Remember:

http://www.infiniteinfo.com/openacs/things2remember.html

I'm working on a few fixes to the api-browser so that you can at least display the tcl and adp and xql files, even if not highlighted or linked. Right now I have tcl and adp working, but haven't tried xql files yet.

I also am trying to fix some of the procedures in the api-browser that are just commented out, for instance @param lines are not shown. I'll get these back in if possible.

I'll have a patch by Monday.

Okay so it is Friday, later than I thought. I just uploaded a patch to the API Browser that shows source for .tcl, .adp and .xql files. The .xql files are linked to the .tcl file page, so only related .xql files are shown. This patch only covers the content pages, not the library files.