It’s been bugging me for years but for some reason it’s been getting me actively annoyed in the last couple of weeks. It’s even more irritating because I know it’s a bit irrational. But anyway, this is how (in kind of pseudocode) you should define a function…
myFunction(argument1, argument2){
...do some stuff
}
please don’t do it like this
myFunction(argument1, argument2)
{
...do some stuff
}
… for some reason it just looks kind of childish to me.
I’m learning Ruby at the moment and one of the growing list of things I like about it is that it gets rid of the curly brackets so the ‘proper’ way is the default. e.g.
def my_function
...do some stuff
end
Also, slightly less subjectively, compressing if…else statements into a single line and doing multiple assignments on a single line are both idiotic if you expect other people to maintain your code, please could you avoid it? No one thinks it’s clever, I mean it compiles down to the same thing in the end and it’s a classic way to introduce hard to find errors by reducing legibility. There’s something about Perl seems to actively encourage this kind of lunacy.
Leave a Reply
You must be logged in to post a comment.
Login [ « ] [ » ]