February 22, 2010 at 6:53 am
richard-674310 (2/22/2010)
You might want to consult your HR department on this - if you have one. I think it may be illegal (in the UK) to discriminate on NON-OBJECTIVE grounds. Ie. "X scored lower than Y on the test" is an OBJECTIVE reason to not hire X. I suspect that "I could never work with him/her" is illegal (in the UK).
If you don't hire X, it is possible you might have to defend your reasons in front of an employment tribunal.
Perhaps so, but does that mean that you give a test and only hire the highest score all the time? Are interviews no longer allowed?
There is some value in team fit. I'd have the "team" interview the person and assess results, using that as a decision of how to hire. I don't discriminate on sex/race/ethic/religion, but I also recognize that my team might. That's a tough one, but not a problem I've usually had. Most geeks I know of don't care if it's a woman or a person of another color/creed when we're interviewing.
Now when they work together....that can be an issue to manage.
February 22, 2010 at 7:13 am
Jeff is spot on regarding supplying an answer. This is like googling for results. Sure, after much debate maybe it would be worthwhile Jeff showing some of us a solution and explaining why he likes it - sounds more like an article / tutorial than a post though. Lets not flick to the answers before really giving it a good go - you can miss so much opportunity to learn the 'whys' when you go straight to the answer.
His comment of (paraphrasing) "if you can't do it then I don't want you" is fair enough but different positions have different requirements. As a 3GL developer I often have to do T-SQL but rarely, if ever, am I expected to be at a level of what I would expect of a DBA. An expectation that is all to frequently not met.
Sometimes it is the thought process interviewers are after.
Sometimes it is how you manage outside of your comfort zone.
Sometimes it is to demonstrate their own skills (silly, I know).
My understanding of the test is that it has a quick "Are you the w-w-w-w-waterboy?" technical review aspect (recruitment agencies can be that bad). It also provides the basis of discussion of working practices. Also, does your code smell right?
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!
February 22, 2010 at 7:55 am
I strongly favour the loopbased solution for this limited task. It is concise, readable without any comments and done quickly.
It performs well enough.
DECLARE @i INT
SET @i = 1
WHILE (@i <= 100)
BEGIN
print CASE WHEN @i % 5 = 0
AND @i % 3 = 0 THEN 'FizzBuzz'
WHEN @i % 5 = 0 THEN 'Buzz'
WHEN @i % 3 = 0 THEN 'Fizz'
ELSE CAST(@i AS CHAR(2))
END
SET @i = 1 + @i
END
It would take me longer to come up with an elegant and scalable setbased solution for this so it would be waisting my resources imho...
It seems that I am a lazy and pragmatic programmer and would fail to meet Jeffs expectations obviously. Should I feel bad about that?
February 22, 2010 at 8:08 am
J.Faehrmann (2/22/2010)
I strongly favour the loopbased solution for this limited task. It is concise, readable without any comments and done quickly.It performs well enough.
DECLARE @i INT
SET @i = 1
WHILE (@i <= 100)
BEGIN
print CASE WHEN @i % 5 = 0
AND @i % 3 = 0 THEN 'FizzBuzz'
WHEN @i % 5 = 0 THEN 'Buzz'
WHEN @i % 3 = 0 THEN 'Fizz'
ELSE CAST(@i AS CHAR(2))
END
SET @i = 1 + @i
END
It would take me longer to come up with an elegant and scalable setbased solution for this so it would be waisting my resources imho...
It seems that I am a lazy and pragmatic programmer and would fail to meet Jeffs expectations obviously. Should I feel bad about that?
I think it is that there is a thought shift required. There are set-based solutions available that require less programming and work more efficiently.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
February 22, 2010 at 8:19 am
I think that Jason is right. I must confess that I need to complete my "thought shift". Having worked with many IT professionals that struggled with Object Orientation I can attest to the difficulties that can ensue. Having done things such as formal methods and a little bit of functional programming I never really thought that I had trouble with using SQL as a set based language. It is questions such as these that make me what to use a loop etc but I, as oft was written across my school reports, "must try harder".
BTW Jeff suggests reading an article he wrote on Tally Tables. It is well worth a read.
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!
February 22, 2010 at 8:21 am
Steve Jones - Editor (2/22/2010)
This isn't a test of great programming ability, it's a weed out of lower programming ability.
I guess that would be a difference in expectations... I believe that all code during an interview should be the Developer putting his/her best foot forward. 🙂
It takes less than 2 seconds to at least break long case lines into a nicely readable format as you're typing.
Lets think about this... if two people turn in identical correctly functioning code and one of them takes a minute to turn in nicely formatted, easily maintainable code, which one do you think the interviewer is going to pick?
If someone writes a While loop or a Recursive CTE and another person can write a set based solution (which actually has less typing), which one do you think the interviewer will pick?
Say what you want about this simple test but getting the code to produce the correct answer is only a part of the problem. In this competative world, the interviewer will pick the person who writes the best code in a reasonable amount of time and, be sure about this, it doesn't take someone skilled in T-SQL any longer to write exceptional code than it takes someone less skilled to write "average" code.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 22, 2010 at 8:25 am
J.Faehrmann (2/22/2010)
I strongly favour the loopbased solution for this limited task. It is concise, readable without any comments and done quickly.It performs well enough.
DECLARE @i INT
SET @i = 1
WHILE (@i <= 100)
BEGIN
print CASE WHEN @i % 5 = 0
AND @i % 3 = 0 THEN 'FizzBuzz'
WHEN @i % 5 = 0 THEN 'Buzz'
WHEN @i % 3 = 0 THEN 'Fizz'
ELSE CAST(@i AS CHAR(2))
END
SET @i = 1 + @i
END
It would take me longer to come up with an elegant and scalable setbased solution for this so it would be waisting my resources imho...
It seems that I am a lazy and pragmatic programmer and would fail to meet Jeffs expectations obviously. Should I feel bad about that?
In two words... "you might" because it actually doesn't take any longer to write well formatted and scalable code and someone who does will beat you out in the "contest" for the job. Make no doubt about it, it IS a contest for the job and the best programmer will win.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 22, 2010 at 8:31 am
Yeah I know - i have rewritten quite a few poorly coded loops and cursors that performed badly.
It just takes me longer and is not the first solution that pops into my head. As long that is the case, it might be overoptimization in my case.
February 22, 2010 at 8:34 am
No argument about the best programmer, and I'm sure I'd miss out on some jobs if this is the only criteria. In an interview, my first thought is solve the problem, and a set based solution doesn't necessarily occur to me quickly for this issue. It does for others, but not this one.
Typically I haven't had someone at a computer, but a whiteboard. Trying to see how they think. To me, standards, syntax, getting code broken on lines/formatted, is something that can be taught. Basic algorithms, or the ability to build them, along with a personality can't be taught.
February 22, 2010 at 8:37 am
Just to be clear, folks... I'm not bad mouthing any of you for your solutions just for the sake of bad mouthing or criticizing... I'm one of "those" people that you can and will run into on a technical interview. I'm trying to give all you folks a leg up on how to win the "contest" for the job. To wit, I've directed you to an article that will teach you how to count without RBAR. Now, it's up to you to apply that because I'm not one of those folks that will publish answers to interview questions.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 22, 2010 at 8:44 am
Steve Jones - Editor (2/22/2010)
No argument about the best programmer, and I'm sure I'd miss out on some jobs if this is the only criteria. In an interview, my first thought is solve the problem, and a set based solution doesn't necessarily occur to me quickly for this issue. It does for others, but not this one.Typically I haven't had someone at a computer, but a whiteboard. Trying to see how they think. To me, standards, syntax, getting code broken on lines/formatted, is something that can be taught. Basic algorithms, or the ability to build them, along with a personality can't be taught.
I agree... it's all something that can be taught. But if 2 people are tied up on all other fronts including personality and other things, which one do you think will get the job? Someone who wrote a blob of unformatted, non-scalable code or someone who put a little thought and effort into it?
Again, I'm not whacking at people to make them feel bad... I'm whacking at people because I'm one of the people that does the interviews and have also won the job "contest" over a whole bunch of people with a bunch of fancy letters after their name. I'm trying to give them a leg up on winning the contest that I've been so successful at winning.
If you want the job, be "the best" candidate and I'm telling you how to be "the best" candidate.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 22, 2010 at 8:46 am
In this competative world, the interviewer will pick the person who writes the best code in a reasonable amount of time and, be sure about this, it doesn't take someone skilled in T-SQL any longer to write exceptional code than it takes someone less skilled to write "average" code.
I submit that if you try to pick the "best" programmer soley based on a test like this, then you probably won't find the "best" programmer. You'll find the best programmer by taking the time, in an interview, to drill into *why* the person wrote the code they did, and discussing with them the ramifications of the code (e.g. "Do you think this is production-worthy"? "What do you think about the solution you wrote?"). You'll learn more about their thought processes and about their ability to truly understand what they are doing, any why. That's how you're going to find the "best" programmer.
February 22, 2010 at 8:48 am
All things being equal, you pick the guy with the set based solution. However I've rarely seen "all things equal" between two candidates in an interview. The better the solution (and quicker), the better you'd score in an interview.
The point of the editorial, and this test, however, is to remove those candidates that can't clear a bar.
February 22, 2010 at 8:49 am
No offence taken, Jeff. But you made me think about my habits, thanks for that 🙂
Being lazy and pragmatic is a very important developer attitude to me.
I never realized that it could look that bad in an interview if the competition was just a bit less lazy.
February 22, 2010 at 8:52 am
dmbaker (2/22/2010)
In this competative world, the interviewer will pick the person who writes the best code in a reasonable amount of time and, be sure about this, it doesn't take someone skilled in T-SQL any longer to write exceptional code than it takes someone less skilled to write "average" code.
I submit that if you try to pick the "best" programmer soley based on a test like this, then you probably won't find the "best" programmer. You'll find the best programmer by taking the time, in an interview, to drill into *why* the person wrote the code they did, and discussing with them the ramifications of the code (e.g. "Do you think this is production-worthy"? "What do you think about the solution you wrote?"). You'll learn more about their thought processes and about their ability to truly understand what they are doing, any why. That's how you're going to find the "best" programmer.
Hell, I know that. Of course there are other things to consider. But, like I said, if 2 people are tied on everything else including personality, etc, etc, ad infinitim, which one do you think I'll pick? The one that wrote some poorly formatted RBAR or someone that not only shows they actually know what they're doing and has some pride in their code?
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 15 posts - 31 through 45 (of 363 total)
You must be logged in to reply to this topic. Login to reply