can we get this guy banned from the forums?????

  • Jeff Moden (6/5/2012)


    I've tried the ol' FizzBuzz test on some folks. A lot of them can't even begin it because they have never worked with things like Modulo (%) before. If you want someone with those extra bit of math skills (even though they seem simple to many), it's an ok litmus strip. If not, then I'd pick a different test. Remember that the purpose of interviews isn't to see how many people you can reject... the purpose is to find someone who has enough skills to do at least an adequate job and who has the ability to learn over time.

    Somehow that just makes me sad in some way. I was forced to learn to use Modulo in a High School programming class, too long ago for me to want to remember. They don't cover the basics in College these days?

    Jeff Moden (6/5/2012)


    As a side bar, anyone who writes code as well formed as Cadavre did, even though it was a loop, has already caught my attention. I can train them how to avoid the loop. It's much more difficult to train someone to take pride in their code and to show sensible formatting even when they're under the gun.

    Oh agreed. His code is nice. The code I quoted and said no way because it was RBAR, was also using the deprecated functionality of @ without a variable name, and was sloppy.

    His solutions are at least easy to read, and if he gave me both, it would be a different story. Knowing how to do it with a loop and without at the same time is above and beyond the call of duty. The version of the solution he quoted though was just icky.



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • Yeah, it's official. Any answer I try to come up with that's different from the ones posted makes my code so much more complicated. Lots of function usage. But no RBAR.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • mtassin (6/7/2012)


    FizzBuzz was invented by IBM I believe to test your ability to develop.

    IBM?? Not quite.

    This is where it started as a programmer's interview question.

    http://imranontech.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/

    It's based on a UK children's game.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • mtassin (6/7/2012)


    Jeff Moden (6/5/2012)


    As a side bar, anyone who writes code as well formed as Cadavre did, even though it was a loop, has already caught my attention. I can train them how to avoid the loop. It's much more difficult to train someone to take pride in their code and to show sensible formatting even when they're under the gun.

    Oh agreed. His code is nice. The code I quoted and said no way because it was RBAR, was also using the deprecated functionality of @ without a variable name, and was sloppy.

    You did notice that the code you quoted wasn't written by Cadavre? It was written by Michael who said it was "Brevity and obscurity"

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (6/7/2012)


    mtassin (6/7/2012)


    Jeff Moden (6/5/2012)


    As a side bar, anyone who writes code as well formed as Cadavre did, even though it was a loop, has already caught my attention. I can train them how to avoid the loop. It's much more difficult to train someone to take pride in their code and to show sensible formatting even when they're under the gun.

    Oh agreed. His code is nice. The code I quoted and said no way because it was RBAR, was also using the deprecated functionality of @ without a variable name, and was sloppy.

    You did notice that the code you quoted wasn't written by Cadavre? It was written by Michael who said it was "Brevity and obscurity"

    But Cadavre also stated that his second solution would be the one that was written by Michael.

    He later rewrote Michael's solution in the must more readable way that Jeff said he liked. I agree with Jeff, the way that he wrote it when he rewrote it, and wrote it the first time on a prior page is fine. I still don't like the loop, but it does show pride in his work.

    The fact that he presented multiple solutions is fine. I was talking about his quoting Michael's solution and saying that it would be the second one he presented. In fact it wouldn't have been. The solution he then presented afterwards is what he'd probably have done in an interview.

    And Michael may have gone for brevity, but it looks sloppy, and if you've only got that to judge somebody's SQL coding skills by, would you assume that the person just wrote sloppy code for this particular thing, or that the person writes sloppy and harder to read code in general?

    I know with my limitted experience where I am now, sloppy coders are sloppy coders no matter what code they write. Some of the SQL devs around here write well formatted and readable code when they're just exploring data. Others write 20,000 character single line stored procedures. That wrap on and on and on and on. Those are the ones we force SQL (and code in general) coding and formatting standards on.



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • mtassin (6/7/2012)


    GilaMonster (6/7/2012)


    mtassin (6/7/2012)


    Jeff Moden (6/5/2012)


    As a side bar, anyone who writes code as well formed as Cadavre did, even though it was a loop, has already caught my attention. I can train them how to avoid the loop. It's much more difficult to train someone to take pride in their code and to show sensible formatting even when they're under the gun.

    Oh agreed. His code is nice. The code I quoted and said no way because it was RBAR, was also using the deprecated functionality of @ without a variable name, and was sloppy.

    You did notice that the code you quoted wasn't written by Cadavre? It was written by Michael who said it was "Brevity and obscurity"

    But Cadavre also stated that his second solution would be the one that was written by Michael.

    No he didn't. He wrote a neat, tidy script that did much the same as Michael's did, but with proper variables and good formatting.

    I know with my limitted experience where I am now, sloppy coders are sloppy coders no matter what code they write.

    So you're calling someone a sloppy coder because they quoted someone else's sloppy code and then wrote a nicely formatted version of it?

    Remind me never to work with you.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Going completely off topic, but following the readability subject...

    I actually document as I do my research queries. Throw in comment lines that says "I'm searching for open tickets that have a NULL user id," then cut-n-paste that code, change a few things in the JOIN or WHERE clauses, then alter the comment to reflect those changes. I end up saving that crap (because usually it is crap) as its on script in case I have to go back later and figure out what I did.

    Many of those research comments never make it to the final solution (but new comments do). Does anybody else do that on just their research stuff?

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Cadavre (5/25/2012)


    Michael Valentine Jones (5/24/2012)


    Brevity and obscurity

    declare @ char(3)

    set @=0

    while @<100

    begin

    set @=@+1

    print

    case when @%15=0 then 'FizzBuzz'

    when @%3=0 then 'Fizz'

    when @%5=0 then 'Buzz'

    else @ end

    end

    If I was asked this in an interview, I'd produce the solution I gave first then this one second. I always try and produce two or more solutions to every interview problem I'm given.

    Gail, perhaps I'm not reading this quotation here? But it seems this is the quote I'm referring to. You referring to another one?

    The post that I'm getting crap over comes after this one by Cadavre, and before the one where he actually put in his nice formatted version.

    He quotes the above solution, and says "If I was asked this in an interview, I'd produce the solution I gave first, and then this one second".

    All I was trying to say was that if he gave this solution as his solution I'd knock it... first because it is RBAR, and second because it's rather sloppy.

    He then later wrote up his original solution, and quite likely the way he'd have written the looping version. And I ate my words with regards to those. With regards to the quote above, I won't.



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • On the sloppy code bit, I fully admit that I write sloppy code. I do it every day. It's part of my research phase. Once I get to actually writing my solution code (that's when I know what my data looks like and should look like), I try to write neat code. And I document the hell out of anything that isn't easy to read.

    I get that obscurity is bad. You want someone to come in after you and be able to troubleshoot & support your code. But whyfore is no one ever allowed to write sloppy code? Everyone writes sloppy code at some point in their careers, or in their development processes.

    Bad code being a different story, of course.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Doesn't mean he's write exactly that in exactly the same format with the same odd variable naming and indentation.

    I find if very strange you're calling someone a sloppy coder purely based on a code sample that another person wrote.

    btw

    Cadavre (6/4/2012)


    For FizzBuzz, I'd produce the following two solutions: -

    Cadavre (5/24/2012)


    Fizzbuzz is your evil interview? Really? It's as old as dirt (as are the solutions) 😛

    WITH t1 AS (SELECT 1 N UNION ALL SELECT 1 N),

    t2 AS (SELECT 1 N FROM t1 x, t1 y),

    t3 AS (SELECT 1 N FROM t2 x, t2 y),

    tally AS (SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS number

    FROM t3 x, t3 y)

    SELECT t.number,

    CASE WHEN t.number%3 = 0 AND t.number%5 = 0

    THEN 'FizzBuzz'

    WHEN t.number%3 = 0

    THEN 'Fizz'

    WHEN t.number%5 = 0

    THEN 'Buzz'

    ELSE CONVERT(VARCHAR(3),t.number)

    END AS result

    FROM tally t

    WHERE t.number <= 100 AND t.number >= 1;

    DECLARE @number INT = 1;

    DECLARE @fizzBuzz TABLE (number INT, result CHAR(8));

    WHILE @number <= 100

    BEGIN

    INSERT INTO @fizzBuzz (number, result)

    SELECT @number, CASE WHEN @number%3 = 0 AND @number%5 = 0 THEN 'FizzBuzz'

    WHEN @number%3 = 0 THEN 'Fizz'

    WHEN @number%5 = 0 THEN 'Buzz'

    ELSE CONVERT(VARCHAR(3),@number) END;

    SET @number = @number + 1;

    END;

    SELECT number, result

    FROM @fizzBuzz;

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (6/7/2012)


    Doesn't mean he's write exactly that in exactly the same format with the same odd variable naming and indentation.

    I find if very strange you're calling someone a sloppy coder purely based on a code sample that another person wrote.

    btw

    His words said he would. He proved his own words wrong by showing how he would really have written the code. Which you've quoted and I admit is nicely written and not sloppy code. 🙂

    Perhaps you and I just speak different versions of English? He quoted the sloppy/quick code of Michael's and said that would be his second solution. I didn't put those words in his mouth. He took the words back out of his mouth when he then shortly later wrote what he meant.

    Based on the code he actually posted as opposed to the code he quoted and said he would write, I take it back. He is not a sloppy coder. Based on what he originally said when he quoted the code, it's a different story.



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • "I would use this solution" != "I would write this exact piece of code" Unless you define a solution to include the exact layout, format, punctuation, spacing, capitalisation, etc.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • My apologies, it was never my intention to kick off this little storm :blush:

    --edit--

    Having read through it all, I think it all started due to my laziness in quoting Michael's loop rather than actually typing out how I'd have actually answered it. My bad 😀


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • How about Mr. Celko? I don't know why, but everytime I read one of his posts my blood pressure rises about 20 points.

  • I do that also. I save them in my "Bag_Of_Tricks" folder - a place that contains anything I don't want to have to dig for again.

Viewing 15 posts - 31 through 45 (of 63 total)

You must be logged in to reply to this topic. Login to reply