home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / modula3 / 1100 < prev    next >
Encoding:
Text File  |  1993-01-10  |  2.3 KB  |  44 lines

  1. Newsgroups: comp.lang.modula3
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!bogus.sura.net!howland.reston.ans.net!spool.mu.edu!nigel.msen.com!fmsrl7!lynx.unm.edu!zia.aoc.nrao.edu!laphroaig!cflatter
  3. From: cflatter@nrao.edu (Chris Flatters)
  4. Subject: Re: Proper use of interfaces/modules for top-do
  5. Message-ID: <1993Jan10.222357.23520@zia.aoc.nrao.edu>
  6. Sender: news@zia.aoc.nrao.edu
  7. Reply-To: cflatter@nrao.edu
  8. Organization: NRAO
  9. References: <1993Jan8.163340.12922@slate.mines.colorado.edu>
  10. Date: Sun, 10 Jan 93 22:23:57 GMT
  11. Lines: 31
  12.  
  13. In article 12922@slate.mines.colorado.edu, lpratt@slate.mines.colorado.edu (Lorien Pratt) writes:
  14. >  I wonder if somebody could answer some questions about, or give me a pointer
  15. >to a reference for, how to do proper top-down programming with
  16. >modula-3?  I'm teaching this language for a data structures course and
  17. >learning it at the same time, and I want to be sure I communicate
  18. >whatever is the usual philosophy for modular coding in modula-3.  I have
  19. >the Harbison book, but chapter 8 seems to present more legal syntax than
  20. >stylistic issues; and the programming conventions chapter doesn't get into
  21. >modularity.
  22. >
  23. >  For example, what's the proper way to go about developing a program?
  24. >Do you write the Main module, then the interfaces, then try to compile to
  25. >check for type consistency, then fill in the modules for the interfaces?
  26. >Or do people typically write their interfaces and modules that export them,
  27. >before trying to incorporate them into the main procedure?  Is it a good
  28. >idea to have multiple procedures per module?  
  29.  
  30. The common practice in developing a program using a language supporting
  31. modules (be it Modula 3, Modula 2, Ada, Fortran 90 or whatever) is to
  32. determine what data structures will be needed by the program and what
  33. functions act on each data structure.  You then write a module for each
  34. different data structure including the definition of that data structure
  35. and the functions that act upon it: aspects of the data structure that
  36. need not be known in order to use it should be made private to the module
  37. (this minimizes the chances that changing the implementation of the
  38. data structure will require changes in the program that uses it).  Hopefully
  39. you will then have a data structure and its associated functions packaged
  40. in such a way that they can be used in a number of different programs.
  41.  
  42.     Chris Flatters
  43.     cflatter@nrao.edu
  44.