Open Side Menu Go to the Top

08-17-2016 , 05:54 AM
Quote:
Originally Posted by Grue
serious question, what is the point of code review if this is the kind of stuff you would pass?
You can discuss all the points raised ITT and then have him/her commit the better code. But upon seeing that piece of code my reaction wouldn't be "ZOMG lol haha look at all the little fails" but rather "that's a pretty good start, let's work on it a bit and we have a solid new dev".
I got the feeling the initial post was venting/frustration if I misread that I'm sorry. My initial reaction would be closer to "ok this is solid stuff we can work with".
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
08-17-2016 , 06:06 AM
I feel like I could make a case for all answers on the first question if I am the event-handler. I guess phone call is supposed to be the correct answer?

In the day and age of the instant answer expecting cell phone crowd I sometimes even feel like IM and mail are getting closer and closer (and many people essentially use Twitter as read-all IM)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-17-2016 , 06:29 AM
First time seeing this. Laughed too much.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-17-2016 , 12:02 PM
Quote:
Originally Posted by clowntable
You can discuss all the points raised ITT and then have him/her commit the better code. But upon seeing that piece of code my reaction wouldn't be "ZOMG lol haha look at all the little fails" but rather "that's a pretty good start, let's work on it a bit and we have a solid new dev".
I got the feeling the initial post was venting/frustration if I misread that I'm sorry. My initial reaction would be closer to "ok this is solid stuff we can work with".
well right I mean thats what I told the guy and we fixed it just seemed like people were saying this is acceptable production code which it obvious isn't at least to me.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-17-2016 , 05:28 PM
Humble Bundle is running a Joy of Coding bundle. Anyone read any of the books and recommend? $15 seems cheap to get access to all of those books even if they are so so.

Sent from my SM-G900R4 using Tapatalk
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-17-2016 , 05:39 PM
That video is pretty good as far as standup programming comedy goes
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-17-2016 , 08:56 PM
does anyone use the airbnb javascript style guide extensively, for eslint or not? If so I'd like to hear opinions on their settings. In particular a few of them seem god awful meaning:

http://eslint.org/docs/rules/comma-dangle
valid:
Code:
var foo = {
    bar: "baz",
}
invalid:
Code:
var foo = {
    bar: "baz"
}
I mean **** off. And other things like requiring any non fat arrow functions to be named? Like I'll use "function" for anonymous functions inside of say jquery because it does "this" the old way, what the **** would I call it? I'm confused.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-17-2016 , 09:04 PM
As someone who's spent a lot of time with python I really prefer the dangling commas and add them everywhere. I don't think I'd require them, though. The main use for them is that adding another entry, or moving any existing entry, is just a cut, paste, without having to add a comma. Once you're used to it you do kinda curse anyone who doesn't dangle their commas.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-17-2016 , 10:06 PM
Quote:
Originally Posted by RustyBrooks
As someone who's spent a lot of time with python I really prefer the dangling commas and add them everywhere. I don't think I'd require them, though. The main use for them is that adding another entry, or moving any existing entry, is just a cut, paste, without having to add a comma. Once you're used to it you do kinda curse anyone who doesn't dangle their commas.
I try to do anything to discourage cut/paste. It encourages laziness which means cut/paste huge chunks of code where what you want is only a few lines out of the bunch. Encouraging cut/paste also seems to reinforce the attitude of "hey it works over there so it'll probably work here" which isn't necessarily true.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-17-2016 , 10:07 PM
By "facilitate cut and paste" I mean "move the 5th line of a dict to the 2nd one", i.e. tidying up.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-17-2016 , 10:47 PM
+1 to dangling commas. kinda surprised to learn there are people who hate them tbh.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-18-2016 , 12:07 AM
idk I look at these dangling commas and read "syntax error".
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-18-2016 , 12:50 AM
Quote:
Originally Posted by Grue
does anyone use the airbnb javascript style guide extensively, for eslint or not? If so I'd like to hear opinions on their settings. In particular a few of them seem god awful meaning:

http://eslint.org/docs/rules/comma-dangle
valid:
Code:
var foo = {
    bar: "baz",
}
invalid:
Code:
var foo = {
    bar: "baz"
}
I mean **** off. And other things like requiring any non fat arrow functions to be named? Like I'll use "function" for anonymous functions inside of say jquery because it does "this" the old way, what the **** would I call it? I'm confused.
Just got with google and stop trying to be hipster

