Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
RandomBlue
Dec 30, 2012

hay guys!


Biscuit Hider

redleader posted:

This, but unironically.

Even in the heyday of "Turn off Javascript for security you guys!" it was loving stupid. That was more than a decade ago. Give up and move on.

Adbot
ADBOT LOVES YOU

senrath
Nov 4, 2009

Look Professor, a destruct switch!


Hydronium posted:

Found at work today: no code needed, the function name says it all. TrimAndAddSpaceAtEnd

Wait, does that Trim and/or Add Space At the End, or does it Trim...something and then Add Space At the End?

Foxfire_
Nov 8, 2010

Hydronium posted:

Found at work today: no code needed, the function name says it all. TrimAndAddSpaceAtEnd

Does it remove all the whitespace from the end of a string, and then add a single space at the end? Cause that's what it sounds like and that's a pretty good name if that's what it does.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Vanadium posted:

Maybe people could just stop using cookies on sites that don't need them instead of annoying people with popups!!

oh man that would be sweet

law shouldve been like:
- one cookie per site per visitor.
- no third parties ever
- if you sell any data, your company will be shut down, all your media destroyed, and the rest of your actives will be sold off to cover the expenses.

at least

Absurd Alhazred
Mar 27, 2010

by Athanatos
https://twitter.com/jakevdp/status/847859811823767552

Carbon dioxide
Oct 9, 2012

So, my friend can be contracted to do job interviews for startups or whatever.

He told me the other day he was interviewing someone for a Java job.

It went like this:

"Can you explain to me what a Set is?"
"Uh... I never encountered one, but it's a type of List, isn't it?"
"Okay... so what is a Map?"
"Ah, I know that one! That's a List optimized for finding values by keys!"

"Alright, let's do a coding example. What does the following code print?"

Java code:
try {
	System.out.println("Hello World");
	System.exit(0);
} finally {
	System.out.println("The end");
} 
If you are very familiar with Java, you know that System.exit() overrides the finally block and only "Hello World" gets printed. You'd be forgiven for thinking "The end" is also printed. This guy somehow thought nothing at all was printed. :psyduck:

Needless to say, he wasn't hired.

QuarkJets
Sep 8, 2008

Carbon dioxide posted:

So, my friend can be contracted to do job interviews for startups or whatever.

He told me the other day he was interviewing someone for a Java job.

It went like this:

"Can you explain to me what a Set is?"
"Uh... I never encountered one, but it's a type of List, isn't it?"
"Okay... so what is a Map?"
"Ah, I know that one! That's a List optimized for finding values by keys!"

"Alright, let's do a coding example. What does the following code print?"

Java code:
try {
	System.out.println("Hello World");
	System.exit(0);
} finally {
	System.out.println("The end");
} 
If you are very familiar with Java, you know that System.exit() overrides the finally block and only "Hello World" gets printed. You'd be forgiven for thinking "The end" is also printed. This guy somehow thought nothing at all was printed. :psyduck:

Needless to say, he wasn't hired.

It was a trick question; that code hasn't been compiled or run yet. The code isn't sentient, dummy!

QuarkJets
Sep 8, 2008

also is the coding interview bar really that low at most places?

The Laplace Demon
Jul 23, 2009

"Oh dear! Oh dear! Heisenberg is a douche!"
I'd lead with a question on the level of "Can you explain to me what a Set is?" to level my followup questions with a candidate. It's less the interview bar and more the variable quality of the average candidate.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Do you know what a set is? Heh, yeah it's a classic ""interview question"", come here 20 year old male comp sci student, sit by me on the sofa but also do you know what an array is? *hand on thigh* Imagine 10 bottles of booze in a rack, and they're real bottles, and you're gonna take a shot for every mistake until we figure this poo poo out

hehe

canis minor
May 4, 2011

QuarkJets posted:

also is the coding interview bar really that low at most places?

In my place, for PHP dev - 1) write a recursive function, 2) do a mysql select query that joins two tables 3) write a class, having method that adds two numbers and stores them within private attribute.

I think there were 5 people so far that weren't able to do this - with a couple of years of experience btw. But I have a sneaky suspicion that salary might not be that great, so I'd rather attribute that, idk

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Powaqoatse posted:

Do you know what a set is? Heh, yeah it's a classic ""interview question"", come here 20 year old male comp sci student, sit by me on the sofa but also do you know what an array is? *hand on thigh* Imagine 10 bottles of booze in a rack, and they're real bottles, and you're gonna take a shot for every mistake until we figure this poo poo out

hehe

Dude, last week I had to explain y=mx+b in a meeting.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Bruegels Fuckbooks posted:

Dude, last week I had to explain y=mx+b in a meeting.

but did you grab their thighs

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



i wanna sexually harrass every dude in the silicon valley c-suites

B-Nasty
May 25, 2005

QuarkJets posted:

also is the coding interview bar really that low at most places?

Remember, as an interviewee, you're probably coming in nervous as hell, and being asked to code either in your head, on a whiteboard, or (best case) on a computer/setup that you aren't familiar with. My goal in designing interview questions was to find something that somebody should be able to start and finish, cold, in less than an hour. If the problem takes me, fully comfortable and caffeinated, a ton of time to think through, it's probably unfair to ask in an interview situation. If your company (not you specifically, QuarkJets) writes CRUD web apps and pays engineers average salaries, gently caress you for throwing algorithm questions at candidates that probably 90% of your own engineers couldn't pass.

As Carbon dioxide's example showed, you'd be surprised how many "Sr. Software Engineers" can't code something at the level of Fizz Buzz when put in front of a keyboard.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



cuz i got code reviewers in low places
where the sprints they grounds us & the jira blows my blues away

chutwig
May 28, 2001

BURLAP SATCHEL OF CRACKERJACKS

QuarkJets posted:

also is the coding interview bar really that low at most places?

When one of my co-workers suggested we start our screen-share coding sessions off with Fizzbuzz, I scoffed. Who's going to gently caress that up?, I wondered to myself.

Three weeks later, about 75% of our candidates have failed to write it in a language of their choosing, and most of them could not even explain the algorithm in pseudocode. I'm not asking you solve Project Euler matrix problems, just show me you can do a loop and a few if statements.

Fergus Mac Roich
Nov 5, 2008

Soiled Meat

chutwig posted:

When one of my co-workers suggested we start our screen-share coding sessions off with Fizzbuzz, I scoffed. Who's going to gently caress that up?, I wondered to myself.

Three weeks later, about 75% of our candidates have failed to write it in a language of their choosing, and most of them could not even explain the algorithm in pseudocode. I'm not asking you solve Project Euler matrix problems, just show me you can do a loop and a few if statements.

When you say failed, what are we talking here? Their implementation prints the number as well as the appropriate string for multiples of 3 and 5, or they can't figure out for loop syntax, or what?

chutwig
May 28, 2001

BURLAP SATCHEL OF CRACKERJACKS

Fergus Mac Roich posted:

When you say failed, what are we talking here? Their implementation prints the number as well as the appropriate string for multiples of 3 and 5, or they can't figure out for loop syntax, or what?

The failures usually fell into one of these categories (the default language is Python but they are explicitly told they can write it any language supported by the codepair system, so they can choose e.g. Ruby, Java, C++):
  • could not do it at all, even in pseudocode
  • did not write a for loop
  • wrote a for loop in Python but insisted on using C syntax, which won't work (I always reminded them at this point that they can use another language if they want)
  • wrote for loops inside every if statement (???)
  • did not know about % and wrote things like something = i / 3; if something * 3 == i: print "fizz" (technically correct but shows lack of fluency)

Many people could eventually stagger their way to the end, but it would frequently take 20-30 minutes instead of the <5 it should take.

Dex
May 26, 2006

Quintuple x!!!

Would not escrow again.

VERY MISLEADING!

chutwig posted:

When one of my co-workers suggested we start our screen-share coding sessions off with Fizzbuzz, I scoffed. Who's going to gently caress that up?, I wondered to myself.

Three weeks later, about 75% of our candidates have failed to write it in a language of their choosing, and most of them could not even explain the algorithm in pseudocode. I'm not asking you solve Project Euler matrix problems, just show me you can do a loop and a few if statements.

what if i can't? do you want your solution or a solution?

code:
numbers = list(range(101))
numbers[3::3] = ['Fizz'] * len(numbers[3::3])
numbers[5::5] = ['Buzz'] * len(numbers[5::5])
numbers[15::15] = ['FizzBuzz'] * len(numbers[15::15])
print(numbers[1:])
ask me stuff that shows you how i think and act, if you want coding exercises then send them in advance and leave me google poo poo because i'm going to do that at work anyway

smackfu
Jun 7, 2004

I work with some professional programmers who I doubt could explain why you would use a Set instead of a List. Somehow they get by.

ExcessBLarg!
Sep 1, 2001

Carbon dioxide posted:

If you are very familiar with Java, you know that System.exit() overrides the finally block and only "Hello World" gets printed.
Maybe. It's pretty clearly a trick question as, if this code ever existed in practice it's at best inconsequential, and quite possibly a bug that the finally block isn't called; particularly if it's intended to clean up an external resource. The fact that finally doesn't execute is the most straight-forward way for the JVM to implement System.exit, but it wouldn't be impossible for a Java-like language to have finally blocks with closure semantics and unwind them as part of the exit sequence.

Similar trick questions are anything involving the deprecated Thread.stop and friends methods, or the double-checked locking anti-pattern. I mean, they can still serve as good discussion points, particularly if you're trying to hire someone with deep systems experience. But I prefer to avoid asking trick questions as there's plenty of other straight-forward questions that do a good job of assessing someone's Java abilities.

QuarkJets posted:

also is the coding interview bar really that low at most places?
No, but you're not going to waste time asking complicated questions when someone doesn't know what a Set is. Good phone screen filter.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Dex posted:

what if i can't? do you want your solution or a solution?

ask me stuff that shows you how i think and act, if you want coding exercises then send them in advance and leave me google poo poo because i'm going to do that at work anyway

FizzBuzz is the kind of thing that any programmer worth their salt will be able to write up a pseudocode solution to with no real effort, and certainly no need to resort to Google. So yes, when you ask FizzBuzz you are looking for a solution, because the only point to that question is to determine if the actual hard part of the interview can begin.

chutwig
May 28, 2001

BURLAP SATCHEL OF CRACKERJACKS

Dex posted:

what if i can't? do you want your solution or a solution?

code:
numbers = list(range(101))
numbers[3::3] = ['Fizz'] * len(numbers[3::3])
numbers[5::5] = ['Buzz'] * len(numbers[5::5])
numbers[15::15] = ['FizzBuzz'] * len(numbers[15::15])
print(numbers[1:])
ask me stuff that shows you how i think and act, if you want coding exercises then send them in advance and leave me google poo poo because i'm going to do that at work anyway

Slow down there, Captain Confrontation. If they write something that passes the unit tests, that's good enough and we move on to other problems. If somebody provided that as a solution, I would view it as being pretty novel.

That being said, nobody has supplied a novel solution, and if they don't have a pre-canned solution ready basically immediately, it is likely that they will fail all subsequent problems even if they eventually brute force a solution to Fizzbuzz.

Dex
May 26, 2006

Quintuple x!!!

Would not escrow again.

VERY MISLEADING!
i'm not trying to be confrontational, i just threw out something that fits on your list of failures but solves the problem :v:

i'm sitting on my couch with a beer, though. ask me to do that in an interview i'm nervous about and god knows what'll happen. show me a project with a few failing tests and ask me how i'd go about investigating would be a lot more comfortable, and would give you a better insight into how i work than a popular puzzle somebody can learn by rote or get blindsided by if they're totally junior and panicking.

Hughlander
May 11, 2005

Powaqoatse posted:

Yeah, most of the time it seems like the intent of it comes from a good place. For instance, warn people that their personal info is being gathered, but the implementation is just so often completely destroyed by a combination of industry lobbyists and technically illiterate legislators.

Obviously every person has a slightly different idea of "too much", but imo "Right to be Forgotten" is totally fine. The intent of the law was pretty clear that it's like if you search for an otherwise private person, not a politician or anything, and there's a news article from the early 2000s about him putting his dick in an exhaust pipe or something, he has a right to get that specific result, for that specific query annulled. It doesn't count if it was a criminal or civil offense, you can't block those.

Google intentionally interprets the law in the broadest and annoyingest way possible; it often feels like pretty much any combination of given name + surname will result in a bunch of worthless results (no newspapers) + the disclaimer "some results may have been removen due to blah blah blah", which was specificially not what the whole thing was about.

P sure they're doing this on purpose to undermine the law. Obv I cant speak to the wording, but they're very much subverting the intent to bridge the idea of "right to be forgotten" = "annoying law" in people's minds.

e: whoa sorry for ranting :stare:

Considering the penalty is up to 4% of your yearly revenue maybe it's in their best interest to interpret it as broadly as possible regardless of the feeling of the end user.

CPColin
Sep 9, 2003

Big ol' smile.

ExcessBLarg! posted:

the double-checked locking anti-pattern.

It's been a normal pattern since like Java 6, as long as you use volatile. An unfortunate consequence of the "write once, show up in Google forever" nature of blog posts.

chutwig
May 28, 2001

BURLAP SATCHEL OF CRACKERJACKS

Dex posted:

i'm not trying to be confrontational, i just threw out something that fits on your list of failures but solves the problem :v:

I was listing out things that people had done wrong. The function prototype is fizzbuzz(n), where n is the end of the range. A few people wrote if/elif/else stuff but didn't have any sort of loop construct or other way of processing a range of numbers, and then they'd stumble around for several minutes not seeing that that was why the unit tests kept failing.

I was not trying to suggest that I'm just looking for a for loop and some ifs and will fail people if they don't have those things - I'm not trying to be prescriptive about their solutions. I do note if they're doing something unidiomatic for the language they're working in, but everyone has to learn somewhere, and the positions I'm interviewing for are not pure dev positions (more like SRE-type stuff), so there's more leeway than if I were interviewing somebody for a senior dev position. That being said, if you can't solve Fizzbuzz, I might be a little scared of the kind of Ansible playbooks you'd write.

ExcessBLarg!
Sep 1, 2001

CPColin posted:

It's been a normal pattern since like Java 6, as long as you use volatile. An unfortunate consequence of the "write once, show up in Google forever" nature of blog posts.
Sure, they fixed volatile semantics in the JVM so that one variant of the double-checked locking implementation actually works, but it's still not a great answer for most applications.

It's a performance optimization for the perceived slowness of the synchronized block, but I doubt that it actually has a measurable performance impact in most applications where it's implemented, at least not sufficiently so to warrant the code complexity, potential for mistake, or future/alternative JVM bugs. I'm fine with its use internally to implement higher-level abstractions like singletons, but I'm generally suspicious of it in applications code.

Colonel J
Jan 3, 2008
int main()
{
printf("1 \n 2 \n Fizz \n 4 \n Buzz \n Fizz 7 \n 8 \n Fizz \n Buzz \n " // and so on.
}

When do I start?

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Colonel J posted:

int main()
{
printf("1 \n 2 \n Fizz \n 4 \n Buzz \n Fizz 7 \n 8 \n Fizz \n Buzz \n " // and so on.
}

When do I start?

As soon as you finish writing out main(). :v:

ExcessBLarg!
Sep 1, 2001
My favorite part of FizzBuzz is when people write a broken implementation then go off and write a lengthy blog post defending their mistakes and look for deeper meaning of it.

Guys, it's FizzBuzz, it doesn't have to be fancy it just has to do the job correctly.

Fergus Mac Roich
Nov 5, 2008

Soiled Meat

ExcessBLarg! posted:

Guys, it's software, it doesn't have to be fancy it just has to do the job correctly.

Kazinsal
Dec 13, 2011


The real question is, has anyone written FizzBuzz in Malbolge?

vOv
Feb 8, 2014

I think you could use Fizzbuzz as a 'how well does this person know how to maintain code' test if you keep adding more requirements like 'bazz if it's divisible by 7, fizzbazz if it's divisible by 21, blarg if it's divisible by 35' and see how long it takes for them to stop using an if-else and come up with some kind of 'rule engine'.

ExcessBLarg!
Sep 1, 2001

vOv posted:

I think you could use Fizzbuzz as a 'how well does this person know how to maintain code' test if you keep adding more requirements
Yeah, that works to some extent. Part of being an experienced programmer though is having enough intuition around the problem to anticipate where the requirements are likely to change (and thus, write that portion with sufficient flexibility that it doesn't require a major refactor every time a requirement comes in), but also to avoid over complicating the design.

I don't know how well that really scales down to FizzBuzz though. It's a toy problem with a trivial solution. Even if you have to completely start over on a slightly-different toy problem, there's no real consequence to it.

Xerophyte
Mar 17, 2008

This space intentionally left blank

Kazinsal posted:

The real question is, has anyone written FizzBuzz in Malbolge?

Apparently so. Not mine, I'm not crazy enough for Malbolge. Also not sure if it's actually iterative; it's hard to tell with Malbolge.

E: Unbreaking tables...

Xerophyte fucked around with this message at 02:53 on Apr 2, 2017

Dr. Stab
Sep 12, 2010
👨🏻‍⚕️🩺🔪🙀😱🙀

ExcessBLarg! posted:

My favorite part of FizzBuzz is when people write a broken implementation then go off and write a lengthy blog post defending their mistakes and look for deeper meaning of it.

Guys, it's FizzBuzz, it doesn't have to be fancy it just has to do the job correctly.

Dang this is a bad blog post. Nobody cares about your scalable fizzbuzz solution. Like, you're right that software should be written in a certain way, but if the requirements change on a three line function, it's less work for me to delete those lines and write new ones than to figure out how to modify the old code.

Besides, this solution scales and performs terribly. Here's my much better solution that loads divisor/word pairs from a database and checks their divisibility via a compute shader.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Dr. Stab posted:

Dang this is a bad blog post. Nobody cares about your scalable fizzbuzz solution. Like, you're right that software should be written in a certain way, but if the requirements change on a three line function, it's less work for me to delete those lines and write new ones than to figure out how to modify the old code.

Besides, this solution scales and performs terribly. Here's my much better solution that loads divisor/word pairs from a database and checks their divisibility via a compute shader.

I think this stuff stems from a fairly reasonable misundertanding of what FizzBuzz is about.

Jeff Atwood popularized it ten years ago as "Write this trivial function, I want to see that you can code at all."

But if the interviewers aren't crystal clear about that, it's not unreasonable to suspect that they're actually asking "Write this trivial function, I want to see your coding style" and are looking to see if and how you approach commenting, maintainability, testability, etc.

Heck, I would bet there's more than a few companies out there who didn't get the meme and who do (mis)use FizzBuzz for that purpose.

Adbot
ADBOT LOVES YOU

Doom Mathematic
Sep 2, 2008

ExcessBLarg! posted:

Yeah, that works to some extent. Part of being an experienced programmer though is having enough intuition around the problem to anticipate where the requirements are likely to change (and thus, write that portion with sufficient flexibility that it doesn't require a major refactor every time a requirement comes in), but also to avoid over complicating the design.

I don't know how well that really scales down to FizzBuzz though. It's a toy problem with a trivial solution. Even if you have to completely start over on a slightly-different toy problem, there's no real consequence to it.

Plus, because it's a toy problem, it's difficult to anticipate the possible toy additional requirements which might be introduced later on.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply