home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / pascal / 5272 < prev    next >
Encoding:
Internet Message Format  |  1992-09-09  |  2.3 KB

  1. Path: sparky!uunet!gatech!purdue!yuma!csn!news.den.mmc.com!iplmail!steveg
  2. From: steveg@iplmail.orl.mmc.com (Steve Gabrilowitz)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: TP units question
  5. Message-ID: <1992Sep9.152408.842@iplmail.orl.mmc.com>
  6. Date: 9 Sep 92 15:24:08 GMT
  7. References: <1992Sep4.141203.28370@news.columbia.edu> <dmurdoch.123.715622406@mast.queensu.ca>
  8. Sender: steveg@iplmail (Steve Gabrilowitz)
  9. Organization: Martin Marietta
  10. Lines: 42
  11.  
  12. In article <dmurdoch.123.715622406@mast.queensu.ca>, dmurdoch@mast.queensu.ca (Duncan Murdoch) writes:
  13. |> In article <1992Sep4.141203.28370@news.columbia.edu> stone@cunixb.cc.columbia.edu (Glenn Stone) writes:
  14. |> >If a procedure/function is only used within the implementation section
  15. |> >of a unit, it doesn't have to be declared in the interface section,
  16. |> >but is there any disadvantage to doing so?  I'm using TP 5.5.
  17. |> 
  18. |> There are a few kinds of disadvantages:
  19. |> 
  20. |> From an efficiency point of view, putting a procedure in the interface
  21. |> section automatically makes it a "far" procedure; calls to those are
  22. |> slightly slower and take a few more bytes in your program.
  23. |> 
  24. |> From a maintenance point of view, putting a procedure in the interface
  25. |> section means that other code can use it; this ties you down to the
  26. |> particular way it works.  If you decide you want to change it, you'll have
  27. |> to track down every use of it outside that unit in order to make sure
  28. |> they're compatible with the new way.  Generally programs are easier to
  29. |> maintain if they're "loosely coupled", i.e. the different units function
  30. |> almost independently of each other.
  31.  
  32. Another disadvantage of doing this is that if you make any changes to the
  33. parameter list in the routine, you have to change it in two places (interface and
  34. implementation) instead of just one.  Also, when you do this then TPC /M will
  35. have to recompile all the units that use the one with the routine you just
  36. modified, where if all the changes had been made in the implementation section it
  37. would not be necessary.
  38.  
  39. -- 
  40.  
  41.  
  42.  
  43. I think
  44. I think I am
  45. Therefore I am!
  46. I think...
  47.  
  48.  
  49.  
  50.                             Steve Gabrilowitz
  51.                             Martin Marietta, Orlando Fl.
  52.                             steve-gabrilowitz@orl.mmc.com
  53.                             Fidonet 1:363/1701 (407-380-1701)
  54.