Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
sariel84472yBecause some people can't function unless they are dictating what everyone else should be doing.
-
Because your code outlives your lifespan on a given project and conventions take it long way. If it is understood and accepted that things should be in alphabetical order, then complying keeps things easier for people who'll take over as they can expect the same conventions followed across the code base.
Today it is alphabetical order, tomorrow someone would crib about camel case. Man, are we going backwards!! -
Jedidja10052y@A4Abhiraj at the same time: how often do you have so many methods in your class that you n e e d to sort it in a known pattern just so the next guy doesn't get lost?
-
hjk10156962yI agree with forces sorting to a certain extent (imports for example) but than also automatically fixable with a formatter.
But not this a quality programmer knows what three better order is logically.
I've had a colleague sort enums alphabetically with a script. Made stuff not only less readable but also broke external logger integration (guess what log LEVELS are in a order for a reason...).
Just kill the lint rules and if they complain send them over to me. -
cygnus11292y@A4Abhiraj I'm all for consistency in naming conventions and all, but some rules are plain stupid and productivity killers. No sane person will try to find a method in the class by going through each one top to bottom. Ctrl+Click or good old ctrl+F is how I expect to find things in the codebase.
-
@cygnus we had the same thing in our linter. I just updated my editor to save it alphabetically. Should'nt really be a developer concern
-
Enforcing alphabetical order is useless. Grouping by functionality would make sense but would also require actual AI.
-
hjk10156962y@A4Abhiraj still @cygnus point stands. Having the order logical to it's use improves readability of the file and we don't use it for navigation like an index (because we use an index for that as functions have a variable amount off lines). Editor's can jump to things for navigation. I want my public interface in top of my class not some helper method that happens to be called ArrayReducer.
Having a suboptimal convention is better than having no convention but having no convention is better than an undermining one.
If you don't believe me I present you the underscore only variable names convention. First var must be named _ second var must be __ etc. Complying will be easier for future developers right? -
@hjk101 alphabetical order is possibly (imo likely) less logical than whatever order happens naturally.
-
hjk10156962y@electrineer That was indeed part of what I was trying to say with the better no convention thing. It's hard to create a less readable order than alphabetical.
-
they can shout at me all they want. constructors go first, public methods that are the main point of the class go after that, private methods related to that primary functiom go after that, and inconsequential quality of life/DRY functions go last.
-
hjk10156962y@spongessuck I like your way of thinking. If I ever encounter this I will only create classes with a conductor and do everything there. Bullshit laws should be followed to the letter not the spirit.
-
@hjk101 as an argument, what you said stands. But ofcourse what I said comes with a certain stupidity barrier. Ofcourse naming all variables with only one character _ is a stupid convention.
How about having imports in alphabetical order ? How about a huge ass translations file in alphabetical order? -
Point being there are cases when it certainly is valid to have this convention.
And taking it to the extremes is definitely a wrong thing. No denying there. But my original point is if there was a set of developers who decided to follow a convention, it is for everyones benefit to follow it. Only if it is stupid like the _ thing, then get rid of it. Or like you said, alphabetical order for enums will be incorrect in almost all languages.
Lint rules that keep shouting at you unless you arrange the methods of a class in alphabetical order. What fucking value does it bring? Who fucking cares ? Why do we have them? Whhhyyyyyy ?
rant