954,089 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Function Style: writeLog(...)

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

Cudmore
Junior Poster in Training
74 posts since Nov 2005
Reputation Points: 20
Solved Threads: 6
 

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

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

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.

WaltP
Posting Sage w/ dash of thyme
Moderator
10,492 posts since May 2006
Reputation Points: 3,348
Solved Threads: 943
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: