DEV Community

loading...

Discussion on: 4 practices for better code

Collapse
tsuzukayama profile image
Tiago Suzukayama

only part I don't really agree with is that long names for functions are bad. Here at work we don't use abbreviations, and it really makes finding out what a function does as easy as reading its name.

Collapse
imikemiller profile image
Mike Miller

I agree. I don't see the negative. Your IDE will autocomplete so there is no overhead

Collapse
lluismf profile image
Lluís Josep Martínez

I agree, abbreviations usually suck. Function/method names should be as long as necessary, not shorter.

Collapse
effingkay profile image
Klaudia Author

That is a good point actually, I haven't thought of that but counterpoint - if you need a long name to describe what a function does, doesn't it mean that it does too much? I'm sure there's exceptions where long name is necessary but usually, shouldn't you need a few words to describe a function or variable? Genuine question

Although yes - abbreviations do suck so I agree, longer name is better imo

Collapse
mikeschinkel profile image
Mike Schinkel

I agree Klaudia.

In our shop we have a convention that is you need to use more than one underscore (we do PHP with snake_case) then you are probably trying to do too much and should probably refactor it. But then our shop is highly convention driven, so we are probably more pedantic about it than most.

Forem Open with the Forem app