**** AirBnb. Google Maps blows away their entire website in terms of innovation.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-18-2016 , 12:54 AM
Quote:
Originally Posted by Craggoo
I try to do anything to discourage cut/paste. It encourages laziness which means cut/paste huge chunks of code where what you want is only a few lines out of the bunch. Encouraging cut/paste also seems to reinforce the attitude of "hey it works over there so it'll probably work here" which isn't necessarily true.
wat
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-18-2016 , 12:55 AM
Quote:
Originally Posted by _dave_
idk I look at these dangling commas and read "syntax error".
You and the JSON guy.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-18-2016 , 08:42 AM
Quote:
Originally Posted by suzzer99
Just got with google and stop trying to be hipster

**** AirBnb. Google Maps blows away their entire website in terms of innovation.
yeah think I'm going to look elsewhere. My .eslintrc is literally "extend airbnb, 15 lines of disabling their bull****".
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-18-2016 , 02:11 PM
*go with google https://google.github.io/styleguide/javascriptguide.xml

I agree with almost all of this except else on the same line as closing braces.

Code:
if (something) {
  // ...
} else {
  // ...
}
It makes the code so much more bunched up and harder to read imo:

Code:
if (something) {
  const foo = 'foo' + someOtherVar;
  const bar = (isBar) ? 'yes' : 'no';
  doSomething(foo, bar);
} else {
  const turd = 'something' + someOtherVar;
  const blarg = (isBlarg) ? 'yes' : 'no';
  doSomethingElse(turd, blarg);
}
Gross. (yes the code is dumb, just imagine other code)

So you pretty much have to wrap the else with blank lines, which means that to match you have to add blank lines at the top of block 1 and bottom of block 2:

Code:
if (something) {

  const foo = 'foo' + someOtherVar;
  const bar = (isBar) ? 'yes' : 'no';
  doSomething(foo, bar);

} else {

  const turd = 'something' + someOtherVar;
  const blarg = (isBlarg) ? 'yes' : 'no';
  doSomethingElse(turd, blarg);

}
Also gross. When you could just do this and save 3 lines of vertical space.

Code:
if (something) {
  const foo = 'foo' + someOtherVar;
  const bar = (isBar) ? 'yes' : 'no';
  doSomething(foo, bar);
} 
else {
  const turd = 'something' + someOtherVar;
  const blarg = (isBlarg) ? 'yes' : 'no';
  doSomethingElse(turd, blarg);
}

Last edited by suzzer99; 08-18-2016 at 02:23 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-18-2016 , 04:14 PM
I think I lean more towards your last example, but the OTB example looks a lot less bad in an editor
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-18-2016 , 05:46 PM
What? I like the first example and hate your last one. This is the problem with these standards imo, it's not like there's an objectively best/correct one.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-18-2016 , 06:02 PM
Do you also like ketchup on hot dogs? Maybe we can find a correlation.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-18-2016 , 06:18 PM
I've seen so much weird stuff. People who like a space between the function name and args, like

Code:
void myfun (int arg1, char arg2)
People who like the args on the next line

Code:
void myfun 
(int arg1, char arg2)
or even spread out like

Code:
void myfun 
(
    int arg1, 
    char arg2
)
I'm working on a python codebase where the developer never put spaces after commas, just
Code:
mylist = [1,2,3,4,5]
Every one of these people thinks they're doing it right
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-18-2016 , 06:34 PM
I like the OTB style in most cases. But there are some occasions where for whatever reason I just intuitively feel like it looks wrong (i think it might be stuff like when an else if expression is long and the line above it also uses parens). So for the sake of being consistent I put them on the next line.

and ketchup belongs on hotdogs you anustart
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-18-2016 , 09:23 PM
Any of those else styles is fine imo. What is not fine is this:

Code:
}
else
{
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-18-2016 , 09:26 PM
Rusty, I've occasionally done the one argument per line thing when the function has eleventeen million arguments and the arguments list would otherwise be unreadable. Usually my solution to that would be a parameters object, the problem arises when I need to override an existing function.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-18-2016 , 09:35 PM
Quote:
Originally Posted by ChrisV
Rusty, I've occasionally done the one argument per line thing when the function has eleventeen million arguments and the arguments list would otherwise be unreadable. Usually my solution to that would be a parameters object, the problem arises when I need to override an existing function.
I have a bunch of barely consistent rules I use. When there are a lot of parameters, I am willing to devote a lot of vertical space to it, sure. But when there's 2 arguments and you just made the function definition 5 lines tall? No. **** you. Also, if most of those arguments aren't optional, your function probably sucks.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m