Found this article on the net:
Can someone explain to me what the author is talking about in item 6? More precisely, what is the alternative to passing a lot of paramaters to a function?
For example, I have a user list. When one presses "Edit" next to a user, a form is filled out. The form is filled out by a function that takes a bunch of parameters. All the parameters initially come from the database and are attached to each of the edit buttons. How can this be improved? The only thing I can think about is a Javascript array that is populated by a server side language. Then the edit function could take only 1 parameter -- an offset in the array.
I'm really curious as to what that article is talking about because that's precisely my situation in many cases.
Can someone explain to me what the author is talking about in item 6? More precisely, what is the alternative to passing a lot of paramaters to a function?
For example, I have a user list. When one presses "Edit" next to a user, a form is filled out. The form is filled out by a function that takes a bunch of parameters. All the parameters initially come from the database and are attached to each of the edit buttons. How can this be improved? The only thing I can think about is a Javascript array that is populated by a server side language. Then the edit function could take only 1 parameter -- an offset in the array.
I'm really curious as to what that article is talking about because that's precisely my situation in many cases.