24
Jan/08
0

Cleaner Way To Write Functions

Writing clean and understandable code is always important. When using functions you can easily mess things up as you will probably write all the parameters in one row.

Let’s take example of bad function usage :

do_this ( parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6 )

Better way to do it would be to separate each of the parameters to their own lines :

do_this ( parameter_1,

parameter_2,

// etc…. )

See? A lot cleaner way. I suggest doing this for functions that have more than 3 to 5 parameters.

Still figuring out solution for showing code.. :)

Post to Twitter

Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

No trackbacks yet.