Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,100
    Thanks
    2
    Thanked 23 Times in 23 Posts

    Why Can't Programmers.. Program?

    Just for fun, pick your favorite programming language (javscript, PHP, or whatever), time yourself and see how quickly you can code the exercise here. No cheating (e.g., looking up code syntax)!

    http://www.codinghorror.com/blog/archives/000781.html
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #2
    Regular Coder Aradon's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    734
    Thanks
    0
    Thanked 20 Times in 19 Posts
    I would say I'm surprised but I'm really not. I've taught a few classes in Java and C++ and when they take the classes in the first couple years of their comp sci degree they know these things, but as they get to their senior year they are coding less and less and doing more theory instead. Because of this they lose basic skills and ideas such as thinking about the easy answer instead.

    Being that I teach c++ right now I was able to code this up pretty quickly, but giving the answer would ruin it for the others ;O
    "To iterate is human, to recurse divine." -L. Peter Deutsch

  • #3
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    The FizzBuzz one, I assume? Took me 2 minutes to do in C (which really isn't my language…). Oh, and I assume all of you people here who are constantly saying I know nothing will say that 2 minutes is too slow, even in a language I scarcely know.

  • #4
    Regular Coder
    Join Date
    Mar 2006
    Posts
    258
    Thanks
    1
    Thanked 2 Times in 2 Posts
    took me about 10 seconds to do a pseudo code in my head, but I'm not going to bother writing it.
    Is that really what they ask when your looking for a job in the CS field?

    I would say I'm surprised but I'm really not. I've taught a few classes in Java and C++ and when they take the classes in the first couple years of their comp sci degree they know these things, but as they get to their senior year they are coding less and less and doing more theory instead. Because of this they lose basic skills and ideas such as thinking about the easy answer instead.
    I'm not a CS student, but did have to take CS-I and CS-II. There is one thing that to date keeps bothering me: I got a C+ on both courses. The reason is that although I aced all labs and projects, exams were worth a lot, and I hate theory. On the other hand, I still can't believe that one friend go a B, when I know he was getting 50-70(out of 100) on all lab and projects. So at least in my case, the system is just plain wrong.

  • #5
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Did it in under a minute.

    However, I think part of the problem is people that say they are programmers but really aren't. Reading VB for Dummies the night before the interview doesn't count; and because there are lots of companies that don't do or have a piss poor technical interview, people like that get hired. Then when they interview at some place else when after 6 months the original company realizes they can't do anything, they get a real technical interview and even though they had a previous programming job.
    OracleGuy

  • #6
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,845
    Thanks
    21
    Thanked 157 Times in 148 Posts
    Like daniel, I'm not going to bother coding that, but it would be sooo easy to do so in just a few short minutes...I guess the moral of the story is that a formal college degree is no substitute for an analytical mind...Hell, I literally slept through Sociology class in college and got a B....Just goes to show that it's not what you know, it's how you use it...ok, I'm out of cliches now...
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :-)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!
    ♪♪ …Need Web Hosting For My YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

  • #7
    Regular Coder croatiankid's Avatar
    Join Date
    Jan 2006
    Posts
    665
    Thanks
    1
    Thanked 12 Times in 12 Posts
    I've been learning C for like 2 or 3 days and did it on paper in about a minute. Then compiled it and it worked!

  • #8
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    I did it in 30s and about 10 lines in php. Probably not the best or cleverest solution but I was going for speed

  • #9
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,942
    Thanks
    2
    Thanked 169 Times in 164 Posts
    I don't really consider myself as a true programmer, I don't have a CS degree and I only work with Perl, but have dabbled in php, and pascal. Based on the definition of being able to do the FizzBuzz test in a couple minutes, I must be a programmer. I did it less than 1 minute with of 5 lines of code, but could have shortened it to a one liner on the command line.

    EDIT
    lol, I only read the opening paragraph describing the program requirements. After writting my solution, went back and saw that they had several various solutions. How many of you cheated by reading those solutions before writting your own?
    Last edited by FishMonger; 03-04-2007 at 07:21 PM.

  • #10
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,100
    Thanks
    2
    Thanked 23 Times in 23 Posts
    Quote Originally Posted by FishMonger View Post
    How many of you cheated by reading those solutions before writing your own?
    I didn't look at any of the solutions posted. However, I confess that I went to the manual to get the syntax of a for loop. It had been too long since I had coded PHP; couldn't remember what the for loop looked like. I did, however, code a solution in about 2 minutes (if you overlook the for loop syntax error).

    Getting back to what a few others have said, I don't know that I would lend too much credence to the number of lines of code it took for a solution. After all, a lot of languages let you write a single line of code, if that's what you wanted to do. The quality of the code is more what I would look at, but then, that gets more into subjectiveness and preferred coding style, which totally gets away from what the original objective was in the first place.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #11
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,942
    Thanks
    2
    Thanked 169 Times in 164 Posts
    Quote Originally Posted by vinyl-junkie View Post
    I didn't look at any of the solutions posted. However, I confess that I went to the manual to get the syntax of a for loop. It had been too long since I had coded PHP; couldn't remember what the for loop looked like.
    Ya, I really don't like the initialization syntax of the typical for loop, which is why I rarely use it. Instead, I use Perl's short hand version.

    Here's my solution, which can be improved.
    Code:
    for $i (1..100) {
       if ($i %15 == 0){print "FizzBuzz\n"}
       elsif ($i %5 == 0){print "Buzz\n"}
       elsif ($i %3 == 0){print "Fizz\n"}
       else {print "$i\n"}
    }
    Last edited by FishMonger; 03-04-2007 at 08:49 PM.

  • #12
    Regular Coder croatiankid's Avatar
    Join Date
    Jan 2006
    Posts
    665
    Thanks
    1
    Thanked 12 Times in 12 Posts
    in c it's also pretty simple. Knew the syntax because I learned it the day before :P

  • #13
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    I am this bored at work today, 1 minute 1 line of illegible code.

    Code:
    for(var i=1;i<101;i++){document.write(((i % 3==0&&i % 5==0)?i+"fizzbuzz":(i % 3==0)?i+"fizz":(i % 5==0)?i+"buzz":i)+"<br />")};
    Helping to build a bigger box. - Adam Matthews

  • #14
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,942
    Thanks
    2
    Thanked 169 Times in 164 Posts
    Quote Originally Posted by Basscyst View Post
    I am this bored at work today, 1 minute 1 line of illegible code.

    Code:
    for(var i=1;i<101;i++){document.write(((i % 3==0&&i % 5==0)?i+"fizzbuzz":(i % 3==0)?i+"fizz":(i % 5==0)?i+"buzz":i)+"<br />")};
    Not bad...Here's another one. It's my prior solution done as a 1 liner.
    Code:
    perl -e 'for(1..100){print $_%15==0?"FizzBuzz\n":$_%5==0?"Buzz\n":$_%3==0?"Fizz\n":"$_\n"}'

  • #15
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Pfff… amateurs! I did this in 7 seconds in BASIC.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •