FizzBuzz: One Simple Interview Question

preview_player
Показать описание
There are a lot of opinions on how to hire coders, and most of them are terrible. The opinions, that is, not the coders. But a basic filter test to make sure someone can do what they say they can: that seems reasonable, and FizzBuzz is one of the more common tests. Even now, interviewers use it. Let's talk about why it's tricky, and how to solve it.

And thanks to my proofreading team!

(you can find contact details and social links there too)

Рекомендации по теме
Комментарии
Автор

"Repeating yourself like this is a sign of dodgy code."

This is a personal and unwarranted attack on my way of life sir.

jamesthompson
Автор

6:32 "But I'll leave fixing that is a problem for someone else."
This guy codes.

Enke
Автор

"I'll leave fixing that as a problem for someone else"

Yep Tom is definitely a programmer.

Jams
Автор

"whoever comes along to maintain your code once you're done with it"
AKA: future you in 6 months

-h
Автор

"I'll leave fixing that as a problem for someone else"
This proof is left as an exercise for the reader

Am-Not-Jarvis
Автор

I'm a bit late but I'll post my Python solution:

import fizzbuzz

michaelgray
Автор

I remember trying to make a tic-tac-toe game in the 'Introduction to Programming' class in high school.
It ended up as something like 88 pages of if/else statements.
I was just happy it worked...

dragmireD
Автор

The use of “i” as the index for loops is historical. In the 1960s and 1970s Fortran was the dominate programming language. It is the precursor of most languages today. Fortran used variables that started with i, j, k, l, m and n as default integer variables. Programmers got into the habit of using these single letter variables as simple integer variables in loops so they did not have to go back and add them to their integer declarations. Over time this became so widely used that everyone started assuming that if they saw these single character variables then they were index variables in loops. That coding habit moved with the programmer as they moved to new languages.

markreynolds
Автор

“Have a go at making fizzbuzz yourself”
Me <5 min later: That was easier than expected
Me after being shown a better way to do it:

Zacc
Автор

Interviewer: “write this code for us”

Me, a professional software developer: *googles the code because someone out there has already done it in a better way than you ever will*

MrTrees
Автор

Bodging like that in techie environs is called spaghetti code. It can sometimes be useful to prevent your company deciding you're redundant if you're the only one who can easily figure out what you've done.

Dumdumshum
Автор

Code is read way more often than it’s written. And it’s often read by people other than the original writer of said code. Which is one reason why writing clean code is so important.

dotanoob
Автор

I do
Print: (“1, 2, fizz, 4, buzz, fizz, 7, 8, fizz...buzz)

willjones
Автор

So I know it's been 3 years and you'll probably never see this, but I just wanted you to know that this video inspired me to start coding again. I'm a very, very beginner programmer. I learned a tiny bit of JavaScript from Khan Academy a few years ago. I saw this video and went "HEY, WAIT! I could do that!" and then I paused the video and I went to Khan academy's program editor. Albeit using the println command because I can't use console.log there, I wrote your second actually successful program (the one with the else statements), exactly, line for line. And of course, as you said, it was still dodgy, but coming back to the video and seeing it listed as the slightly better solution than the worst one was invigorating. I wrote this! I made it work! and I didn't do it in the worst way either! Then, immediately, you gave me steps and strategies to improve, so now I'm inspired to continue. Thank you for making this video!

MsAnonymousFangirl
Автор

I watched this video a day before my interview... This question came up... I got the job. Felt like I cheated 😂

ashleygchannel
Автор

It's funny how programmers have different priorities in terms of what they see is important. You saw it more important to avoid repeating the magic number 5, however my immediate thought was to avoid adding string concatenation, as in most languages you've increased your memory overhead.

ciknay
Автор

I made this in the only language I know, Scratch.

Conycon
Автор

The second in the three "Basics" videos: this one's about code, not opinions, so let's see what people think! I think I've managed to remove all the typos from my code. And if you're wondering about the blinkenlights behind me, that's the Centre for Computing History's Megaprocessor: pull down the description for a link to more details!

TomScottGo
Автор

Thank you for captioning your videos!
-a Deaf subscriber

carbnxl
Автор

From what I've heard anecdotally, the "otherwise, print the number" is the part that new programmers often leave out. The problem isn't presented in as nearly much detail as it is in the video, and the developers get so caught up in the Fizz/Buzz/FizzBuzz thing that they forget the last part. It's not only a programming question, it's an "attention to detail" question.

danielsummers