home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!utcsri!torn!news.ccs.queensu.ca!mast.queensu.ca!dmurdoch
- From: dmurdoch@mast.queensu.ca (Duncan Murdoch)
- Subject: Re: TP units question
- Message-ID: <dmurdoch.123.715622406@mast.queensu.ca>
- Lines: 30
- Sender: news@knot.ccs.queensu.ca (Netnews control)
- Organization: Queen's University
- References: <1992Sep4.141203.28370@news.columbia.edu>
- Date: Fri, 4 Sep 1992 16:00:06 GMT
-
- In article <1992Sep4.141203.28370@news.columbia.edu> stone@cunixb.cc.columbia.edu (Glenn Stone) writes:
- >If a procedure/function is only used within the implementation section
- >of a unit, it doesn't have to be declared in the interface section,
- >but is there any disadvantage to doing so? I'm using TP 5.5.
-
- There are a few kinds of disadvantages:
-
- From an efficiency point of view, putting a procedure in the interface
- section automatically makes it a "far" procedure; calls to those are
- slightly slower and take a few more bytes in your program.
-
- From a maintenance point of view, putting a procedure in the interface
- section means that other code can use it; this ties you down to the
- particular way it works. If you decide you want to change it, you'll have
- to track down every use of it outside that unit in order to make sure
- they're compatible with the new way. Generally programs are easier to
- maintain if they're "loosely coupled", i.e. the different units function
- almost independently of each other.
-
- From the point of view of a user, interfacing it can have both positive and
- negative points. It makes the unit easier to understand if it only
- interfaces a few routines. I've got a few units that work perfectly with
- *nothing* interfaced; they're a joy to use, because they're so simple. (They
- do things like initialization and exit handling.) On the other hand, a
- simple interface can't be flexible. You may not like the particular high
- level interface to a library unit; if the low-level interface isn't hidden
- from you, you can construct your own high level interface in a new unit,
- without messing up the implementation of the old unit.
-
- Duncan Murdoch
-