Re: moduel VS parameters
- From: s.c.kramer@xxxxxxxxx
- Date: 30 Jun 2005 08:51:40 -0700
Exactly, modules shouldn't be used to pass around data used in
different parts of the program. Otherwise you'll end up with something
similar to those ghastly f77 codes, where all data is thrown in one big
common block and this data may be changed at random anywhere in the
100.000 lines of code.
If you stare long enough at those 40 arguments, you will probably find
they can be logically divided in some groups and that those groups also
appear in the argument lists of other subroutines. Now if you define a
derived type for each such group, and pass those as arguments to the
subroutine you can make the argument list a lot shorter and everything
becomes a lot more readable. You will then probably also find that a
lot of the subroutines primarily act on the contents of just one of the
groups/derived types. Those subroutines can then be bundled into one
module including the definition of this one derived type. Now you've
got yourself a more object oriented approach (if that's what you're
after): with one kind of object and all of its methods in one module.
Stephan Kramer
.
- Follow-Ups:
- Re: moduel VS parameters
- From: Richard E Maine
- Re: moduel VS parameters
- References:
- moduel VS parameters
- From: yuanliu1
- Re: moduel VS parameters
- From: Richard Edgar
- moduel VS parameters
- Prev by Date: Re: Recursion
- Next by Date: Re: I have no ideas what can it be!
- Previous by thread: Re: moduel VS parameters
- Next by thread: Re: moduel VS parameters
- Index(es):
Relevant Pages
|