[fpc-pascal] When are used units recompiled? (wiki page added)
Tom Verhoeff
T.Verhoeff at tue.nl
Mon Apr 10 12:32:27 CEST 2006
On Sun, Apr 09, 2006 at 10:58:09PM +0200, Giovanni Premuda wrote:
> Tom Verhoeff ha scritto:
> >This makes it much less attractive to release units without source
> >code. That may be understandable from an open-source perspective,
> >but in teaching I find it useful or even necessary to provide units
> >without source code.
> >
> IN TEACHING?????
Why this shouting and bafflement? Here are two reasons:
* In order to teach students to use services (=units) solely based on the
contract (= specification), we withhold the implementation and
only provide the compiled unit. That way the implementation cannot
be consulted (=abused).
* In some cases, the unit incorporates some "secrets", e.g. related
to grading. Consider e.g. an assignment where one has to
develop an algorithm for finding the median of an odd number
of distinct integers by using only a binary comparison operator.
To enforce the use of only binary comparisons, we don't give them
the set directly, but rather give them a unit, which "hides" the
actual integers and provides the comparison operator. Of course,
this hidden set can be made inaccessible from the outside by putting
it in the implementation part. In that case, it might seem harmless
to give away the source code. However, there are more complications:
e.g. where does the actual set come from? It is not built into the unit,
but read from a file, or generated via a random generator with a
seed read from a file. The data in the file is scrambled so that
the students cannot simply read it and abuse that information.
Unless you want to use sophisticated encryption techniques, it
is easier to use a "proprietary" method and not give them the
source code.
In fact, the unit need not have a set of numbers to start with, but
could construct a "worst case" scenario base on the actual sequence
of operations carried out by the program (a so-called adversary).
We don't want to give away the strategy of the adversary algorithm.
> Btw. no sane commercial Delphi developer has ever considered using a
> component without source code at least since Delphi 2.0. Look at the
> offering of component vendors and you will see that they invariably
> offer source code licenses.
Most likely because the 'compatibility mechanism' is not very effective.
Compatibility is one of the big problems in component-based development.
Tom
--
E-MAIL: T.Verhoeff @ TUE.NL | Fac. of Math. & Computing Science
PHONE: +31 40 247 41 25 | Eindhoven University of Technology
FAX: +31 40 247 54 04 | PO Box 513, NL-5600 MB Eindhoven
http://www.win.tue.nl/~wstomv/ | The Netherlands
More information about the fpc-pascal
mailing list