When the reviewer doesn't understand my Javascript it's his fault
-
@HardwareGeek said in When the reviewer doesn't understand my Javascript it's his fault:
@coderpatsy I don't think anyone would accuse our mods of being enlightened.
I thought it were our admins which are down to earth...
-
This situation sounds infuriating.
For the coding standard, I recommend setting up
prettier
and making it mandatory to format all PR-s.Some teams also use very strict eslint to combat shit like this, but IMO that's going a bit too far towards trying to solve a political problem using technology. The best solution for a guy like that (if you don't have pull to get him canned) is to put him on writing supplementary code (eg. tooling or unit tests) or work on support projects ("need a JS coder to handle jQuery on a marketing site? I have just the guy for you").
-
@HardwareGeek said in When the reviewer doesn't understand my Javascript it's his fault:
@coderpatsy I don't think anyone would accuse our mods of being enlightened.
That sounds like something one would really have to work at.
-
@boomzilla Exactly
-
@boomzilla said in When the reviewer doesn't understand my Javascript it's his fault:
@HardwareGeek said in When the reviewer doesn't understand my Javascript it's his fault:
@coderpatsy I don't think anyone would accuse our mods of being enlightened.
That sounds like something one would really have to work at.
Either you know what I see that you did there or you do not, and somehow that's supposed to be alright, is it?
-
@Gribnit said in When the reviewer doesn't understand my Javascript it's his fault:
@boomzilla said in When the reviewer doesn't understand my Javascript it's his fault:
@HardwareGeek said in When the reviewer doesn't understand my Javascript it's his fault:
@coderpatsy I don't think anyone would accuse our mods of being enlightened.
That sounds like something one would really have to work at.
Either you know what I see that you did there or you do not, and somehow that's supposed to be alright, is it?
"When the replier doesn't understand my post it's his fault."
-
@boomzilla @Tsaukpaetra got it
-
@Gribnit said in When the reviewer doesn't understand my Javascript it's his fault:
@boomzilla @Tsaukpaetra got it
Did he?
-
@Tsaukpaetra Yeah, you forgot though.
-
@Gribnit said in When the reviewer doesn't understand my Javascript it's his fault:
@boomzilla @Tsaukpaetra forgot it
-
@cartman82 said in When the reviewer doesn't understand my Javascript it's his fault:
This situation sounds infuriating.
Oh I'm in therapy for it. (It's online-therapy called TDWTF.)
For the coding standard, I recommend setting up
prettier
and making it mandatory to format all PR-s.Thanks, looks good.
Some teams also use very strict eslint to combat shit like this, but IMO that's going a bit too far towards trying to solve a political problem using technology.
Well actually did setup a
eslintrc.yml
for the project. It's just that neither nor me wants to use it. He'll first have to explain the deviations from AirBnB style. And so far he's failed to convince us. Not that we started on a good footing.The best solution for a guy like that (if you don't have pull to get him canned) is to put him on writing supplementary code (eg. tooling or unit tests) or work on support projects ("need a JS coder to handle jQuery on a marketing site? I have just the guy for you").
He might be useful on the tooling side. I know he fixed a Vagrant config I'd given up on. And as for getting him canned: So far he's disgruntled everybody who's had to work with him. If this doesn't change, there won't be a good reason to keep him.
-
@boomzilla said in When the reviewer doesn't understand my Javascript it's his fault:
@Gribnit said in When the reviewer doesn't understand my Javascript it's his fault:
@boomzilla said in When the reviewer doesn't understand my Javascript it's his fault:
@HardwareGeek said in When the reviewer doesn't understand my Javascript it's his fault:
@coderpatsy I don't think anyone would accuse our mods of being enlightened.
That sounds like something one would really have to work at.
Either you know what I see that you did there or you do not, and somehow that's supposed to be alright, is it?
"When the replier doesn't understand my post it's his fault."
I miss Blakey sometimes.
-
@gleemonk said in When the reviewer doesn't understand my Javascript it's his fault:
Oh I'm in therapy for it. (It's online-therapy called TDWTF.)
Unfortunately it's not covered by the damn communist medical care
-
@Gąska The odds of anyone getting that were pretty long. Is good Zen Buddhist joke.
-
@Luhmann
Yeah, but it's not like the cost in sanity is really something any of us actually pay. Can't get blood from a turnip and all.
-
@izzion There is no floor. At the end of an infinite void Azathoth waits gibbering. I am drinking with him.
-
Related:
-
@gleemonk If you have to force a coding style, let alone use a tool to do so, you're doing it wrong.
Style Nazis need to remember that, past some broad conventions (like "we'll use English"), readability is subjective. If you use Pico and can't read Allman, then what is the rationale for forcing Pico on an Allman user? Is it not every bit as "unreadable" to them as the reverse is to you? What makes you so special that your shortcoming (inability/unwillingness to read/learn) is somebody else's problem? Do you go to Stack Overflow and say "hey, I need help with X, but only if you type it this specific way for me?"
You know what's worse, though? When places CONCEAL this information from interviewees. I won't take a job where they hide something like that from me. Hate to break it to you but your bracket placement isn't a state secret or even a trade secret. It does, however, say a great deal about your priorities...
-
@Benjamin-Hall said in When the reviewer doesn't understand my Javascript it's his fault:
@PleegWat said in When the reviewer doesn't understand my Javascript it's his fault:
For some reason, I'm reminded of my hatred of the phrase "It's not rocket science" when applied to software development.
Well, no. It's not. It's computer science. Which is an entirely different ballgame.And rocket science isn't particularly difficult. It needs insane bravery (especially to formulate liquid fuels) and good, careful engineering, but it's not like QFT or any of the particularly abstruse fields of science.
That's what I tell my pupils about creating explosives when someone asks about it (usually when I mention the nitro-group).
The reactions involved are quite often rather simple to do. I mean, simply mix sulfuric acid with nitric acid roughly 1:1 and then add cotton. Voilà, guncotton. Or, if you're feeling more
adventuroussuicidal add glycerine instead.It's the "don't blow yourself up" part that's usually a bit more complicated.
-
@Zenith My priorities are to spend time on things that actually matter. That does not include having to wade through 3000-line merge requests mixing formatting changes with 2 lines of functional changes, or untangling merge conflicts across different branches because of this mess. If you can't keep your snowflake formatting to yourself and commit only functional changes, I will enforce a coding style for you.
Coding format is not about forcing your way over the others, it's about having one consistent code format. And using a tool to automatically do it is far better than trying to do that manually.
Once semantic diff dethrones plain text diff, everyone can format their code as they want and have no problems with viewing diffs or merging them. Until then, I'll enforce a general style on my projects and you will adapt to the style those projects already use. If you are such a snob that this is a deal breaker, that says something about your priorities as well.
-
@Rhywden said in When the reviewer doesn't understand my Javascript it's his fault:
@Benjamin-Hall said in When the reviewer doesn't understand my Javascript it's his fault:
@PleegWat said in When the reviewer doesn't understand my Javascript it's his fault:
For some reason, I'm reminded of my hatred of the phrase "It's not rocket science" when applied to software development.
Well, no. It's not. It's computer science. Which is an entirely different ballgame.And rocket science isn't particularly difficult. It needs insane bravery (especially to formulate liquid fuels) and good, careful engineering, but it's not like QFT or any of the particularly abstruse fields of science.
That's what I tell my pupils about creating explosives when someone asks about it (usually when I mention the nitro-group).
The reactions involved are quite often rather simple to do. I mean, simply mix sulfuric acid with nitric acid roughly 1:1 and then add cotton. Voilà, guncotton. Or, if you're feeling more
adventuroussuicidal add glycerine instead.It's the "don't blow yourself up" part that's usually a bit more complicated.
And then you get the ones you can make by accident--nitrogen triiodide is a common byproduct of a particular "classic" highschool chem lab (if you make a mistake in the procedure). It's also a nice, highly unstable contact explosive.
-
@Benjamin-Hall Not too many years ago one school in Lower Saxony had a small explosion in their chemicals repository - they had some picric acid stored in there (it was used in biology to colour cell samples) but had forgotten about it.
The thing with picric acid is that it's harmless as long as it's dissolved in water. Which means you have to refill it from time to time due to evaporation. Otherwise it will form shock-sensitive unstable crystals.Shortly afterwards there was a bulletin sent out to all schools in Lower Saxony to please re-check their inventories (carefully!). Which resulted in seven evacuations and deployments of the bomb squad.
You can also guess how I felt when I got around to checking all the nooks and crannies in my school's chemicals repository - only to discover a locked metal cabinet which I couldn't open because the lock had corroded that badly. Next to that cabinet was an old inventory list. Three guesses as to what chemical was on that list (and the first two guesses don't count).
Thankfully it only contained minor stuff like bromine, lead chromate and fluoric acid.
-
@Zenith Code style is good. Same way it doesn't really matter if IT guy #7 just goes and fixes his boss's computer but he demands a ticket filed anyway. You've got to enforce the generality of coding style and the only way to get people to not argue about the line is to enforce the specifics too.
-
@Zenith said in When the reviewer doesn't understand my Javascript it's his fault:
If you have to force a coding style, let alone use a tool to do so, you're doing it wrong.
Yeah. No.
The point is having a consistent style. Not 23423490 different ones. Makes maintaining a large code base a hell of a lot easier. (Our code base is now around 10+ years old, probably around 1M LOC)
-
@Zenith said in When the reviewer doesn't understand my Javascript it's his fault:
@gleemonk If you have to force a coding style, let alone use a tool to do so, you're doing it wrong.
When two people working on the same project can't agree on a style there's trouble. We as a team might have to force a style. If a member won't agree to it, that person might just find themselves out of a job. For reference, both and agree that we want a consistent style. They just couldn't agree on one for reasons of personality that require outside intervention.
Style Nazis need to remember that, past some broad conventions (like "we'll use English"), readability is subjective. If you use Pico and can't read Allman, then what is the rationale for forcing Pico on an Allman user? Is it not every bit as "unreadable" to them as the reverse is to you? What makes you so special that your shortcoming (inability/unwillingness to read/learn) is somebody else's problem? Do you go to Stack Overflow and say "hey, I need help with X, but only if you type it this specific way for me?"
Absolutely: If my job will require me to read (let alone write) code where half the local variables are written in ALL_CAPS I'll find me another place.
I do care about formatting. I have strong opinions. You know what I care about more? Consistency. You know what I care about even more? Clean diffs. And what do I hate? Fucking merge conflicts because some decided his style needed to be applied to unrelated code.
So, am I style Nazi in your view?
You know what's worse, though? When places CONCEAL this information from interviewees. I won't take a job where they hide something like that from me. Hate to break it to you but your bracket placement isn't a state secret or even a trade secret. It does, however, say a great deal about your priorities...
Oops I must have missed my stop on the .
-
@DCoder said in When the reviewer doesn't understand my Javascript it's his fault:
Coding format is not about forcing your way over the others, it's about having one consistent code format. And using a tool to automatically do it is far better than trying to do that manually.
Once semantic diff dethrones plain text diff, everyone can format their code as they want and have no problems with viewing diffs or merging them. Until then, I'll enforce a general style on my projects and you will adapt to the style those projects already useBut all that really means is that the code style in source control needs to be consistent. What style I use in my sandbox should be up to me, so that my productivity is higher because I'm looking at code in a way that is most readable to me.
The means there needs to be tooling around source control. Whenever I pull a file out (whether its a checkout, a temporary grab for a diff, etc), it should be converted via some tool to my preferred format. Whenever I check in, the files should be converted to the standard format.
Have I ever worked in an environment that had such tooling? No.
Can I envision such an environment? Yes.
Does my current company have the time and resources to set up such an environment? No. sigh.
Does any company have the time and resources to set up such an environment? Probably not. sigh.
I'll ride off on my unicorn now.
-
@RobFreundlich I can't wait for projectional languages to become more commonplace so everyone can style it however they want while committing the same files.
-
@Gribnit said in When the reviewer doesn't understand my Javascript it's his fault:
@Gąska The odds of anyone getting that were pretty long. Is good Zen Buddhist joke.
Really? I thought it was pretty straight-forward, if you know the relevant details.
-
@RobFreundlich said in When the reviewer doesn't understand my Javascript it's his fault:
Does my current company have the time and resources to set up such an environment? No. sigh.
Does any company have the time and resources to set up such an environment? Probably not. sigh.
I've heard that Prettier can be used in commit hooks. That would force a particular style on checkin, and it's not hard to do. (My team is currently debating on this - a couple of people are test-driving it locally right now. And it's important to us because outside teams are contributing code – and those outside teams occasionally have different styles.)
The trouble, of course, is that Prettier is not particularly customizable. You vill use Prettier's style and you vill like it!
-
@DCoder y'know a formatting commit can be okay from time to time as long as it contains no functional changes.
-
@PotatoEngineer I've seen people burn time on prettier version mismatch.
-
@PotatoEngineer said in When the reviewer doesn't understand my Javascript it's his fault:
I've heard that Prettier can be used in commit hooks. That would force a particular style on checkin, and it's not hard to do. (My team is currently debating on this - a couple of people are test-driving it locally right now. And it's important to us because outside teams are contributing code – and those outside teams occasionally have different styles.)
I prefer to have style checking as part of the CI flow; the external contributions can be kept on their own branch until they pass. It's a bit softer than a commit hook, which is good because occasionally the autoformatters make a wrong call and the right fix in that is in the stuff they won't do (such as renaming a constant that's got a name longer than 80 characters!).
-
@dkf said in When the reviewer doesn't understand my Javascript it's his fault:
such as renaming a constant that's got a name longer than 80 characters!
Have you tried with your legendary cluebat yet?
-
About the ALL_CAPS thing, did code in other languages before? Because for me, who's coded in C and C++ before, that is how you're supposed to declare constants in those languages.
In fact, I didn't even know javascript even had globals. Or
const
.
-
Wow what a cumbucket of a person.
-
@Medinoc said in When the reviewer doesn't understand my Javascript it's his fault:
About the ALL_CAPS thing, did code in other languages before? Because for me, who's coded in C and C++ before, that is how you're supposed to declare constants in those languages.
Really? Macros, sure. But constants? I haven't worked anywhere with that style.
-
@dcon I use that style. I've grown used to it from C when constants were indeed macros.
-
@DCoder No, for too many clowns calling themselves developers, coding format is exactly about forcing your way over others. That's the problem (that too often goes unseen when it's your way being forced). The consistency argument goes right out the window when the Nazi won't even follow their own rules. Priorities? When you're double-digit months behind, buried in endlessly-recurring help desk tickets, or both, you don't drag somebody that's reducing your technical debt into a meeting to cry about bracket placement if you have your head screwed on straight. And if you're not willing to be honest with candidates about what they're getting into, well, there's a snowflake and it isn't them.
-
@Medinoc said in When the reviewer doesn't understand my Javascript it's his fault:
About the ALL_CAPS thing, did code in other languages before? Because for me, who's coded in C and C++ before, that is how you're supposed to declare constants in those languages.
By my understanding of convention, these globals are rightfully in ALL_CAPS:
const PI = 3.1415 const DB_NAME = "files_2016_backup_2" const DEBUG = true
They are constant during execution. And this is a example of his understanding of the convention:
function circumference(r) { const DIAMETER = r * 2 return DIAMETER * PI }
He's arguing that
DIAMETER
is declaredconst
and thus is a constant and as such must be written ALL_CAPS. In my viewDIAMETER
is not a constant because it changes withr
. During execution, it can hold different values. It's a variable! But I can't get this through to .In fact, I didn't even know javascript even had globals. Or
const
.const
is relatively new. Anything declared outside functions is in global scope.
-
@Zenith
No, of course good reasons to enforce a consistent code style were not in this new reference class which you have just now constructed in such a way as to contain only exaggerated bullshit. And of course others have pleaded their own exceptionalism, just as you are doing now.
The problem in your examples is that you're working with idiots, not that those idiots have focused their energy on a code style.
I never said this was a critical priority task that should block all other work, and I never said you should deceive your candidates. I said that a consistent code style makes it far easier to integrate work made by others. Period. And if formatting is done automatically (e.g. Prettier, Visual Studio autoformat or IntelliJ IDEA File Watcher), there's even less reason to "not follow their own rules".
-
@pie_flavor said in When the reviewer doesn't understand my Javascript it's his fault:
I can't wait for projectional languages to become more commonplace so everyone can style it however they want while committing the same files.
/rob does a little research
Cool!
-
@RobFreundlich Jetbrains MPS is the best one I've found.
-
@PotatoEngineer said in When the reviewer doesn't understand my Javascript it's his fault:
I've heard that Prettier can be used in commit hooks.
It's the other direction that's the problem. When I'm doing a diff or a merge, I want to see it in my format. So there needs to be a get hook as well.
-
@gleemonk said in When the reviewer doesn't understand my Javascript it's his fault:
Anything declared outside functions is in global scope.
I'm going to here, even though I'll probably be technically wrong on some level.
window
is the true global, but is assumed and so any properties of it can be accessed without specifyingwindow
.
So basically, a global is any direct property of the window object.
-
@kazitor said in When the reviewer doesn't understand my Javascript it's his fault:
@gleemonk said in When the reviewer doesn't understand my Javascript it's his fault:
Anything declared outside functions is in global scope.
I'm going to here, even though I'll probably be technically wrong on some level.
window
is the true global, but is assumed and so any properties of it can be accessed without specifyingwindow
.
So basically, a global is any direct property of the window object.
True, but the window object is the global scope (from a JS view point there isn’t any other “higher” possible context to run in or even reach) , therefore anything attached to it is — a priori — a global.
So it’s not even ing, it’s just a restating.
-
@dcon That's Java's style for public static final members, that is.
-
@M_Adams - for JS in a browser.
Object.prototype is the true global...
-
@RobFreundlich said in When the reviewer doesn't understand my Javascript it's his fault:
It's the other direction that's the problem. When I'm doing a diff or a merge, I want to see it in my format. So there needs to be a get hook as well.
Needs to integrate with Slack (or whatever other messaging client your team uses) so that when people ping you code snippets you see it in your preferred style. Including adapting all line numbers relevantly too.
(Or: You're doomed! Doomed! You're all doomed!)
-
@Gribnit said in When the reviewer doesn't understand my Javascript it's his fault:
@M_Adams - for JS in a browser.
Object.prototype is the true global...
Durrrrrrrrrrrr.....
That was the scenario under discussion.
-
@gleemonk said in When the reviewer doesn't understand my Javascript it's his fault:
const PI = 3.1415
No.