home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.modula3
- 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
- From: cflatter@nrao.edu (Chris Flatters)
- Subject: Re: Proper use of interfaces/modules for top-do
- Message-ID: <1993Jan10.222357.23520@zia.aoc.nrao.edu>
- Sender: news@zia.aoc.nrao.edu
- Reply-To: cflatter@nrao.edu
- Organization: NRAO
- References: <1993Jan8.163340.12922@slate.mines.colorado.edu>
- Date: Sun, 10 Jan 93 22:23:57 GMT
- Lines: 31
-
- In article 12922@slate.mines.colorado.edu, lpratt@slate.mines.colorado.edu (Lorien Pratt) writes:
- > I wonder if somebody could answer some questions about, or give me a pointer
- >to a reference for, how to do proper top-down programming with
- >modula-3? I'm teaching this language for a data structures course and
- >learning it at the same time, and I want to be sure I communicate
- >whatever is the usual philosophy for modular coding in modula-3. I have
- >the Harbison book, but chapter 8 seems to present more legal syntax than
- >stylistic issues; and the programming conventions chapter doesn't get into
- >modularity.
- >
- > For example, what's the proper way to go about developing a program?
- >Do you write the Main module, then the interfaces, then try to compile to
- >check for type consistency, then fill in the modules for the interfaces?
- >Or do people typically write their interfaces and modules that export them,
- >before trying to incorporate them into the main procedure? Is it a good
- >idea to have multiple procedures per module?
-
- The common practice in developing a program using a language supporting
- modules (be it Modula 3, Modula 2, Ada, Fortran 90 or whatever) is to
- determine what data structures will be needed by the program and what
- functions act on each data structure. You then write a module for each
- different data structure including the definition of that data structure
- and the functions that act upon it: aspects of the data structure that
- need not be known in order to use it should be made private to the module
- (this minimizes the chances that changing the implementation of the
- data structure will require changes in the program that uses it). Hopefully
- you will then have a data structure and its associated functions packaged
- in such a way that they can be used in a number of different programs.
-
- Chris Flatters
- cflatter@nrao.edu
-