FORTRAN 77 and structured design
暂无分享,去创建一个
In his book on structured design [I], >~YERS refers to an object he calls an ~'informational strength module" and suggests that Fortran is a language suitable for programming such objects, q~is is not correct in the case of standard Fortran 66, which does not support multiple entry points in subroutines. However it is true for Fortran 77 [2] and since I have access to a compiler I have taken the opportunity to write several such modules. Experience suggests that while the concept is quite workable, the language has deficiencies which make the exercise unnecessarily difficult ~nd even dangerous. For details about structured design, interested parties are z eferred to ~[yers' book. For our purposes here it is sufficient to know that an informational strength module (a) has multiple entry points-and-(b) has a monopoly on so~e aspect of the program's job. For exa~llple if the pro6~rammer requires an interface to a file named DAT~ he ,night write a module with four entry points named Oi~S~:_l) Yi'i, <,~i D~ti=~, i;i)'i " D~Ui'A and CLOSi,3 D~'L'A with obvious functions. All interactions with the file are done via this module ~nd il the format of the file is changed, then this module will be the only one requiring modification and recompilation. 1[ have found the following problems: (;~.) %he limitation of six characters maximum for names of entry points, while not crippling, is painful. (b) q11ere are times when it would be most helpful if one entry point could call another. Fortran treats this as recursion (which functionally it is not) and forbids it. (c) ~rrors involving formal parameters are very easy to make ~ind exceedingly dangerous.
[1] Glenford J. Myers,et al. Composite Structure Design , 1978 .