RE: [PHP] Re: Includes vs. Functions
| From: | Martin Towell | Date: | Thu, 18 Jul 2002 02:23:54 +0000 |
| Subject: | RE: [PHP] Re: Includes vs. Functions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-108196@lists.php.net to get a copy of this message | ||
> >Chris, thanks for describing your method. The reason I really dislike
> >Functions in PHP is because you have to pass every variable needed by a
> >function, even if that variable is global in the main script, which is a
> >pain in the ass when a function needs a long string of variables. It
makes
> >it easier to forget a variable in the list and can make the code look
messy.
[snip]
> The whole idea behind modularization is that you are creating a "black
> box" so to speak, a chunk of code that performs one function, and one
> function only. It should present a *minimal* interface to the outside
> world. This means that if I have a black box that say, gives me the
> current local time in a particular timezone, I should be able to feed
> it the name of the timezone, and it should give me back the current
> time. I should NOT have to know how it works inside, or care. I feed
> it one value, and it returns another value.
[snip]
To add to this. If you're passing too many values to a function, then maybe
that function isn't broken down enough. I remember hearing/reading that if
you need to pass more than, I think, 5 or 6 values to a function, then
you're passing too many.
Martin