|
I did it in 30 minutes in C#, but it's not code I'm proud of.
|
# ? Jul 9, 2012 18:57 |
|
|
# ? May 19, 2024 16:15 |
|
tef posted:
The problem I have with this code is that its not commented, not tested, not refactored to be readable, etc. What the hell is 'c' supposed to be? what is 'r'? Yeah it runs and gives output, but no one is able to follow that code and adapt it except for you. When I did this problem, I did a very top-down approach. It looked a little like this: Python code:
how!! fucked around with this message at 19:20 on Jul 9, 2012 |
# ? Jul 9, 2012 19:18 |
|
how!! posted:The problem I have with this code is that its not commented, not tested, not refactored to be readable, etc. What the hell is 'c' supposed to be? what is 'r'? Yeah it runs and gives output, but no one is able to follow that code and adapt it except for you. this is adorable why yes, this programming competency test is going into production. quote:When I did this problem, I did a very top-down approach. It looked a little like this: I was waiting for the design patterns quote:For instance, what if the format of the input changed? Instead through stdin, it comes in through an xml file? You'd have to completely re-write your program. If the format of the interview changed, I wouldn't need to change my code. I would have got past the 'fizz buzz' stage of the interview.
|
# ? Jul 9, 2012 19:26 |
|
tef posted:this is adorable But you have to treat the interview challenge as a real problem, correct? You're showing them how you approach problems. You don't write ugly code in production, so why write ugly code in the interview?
|
# ? Jul 9, 2012 19:29 |
|
how!! posted:The problem I have with this code is that its not commented, not tested, not refactored to be readable, etc. What the hell is 'c' supposed to be? what is 'r'? Yeah it runs and gives output, but no one is able to follow that code and adapt it except for you. how!! posted:For instance, what if the format of the input changed? Instead through stdin, it comes in through an xml file? You'd have to completely re-write your program.
|
# ? Jul 9, 2012 19:32 |
|
how!! posted:But you have to treat the interview challenge as a real problem, correct? You're showing them how you approach problems. You don't write ugly code in production, so why write ugly code in the interview? Because you have an hour, and it's better to have something functional than something aesthetically beautiful that doesn't work.
|
# ? Jul 9, 2012 19:32 |
|
how!! posted:But you have to treat the interview challenge as a real problem, correct? You're showing them how you approach problems. You're showing them you know how to write a ~20 line program. If I caught someone insisting on unit-testing fizzbuzz i'd be inclined to no-hire them on the fear they're too dogmatic. You have expected input and output - you're given a test case to run. "python puzzle.py < puzzle.txt | diff - output.txt" will do. quote:You don't write ugly code in production, so why write ugly code in the interview? Have you ever written code in production? tef fucked around with this message at 19:36 on Jul 9, 2012 |
# ? Jul 9, 2012 19:33 |
|
bartkusa posted:Because you have an hour, and it's better to have something functional than something aesthetically beautiful that doesn't work. This. The first thing I would ask after a simple programming challenge was "What don't you like about this code?" and have a discussion regarding how the code could be refactored to be better.
|
# ? Jul 9, 2012 19:40 |
|
I would note the game of life problem is a great opportunity to show dynamic programming skills.
|
# ? Jul 9, 2012 19:40 |
|
tef posted:You're showing them you know how to write a ~20 line program. If I caught someone insisting on unit-testing fizzbuzz i'd be inclined to no-hire them on the fear they're too dogmatic. I don't follow. You're telling me software design patterns are worthless? One should never worry about writing easy to read code because its pointless? In my experience, its the exact opposite.
|
# ? Jul 9, 2012 19:41 |
|
how!! posted:I don't follow. You're telling me software design patterns are worthless? One should never worry about writing easy to read code because its pointless? In my experience, its the exact opposite. At the end of day, programming problems are about getting poo poo to work - that's a minimum requirement. If you're not starting with someone who can get stuff to work, you may end up with the well-designed, well documented system that doesn't actually work. TDD and good design take time and don't really make sense in a time-boxed environment, and would be more appropriate to test for in a 'homework' style interview assignment.
|
# ? Jul 9, 2012 19:48 |
|
Really, the biggest hurdle you have to working at facebook is that you took a facebook interview question and posted it online
|
# ? Jul 9, 2012 19:48 |
|
how!! posted:I don't follow. Given you believe an interview question should take a week, and write code to be extensible, I'm guessing you're a fresh or soon to be fresh graduate. In the real world we have only one constraint that matters: time. Programming involves making many tradeoffs. If you demand perfection outright you will never see completion. quote:
In a means to write code, they can be useful terminology or boilerplate. For understanding or decomposing your problem, not so much. Programming is not 'coding by numbers', you should not write code as if making a collage of design patterns. quote:One should never worry about writing easy to read code because its pointless? Perfect is the enemy of the good. Engineering means dealing with the reality of the problem, rather than a petulant utopian view of code. quote:In my experience, its the exact opposite. It didn't seem to serve you well recently in an interview situation.
|
# ? Jul 9, 2012 19:49 |
|
STORY TIME. I want to write a book. So I start by writing my index. Books have to have an index. I've got to design the cover too. It needs a good title. I should probably make sure I have all of these in any book I write. I probably need an Introduction too. I have to choose a typeface. I'll get around to the words later. UGH WHAT DO YOU MEAN I SHOULD WRITE THE STORY FIRST DAD I DON'T HAVE TO DO THAT
|
# ? Jul 9, 2012 19:54 |
|
how!! posted:I don't follow. You're telling me software design patterns are worthless? One should never worry about writing easy to read code because its pointless? In my experience, its the exact opposite. That's not what everyone is saying. What everyone is saying is how quickly and well can do you do this one specific challenge for the interviews sake. Save unit testing and adequate variable names and documentation to your actual job when you get it. But as everyone else said, if you can't get it working then your unit testing and documentation isn't worth poo poo. Think of it like a homework assignment you put off until the day of class- get it working, then make it pretty. Interview challenges are a proof of concept, nothing more. Alternatively, for example, I just wrote some really lovely method for this application then went through it two extra times making it a lot cleaner and safer because it was easier to scrape it together and then improve it rather than trying to do it perfectly the first time sinceI've never done something quite like this before. Sab669 fucked around with this message at 20:34 on Jul 9, 2012 |
# ? Jul 9, 2012 20:00 |
baquerd posted:I would note the game of life problem is a great opportunity to show dynamic programming skills. go on...
|
|
# ? Jul 9, 2012 20:07 |
|
Really, it boils down to what the interviewer hopes you are able to convey. If I were asking this question to a candidate, I'd want to know things like: "Can the person actually wrap their head around a problem description? Can they formalize the algorithm I told them to implement?" "Given sample input and output, can they follow problem specifications?" "Are they competent enough in $LANGUAGE that they can get the solution working and talk about design choices?" I'd argue that these questions in fact have very little to do with software engineering methodology. Less so because it's all wankery but more because those sorts of skills get tested in different parts of the interview. It was typically the "PM/boss soft skill" portion of the onsite where I got asked that sort of thing.
|
# ? Jul 9, 2012 20:16 |
|
hieronymus posted:At the end of day, programming problems are about getting poo poo to work - that's a minimum requirement. If you're not starting with someone who can get stuff to work, you may end up with the well-designed, well documented system that doesn't actually work. TDD and good design take time and don't really make sense in a time-boxed environment, and would be more appropriate to test for in a 'homework' style interview assignment. Time boxing is relative. Whats better, writing code in one hour that takes one hour (or more) for anyone else to understand, or spending 8 hours writing code that takes anyone else 2 minutes to understand? tef even says of his own code "I don't know if this is correct". Neither do I. Neither does anyone else that will be reading that code. Does the fact that he wrote it quickly matter?
|
# ? Jul 9, 2012 20:16 |
|
how!! posted:Time boxing is relative. Whats better, writing code in one hour that takes one hour (or more) for anyone else to understand, or spending 8 hours writing code that takes anyone else 2 minutes to understand?
|
# ? Jul 9, 2012 20:19 |
|
how!! posted:Time boxing is relative. Whats better, writing code in one hour that takes one hour (or more) for anyone else to understand, or spending 8 hours writing code that takes anyone else 2 minutes to understand? If there is a constraint that says "if you do not produce functional code in under one hour you do not proceed in the interview process", the first is definitively better.
|
# ? Jul 9, 2012 20:19 |
|
A MIRACLE posted:go on... You reduce the number of data retrievals needed by using calculations from the previous "square". A simple example is going row by row and carrying over column values: For each row, start on the left (one off from the edges) and calculate the total number of blacks in the left three, center three, and right three squares in the nine square block you need to examine. When you move on to the next square, set the left total to the mid, the mid to the right, and recalculate the right three squares for the new position. Result: Immediate removal of roughly 2/3 of the data retrievals and comparisons.
|
# ? Jul 9, 2012 20:25 |
|
how!! posted:Time boxing is relative. Whats better, writing code in one hour that takes one hour (or more) for anyone else to understand, or spending 8 hours writing code that takes anyone else 2 minutes to understand? Look I get that you're hellbent on doubling down on your beliefs but at some point you need to realize that if you are willing to spend "multiple 8 hour days" on a two-rule game of life you aren't going to get hired because people are going to think you are a slow, terrible programmer. This is how the world works. And yeah, the world is full of lovely, crappy code. But I dare say most people, if forced to pick, would pick a programmer that spends one day writing ugly code that solves seven or eight requirements over a programmer that spends a day writing beautiful code that solves one. I would, because I know projects can fail because the code is unmaintainable, but more often they fail because they never made it to maintenance... they went over time & budget and management puts a bullet in their head. So do your projects a favor - code.
|
# ? Jul 9, 2012 20:34 |
|
baquerd posted:You reduce the number of data retrievals needed by using calculations from the previous "square". A simple example is going row by row and carrying over column values: For an interview question, I would be ecstatic if someone came back with a DP solution that worked in an hour, and would be able to explain how it worked and all that. Me as the interviewee would not even try and would just bring up that a DP solution is possible.
|
# ? Jul 9, 2012 20:53 |
|
Kim Jong III posted:Look I get that you're hellbent on doubling down on your beliefs but at some point you need to realize that if you are willing to spend "multiple 8 hour days" on a two-rule game of life you aren't going to get hired because people are going to think you are a slow, terrible programmer. This is how the world works. Let me change the topic a little. Reddit posted this a few weeks ago: http://redditgifts.com/blog/view/be-redditgifts-first-engineer/ The solution I came up with is here: https://github.com/priestc/gift_match/blob/master/match.py That code took me three days to create. It represents exactly how I write code for production. Everything I write for my personal projects and for stuff at work, I strive for it to look like that. I never ever ever ever check in code that looks like tef's code. For that reason, I always feel like it's unfair when I'm given a programming challenge where I'm forced to turn in code that I'm not able to polish up the way I like. For the same reason, I hate it when my co-workers check in code thats not polished up either. Reddit did it right because they let me take as much time as I wanted. I feel proud of the code I wrote and feel confident in emailing it to them. Do you think I'm a terrible programmer because it took me three days to write that? I guess I could have gotten it done in one hour, but it would have been awful code and I would have been ashamed of myself for sending them a solution that was not as good as I am capable of creating. By the way, does anyone have a job where they're tasked with solving problems with only one hour to do it in? Since I started programming about 5 years ago, I've never had such a short amount of time to get something done. Most deadlines I deal with are on the scale of days, not minutes. Does it make me a bad programmer if I get anxious when told I need to write something complex and I only have an extremely short amount of time to complete it?
|
# ? Jul 9, 2012 21:06 |
|
None of that makes you a bad programmer, no, but fact of the matter is your co-workers aren't always going to strive for the excellent standards you say you hold yourself to. Did they have you write this on-site and then come back to you in an hour? If so, I think you can understand that they're trying to run a business and have a schedule and can't just keep checking up on you to see when you're done, or have you hunt them down when you're finished. In regards to reddit having you take however long you wanted, maybe Facebook doesn't want people doing "take home" tests where they can have other people providing too much assistance and then they get some lovely incompetent developer. You might ask yourself, "Well who would get themselves into a job they can't handle?" and as it would turn out the answer is a lot of people would. And of course no one has a job with same-day deadlines for projects, and I'd say it's probably normal to be anxious when given a short deadline- that's part of the point. How do you deal with pressure? It's a challenge, definitively it's SUPPOSED to be difficult. I guess in short what everyone is trying to say is no, writing nice code doesn't make you bad. This is just how a lot of interviews work and if you don't like it, A)That sucks B)Eventually you'll find a job where you'll be happy and not have those restrictions put upon you during the interview process
|
# ? Jul 9, 2012 21:22 |
|
Just graduated two months ago in May with a B.S. in CS (No previous internships/research experience. A handful of small projects, and a 2.98 GPA), but after two months of hobbling around and applying to a handful of places, the only position I managed to snag was as a "Software Intern" at a large telecom company at $15/hr working 35/40h a week on a 6-month contract doing test automation and stuff. Everyone else that graduated with me is either making double my expected annual income, or is still bopping around doing summer stuff. It's day five for me, here, and I'm not really digging this huge cubicle farm and the whole "worth-half-as-much-as-my-classmates thing" :ashobon: What's the best plan in terms of trying to get a position as an actual software engineer job out there? Could I try to put the fact that I'm currently in an internship on my resume and hope it scores me some points? Or stick it out for a couple quarters or the whole six months? I mean, i'm in the SF Bay Area, it shouldn't be that difficult, right?
|
# ? Jul 9, 2012 21:30 |
|
As a student, I certainly can't give the best advice, but I understand the situation definitely sucks. Do you know for certain if you'll be offered a job upon completion of the internship? I personally wouldn't put the internship on your resume if you've been there less than a month, let alone a week. How come your friends / classmates found jobs and you didn't? If "Everyone else" is employed, it clearly can't be that hard. Keep looking for positions. Unless everyone else is a really small amount of people.
|
# ? Jul 9, 2012 21:48 |
|
Considering getting a 1 year work visa to the USA. I graduated with what I think is the equivalent of a 4.0 in the USA. Would companies over there be hesitant to take on a fresh grad for a year? New York in particular.
|
# ? Jul 9, 2012 21:48 |
|
Fal-Cone posted:Just graduated two months ago in May with a B.S. in CS (No previous internships/research experience. A handful of small projects, and a 2.98 GPA), but after two months of hobbling around and applying to a handful of places, the only position I managed to snag was as a "Software Intern" at a large telecom company at $15/hr working 35/40h a week on a 6-month contract doing test automation and stuff. Write something decent, put it on github, and link your github on your resume. You should at the minimum have something decent written for undergrad - put that poo poo there. Keep interviewing in the 5 hours that you aren't spending actually at work - if you keep doing what you're doing without interviewing, you're going to get pigeonholed in test automation work, which can be good money with low stress... but it's still QA.
|
# ? Jul 9, 2012 22:00 |
|
how!! posted:Let me change the topic a little. For the record: The topic was "I'm a petulant perfectionist programmer who struggles to write fizz buzz unless it is production ready" quote:I'm forced to turn in code that I'm not able to polish up the way I like. Programmers like you worry me because you will spend your time formatting and aligning code with pristine comments without a thought towards runtime, execution or actual maintenance cost. You've got objects and abstractions but you don't know if you can or will use any of these abstractions later. You've written a large amount of code that's reasonably tightly coupled together. (There isn't any dependency injection) quote:For the same reason, I hate it when my co-workers check in code thats not polished up either. Reddit did it right because they let me take as much time as I wanted. I feel proud of the code I wrote and feel confident in emailing it to them. I do love writing things without deadlines. quote:Do you think I'm a terrible programmer because it took me three days to write that? I guess I could have gotten it done in one hour, but it would have been awful code and I would have been ashamed of myself for sending them a solution that was not as good as I am capable of creating. I think you're a terrible programmer because you make short sighted choices in the name of perfection and presupposed modularity. You drown your code in abstractions on the basis that one day you might be able to share some code. quote:By the way, does anyone have a job where they're tasked with solving problems with only one hour to do it in? In operations, sometimes you have problems where you lose money waiting for a fix. quote:Since I started programming about 5 years ago, I've never had such a short amount of time to get something done. Yes we established your inexperience when you said "You don't write ugly code in production" quote:Most deadlines I deal with are on the scale of days, not minutes. Does it make me a bad programmer if I get anxious when told I need to write something complex and I only have an extremely short amount of time to complete it? No it makes you bad at time management, and by extension bad at programming.
|
# ? Jul 9, 2012 22:04 |
|
how!! posted:For that reason, I always feel like it's unfair when I'm given a programming challenge where I'm forced to turn in code that I'm not able to polish up the way I like. For the same reason, I hate it when my co-workers check in code thats not polished up either. Reddit did it right because they let me take as much time as I wanted. Unfortunately them's the breaks. Timed programming challenges aren't designed to get you to write gorgeous code. If you do write gorgeous and effective code in an hour, hey, you're not going to have trouble finding jobs. But most programmers will sweat a little bit, and they want to see you not crumble under pressure. And "I'm going to submit a giant function that says 'I'm going to approach the problem by'" is definitely crumbling. Maybe you can practice polishing faster? how!! posted:By the way, does anyone have a job where they're tasked with solving problems with only one hour to do it in? Since I started programming about 5 years ago, I've never had such a short amount of time to get something done. Most deadlines I deal with are on the scale of days, not minutes. Does it make me a bad programmer if I get anxious when told I need to write something complex and I only have an extremely short amount of time to complete it? GoL isn't complex, and that problem isn't even a full GoL. OK, here's an example. Like most programmers I'm lucky if I'm pulled away to do bug fixes every other day rather than every ten minutes. The expectation is that I'll git stash, debug a little, and come up with a fix in a matter of hours, not days. And if the bug is bad enough to make us lose money, you'd better believe the expectation is to fix it way faster than an hour. Now, here's something for you to consider: it took you three days to solve that reddit gifts problem that you said you could've done in an hour. That's two days and twenty three hours of the hiring people looking at resumes, reviewing github contributions, and setting up interviews. Two days and twenty three hours before they even know you exist. Speed is everything. Run or die. Fal-Cone posted:Everyone else that graduated with me is either making double my expected annual income, or is still bopping around doing summer stuff. It's day five for me, here, and I'm not really digging this huge cubicle farm and the whole "worth-half-as-much-as-my-classmates thing" How many of your classmates graduated with co-op/internship/research experience? You aren't competing with them for jobs, as they've already got you beat - you're competing with current students looking for a summer internship. Keep looking for a job, but definitely don't put the internship on your resume until you make it for at least three months or so. It doesn't look good to take a job & look for a new one five days later. If you can't find anything, finish the internship. You'll probably get a job offer and a nice raise. Take it, and keep sending out resumes. But when in doubt just keep looking for jobs.
|
# ? Jul 9, 2012 22:07 |
|
how!! posted:In the real world, no one (at least I assume), would ever be given a problem like this with a one hour time limit. When a live production server handling payments, or some SPOF on your service goes down, what do you think happens and what do you think management says and how long do you think you reasonably have to fix it?
|
# ? Jul 9, 2012 22:11 |
|
how!! posted:Let me change the topic a little. Reddit posted this a few weeks ago: http://redditgifts.com/blog/view/be-redditgifts-first-engineer/ I am a idiot savant at maintenance programming - throw me at a million lines of C code with no comments, no unit tests, and no real documentation, give me a defect report, give me a week and I can probably figure something out - two weeks if I don't have the source. It's a pretty disgusting skill but someone has to clean up once the 'real' programmers are moved onto cleaner pastures.
|
# ? Jul 9, 2012 22:18 |
|
Kim Jong III posted:If you can't find anything, finish the internship. You'll probably get a job offer and a nice raise. Take it, and keep sending out resumes. Yeah, that's pretty much the plan for the time being. I'm pretty sure I can negotiate some kind of delayed start date to have time to finish stuff up at my internship. A good portion of people that have jobs from my class now were roughly in the same boat as me, but I guess it's just a matter of persistence. Waking up to 1~3 "no, sorry" e-mails is awesome encouragement, you see.
|
# ? Jul 9, 2012 22:19 |
|
tef posted:For the record: The topic was "I'm a petulant perfectionist programmer who struggles to write fizz buzz unless it is production ready" How would you do the reddit problem? What exactly makes my solution garbage? Are you saying it's garbage because it took me too long to write it? Its garbage because it doesn't work? its garbage because its different than what you would have done? it's garbage because it's extendable? its garbage because its not extendable in the right ways? I honestly want to know because I actually care about the code I write and I always want my code to be completely as best as it could possibly be. If you think you could so so much better, then lets see your solution...
|
# ? Jul 9, 2012 22:24 |
|
Fal-Cone posted:Yeah, that's pretty much the plan for the time being. I'm pretty sure I can negotiate some kind of delayed start date to have time to finish stuff up at my internship. you'll get there It might be tough to hear, but with no experience you're relying solely on your education, and if you graduated with a 2.98 from a non-big-name university you don't have too much to hang your hat on. hieronymus is totally right - while you're grinding for a job write something cool and post it up to github. That's a really good way to show off your skills. Showing off patches I sent to Mozilla was how I landed my first part-time job while attending a non-big-name university and not getting super great grades. And be sure you round that 2.98 up to a 3.0
|
# ? Jul 9, 2012 22:30 |
|
how!! posted:That code took me three days to create. ... I guess I could have gotten it done in one hour, but it would have been awful code and I would have been ashamed of myself for sending them a solution that was not as good as I am capable of creating. You don't see this as a problem? You're spending 95% of your time doing... something that has nothing to do with functionality. It's fine wanting polished code, but that's just a ridiculous amount of time to spend on that.
|
# ? Jul 9, 2012 22:38 |
|
match.py posted:
You have a bug there.
|
# ? Jul 9, 2012 22:55 |
|
how!! posted:How would you do the reddit problem? What exactly makes my solution garbage? Are you saying it's garbage because it took me too long to write it? Its garbage because it doesn't work? its garbage because its different than what you would have done? it's garbage because it's extendable? its garbage because its not extendable in the right ways? I honestly want to know because I actually care about the code I write and I always want my code to be completely as best as it could possibly be. If you think you could so so much better, then lets see your solution... He didn't say your code was garbage or that he didn't care about the code he writes. You are completely ignoring everyone's advice and probably aren't going to get a job at a company like Facebook if you keep up that attitude. In the workforce, you're expected to work quickly. Don't get mad at people for telling you how the real world is. You need to turn your ego down a bit and listen to to the people trying to help you get a job. That or apply to grad school.
|
# ? Jul 9, 2012 23:04 |
|
|
# ? May 19, 2024 16:15 |
|
Haywood Japwnme posted:You need to turn your ego down a bit and listen to to the people trying to help you get a job.
|
# ? Jul 9, 2012 23:09 |