Hey!
This is a "style" question.

Is there some defined custom for the order in which parameters are given to a function, or does it depend entirely on the programmer's stylistic preference? What if the developed software should be released to other programs to incorporate in their own programs? Obviously the parameters should be passed in some logical order.. Take the following two cases, for example:

[function] writeDataToFile (FileName, Data) {}
[function] writeDataToFile (Data, FileName) {}

Which one is preferred? Does it matter? I know the first example is the one which is typically used when passing a file name with data, but, if I, as a programmer [and an artist], were to use the second case, would I be an aberration?

:p

Recommended Answers

All 2 Replies

>Does it matter?
Not really, as long as you're consistent and document the functions.

I agree, it doesn't really matter on an individual basis.

The thing to keep in mind is the other functions in the system. How do they order similar function params.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.