[BioRuby] BioRuby standards

Pjotr Prins pjotr2008 at thebird.nl
Tue Sep 2 09:19:58 UTC 2008


Hi Naohisa,

Thanks for your reply. Some comments.

On Tue, Sep 02, 2008 at 05:47:11PM +0900, Naohisa GOTO wrote:
> As you said, no standards, but, empirically in BioRuby,
> 
>  * Small errors are simply ignored and the program continues.
>  * When normal (but not severe) errors, prints warning messages
>    to $stdout, and continues to process.
>  * When severe error, raises error.

This is fine for an interactive program - like the shell. But it is
not such a good strategy for software calling into Bioruby (think of a
web server). I am unhappy with this state of things. Can we come up
with something better? I think in the long term this will help
predictability of BioRuby. 

> Because BioRuby is a library (except for BioRuby Shell),
> it is generally not so good to depend on environment variables.

Fair enough.

> Instead, to prepare APIs to set cache positions and sizes
> is better.

That would be cool. That API could take care of environment options
too, if we were ever to introduce them.

> Note that some classes use Tempfile class, a standard bundled
> class with Ruby by default, and the Tempfile class depends
> on enviroment variables (TMPDIR, TMP, etc.).

I noticed. Caching is a bit different in nature - as caches may be
there for a long time. TMPDIRs get emptied on reboot, for one.

> I think cache isn't suitable for standard, because its purpose
> may differ from program (or class, module, etc.) to program.

> For example, if I want to put class A's cache on a fast hard disk
> with very large size, and program B's cache on a slower hard disk
> with small size, what should I do?

That is true. OK, leave caching for the modules to resolve. I'll use
my own caching of GEO XML objects.

> > For (1) David Powers came up with a nice approach for the Cfruby
> > project - where modules can override behaviour of the error handling
> > (I wanted that for the Cfenjin application). See 
> > 
> >   http://rubyforge.org/projects/cfruby/
> > 
> > and the source code at:
> > 
> >   http://cfruby.rubyforge.org/svn/lib/libcfruby/flowmonitor.rb
> > 
> > with my usage:
> > 
> > 	http://cfruby.rubyforge.org/svn/lib/libcfenjin/cfp_logger.rb
> >   http://cfruby.rubyforge.org/svn/lib/libcfenjin/cfp_flowmonitor.rb
> > 
> > In my case I wanted to override the standard single switch for WARN,
> > INFO, DEBUG etc., with a second switch for TRACING, VERBOSITY levels
> > and TESTING. For BioRuby it is simpler, as we have (perhaps) have no
> > such requirement at the library level.
> 
> I've not seen this yet, but is it different from the Logger class,
> a standard bundled class with Ruby?
> http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc/classes/Logger.html

The difference is that David's version makes use of an observer
pattern to allow overriding and enhancing. This allows a program to
change behaviour of all (internal) library error handling in a
transparent fashion. Ignore it, it is over the top for BioRuby.

Note: using the logger class consistently would already be a great
improvement.

Pj.



More information about the BioRuby mailing list