DEV Community

Discussion on: Don't be a Bracist

Collapse
 
jasongabler profile image
Jason Gabler • Edited

Awesome title :D

Over the years I've relaxed my brace and paren attitudes. If someone has been consistent, after a few minutes I can get the feel of their style and focus on the logic of their code and get hacking.

What still ties me up in knots, and this is about my own coding habits, not other people's code, is long lists of function parameters. I can never decide which is more appealing to the eyes, easier to read, and all while conserving vertical space. So...

public function someBigLongFunctionNameThatTakesLotsaSpace( $paramOne, $paramTwo, $paramThree, $paramFour) {
...
...
}

or

public function someBigLongFunctionNameThatTakesLotsaSpace( $paramOne,
                                                            $paramTwo, 
                                                            $paramThree,
                                                            $paramFour) {
...
...
}

or

public function someBigLongFunctionNameThatTakesLotsaSpace( $paramOne, $paramTwo, 
                                                            $paramThree, $paramFour) {
...
...
}

or

public function someBigLongFunctionNameThatTakesLotsaSpace(
    $paramOne,
    $paramTwo, 
    $paramThree,
    $paramFour) {
...
...
}
Collapse
 
paayaw profile image
Derek Owusu-Frimpong

Probably the last one is better. For me, I try to prevent my eyes travelling far to the right. That makes me lose focus easily.

Collapse
 
johannesvollmer profile image
Johannes Vollmer

Agreed. Also, I don't mind having multiple parameters in one line, but I really need them to be on the left side.

Collapse
 
johannesvollmer profile image
Johannes Vollmer

Thanks :D