As you may know, Freecell Solver comes with the "lib.c" module, which
contains the freecell_solver_user_* functions. Those functions provide an
API that third-party developers can use to integrate Freecell Solver into
their applications.
However, the "fc-solve" executable, does not use this function but instead
calls the standard "freecell_solver_*" functions from the file
"intrface.c" and from other internal files. So, the question is whether I
should make it use the freecell_solver_user_ functions instead.
There are several pros to this suggestion:
1. We use what we provide - if we recommend others to use
freecell_solver_user than we should use it too. Initially, kpat did not
use these functions, but I later talked Stephan Kulow into porting to them
instead. He contributed a patch to it which enabled him to access all the
functionality he needed from it, thus improving the interface.
2. Better maintainability - since we will rely on it for the standard
fc-solve execution, we can be more sure that the f_s_user_* API is
operational. I had some problems when after having modified the internals
vis-by-vis with main.c, I later had to commit a lot of changes to
the "lib.c" module.
3. More legible code - main.c is quite messy IMO, and accesses many of the
variables of the freecell_solver_instance struct directly. Converting it
to userland functions will make it clearer.
4. A more powerful API - by making sure that all the functionality of
fc-solve is available at the fc_s_user_* level, we can be certain the user
will have everything he needs. (or at least needs and can be supplied
with by Freecell Solver).
5. Less duplicate code - main.c and lib.c will not have the same
functionality.
But naturally there are some cons:
1. Possible contamination of fc_s_user - we will need to have much more
function, which most of them will not interest other developers.
2. Possibly making main.c less comprehensible - since ANSI C is all we
have, we will get statements like
freecell_solver_user_set_a_star_weight(
user_instance,
a_star_weights
);
Of course, this is the exact opposite statement as one of the pros, but
it is possible that a mixture of both will be apparent.
There may be other pros and cons which I cannot recall.
In any case, what are your opinions about it?
Regards,
Shlomi Fish
----------------------------------------------------------------------
Shlomi Fish shlomif_at_vipe.technion.ac.il
Home Page:
http://t2.technion.ac.il/~shlomif/
Home E-mail: shlomif_at_techie.com
A more experienced programmer does not make less bugs. He just realizes
what went wrong more quickly.
Received on Mon Apr 30 2001 - 03:11:15 IDT