Hard Light Productions Forums

Off-Topic Discussion => Programming => Topic started by: jr2 on February 27, 2010, 08:24:29 pm

Title: Coding Horror: Why Can't Programmers Program?
Post by: jr2 on February 27, 2010, 08:24:29 pm
EDIT: Added linkies and formatting.

Quote from: http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html
Feb 26, 2007
Why Can't Programmers.. Program?


I was incredulous when I read this observation from Reginald Braithwaite: (http://weblog.raganwald.com/2007/01/dont-overthink-fizzbuzz.html)

Quote
Like me, the author is having trouble with the fact that 199 out of 200 (http://www.joelonsoftware.com/items/2005/01/27.html) applicants for every programming job can't write code at all. I repeat: they can't write any code whatsoever.

The author he's referring to is Imran, who is evidently turning away lots of programmers who can't write a simple program: (http://tickletux.wordpress.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/)

Quote
After a fair bit of trial and error I've discovered that people who struggle to code don't just struggle on big problems, or even smallish problems (i.e. write a implementation of a linked list). They struggle with tiny problems.
So I set out to develop questions that can identify this kind of developer and came up with a class of questions I call "FizzBuzz Questions" named after a game children often play (or are made to play) in schools in the UK. An example of a Fizz-Buzz question is the following:

Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".
Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes. Want to know something scary? The majority of comp sci graduates can't. I've also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.

Dan Kegel had a similar experience hiring entry-level programmers: (http://www.kegel.com/academy/getting-hired.html)

Quote
A surprisingly large fraction of applicants, even those with masters' degrees and PhDs in computer science, fail during interviews when asked to carry out basic programming tasks. For example, I've personally interviewed graduates who can't answer "Write a loop that counts from 1 to 10" or "What's the number after F in hexadecimal?" Less trivially, I've interviewed many candidates who can't use recursion to solve a real problem. These are basic skills; anyone who lacks them probably hasn't done much programming.
Speaking on behalf of software engineers who have to interview prospective new hires, I can safely say that we're tired of talking to candidates who can't program their way out of a paper bag. If you can successfully write a loop that goes from 1 to 10 in every language on your resume, can do simple arithmetic without a calculator, and can use recursion to solve a real problem, you're already ahead of the pack!

Between Reginald, Dan, and Imran, I'm starting to get a little worried. I'm more than willing to cut freshly minted software developers slack at the beginning of their career. Everybody has to start somewhere. But I am disturbed and appalled that any so-called programmer would apply for a job without being able to write the simplest of programs. That's a slap in the face to anyone who writes software for a living.

The vast divide between those who can program and those who cannot program (http://www.codinghorror.com/blog/archives/000635.html) is well known. I assumed anyone applying for a job as a programmer had already crossed this chasm. Apparently this is not a reasonable assumption to make. Apparently, FizzBuzz style screening is required to keep interviewers from wasting their time interviewing programmers who can't program.

Lest you think the FizzBuzz test is too easy-- and it is blindingly, intentionally easy-- a commenter to Imran's post notes its efficacy:

Quote
I'd hate interviewers to dismiss [the FizzBuzz] test as being too easy - in my experience it is genuinely astonishing how many candidates are incapable of the simplest programming tasks.

Maybe it's foolish to begin interviewing a programmer without looking at their code first. At Vertigo, we require a code sample before we even proceed to the phone interview stage. And our on-site interview includes a small coding exercise. Nothing difficult, mind you, just a basic exercise to go through the motions of building a small application in an hour or so. Although there have been one or two notable flame-outs, for the most part, this strategy has worked well for us. It lets us focus on actual software engineering in the interview without resorting to tedious puzzle questions. (http://www.codeslate.com/2007/01/you-dont-bury-survivors.html)

It's a shame you have to do so much pre-screening to have the luxury of interviewing programmers who can actually program. It'd be funny if it wasn't so damn depressing. I'm no fan of certification (http://www.codinghorror.com/blog/archives/000771.html), but it does make me wonder if Steve McConnell was on to something with all his talk of creating a true profession of software engineering. (http://www.amazon.com/exec/obidos/ASIN/0321193679/codinghorror-20)

Due to high volume, comments for this entry are now closed.

Posted by Jeff Atwood  
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Turambar on February 27, 2010, 08:36:18 pm
what's recursion?
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: jr2 on February 27, 2010, 08:37:39 pm
I don't know... but... I don't claim to be a programmer.   :lol:  Someone who codes...? (can someone who codes answer that...?)
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Mongoose on February 27, 2010, 08:48:48 pm
We have a lovely little Programming folder located just under GenDisc, you know.

what's recursion?
In programming terms, feeding the output of a function back into itself.  One of the most basic examples would be writing a program to calculate factorials, n! = 1 * 2 * ... * n.  You write the code with two cases: 0! returns 1, and n! returns n * (n -1)!  The code works down the layers until it hits 0! and then goes back and multiplies all of the previous layers together.  It's a very useful concept for any number of problems, and whole languages, such as LISP (the bane of my existence in one particular class :p), are founded on it.  If you're going to work as a programmer, it's something you need to know.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Polpolion on February 27, 2010, 09:29:38 pm
Somehow, I doubt that ~99.5% of programmers don't know how to program. When a 17 year old kid who hasn't programmed in nearly a year can supposedly program better than people with PhDs in computer science, something other than programming must be an issue here.

Frankly, I think it's much more likely that a handful of people accidentally posted a classified with "no experience necessary" appended than 199 out 200 people misjudging their abilities that much.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Nuke on February 27, 2010, 09:46:44 pm
what's recursion?

google it
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Nuke on February 27, 2010, 09:55:01 pm
Quote
Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".
Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes. Want to know something scary? The majority of comp sci graduates can't. I've also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.

Code: [Select]
for i=1, 100 do
 if math.mod(i,3) == 0 and math.mod(i,5) == 0 then
  print("FizzBuzz")
 elseif math.mod(i,3) == 0 then
  print("Fizz")
 elseif math.mod(i,5) == 0 then
  print("Buzz")
 else
  print(tostring(i))
 end
end

time 5 minutes
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: portej05 on February 27, 2010, 10:06:42 pm
Recursion is a concept where a problem is broken up into smaller forms of itself.
Someone mentioned factorials, but a better example is fibonacci:

Code: [Select]
int fib( int n )
{
  if ( n == 1 || n == 0 )
    return 1;
  return fib( n - 1 ) + fib( n - 2 );
}

The problem is that without some cleverness in there, something like fib 10 will take a very long time.
So then you move on to a region called 'dynamic programming', which 'memoises' the result of a previous operation, and in the above case can cause it to move from an exponential to a linear problem. Which is something you very much want :)

Nukes solution isn't optimal - as long as you do them in the correct order you don't need the two mods :) (but who cares about optimality in this case :) )
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: karajorma on February 27, 2010, 11:23:20 pm
what's recursion?

google it

You fail at recursion. Googling Google is recursion. :p
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Nuke on February 27, 2010, 11:34:31 pm
Recursion is a concept where a problem is broken up into smaller forms of itself.
Someone mentioned factorials, but a better example is fibonacci:

Code: [Select]
int fib( int n )
{
  if ( n == 1 || n == 0 )
    return 1;
  return fib( n - 1 ) + fib( n - 2 );
}

The problem is that without some cleverness in there, something like fib 10 will take a very long time.
So then you move on to a region called 'dynamic programming', which 'memoises' the result of a previous operation, and in the above case can cause it to move from an exponential to a linear problem. Which is something you very much want :)

Nukes solution isn't optimal - as long as you do them in the correct order you don't need the two mods :) (but who cares about optimality in this case :) )

yea i probibly coulda done

Code: [Select]
for i=1, 100 do
 if math.mod(i,3) == 0 then
  if math.mod(i,5) == 0 then
   print("FizzBuzz")
  else
   print("Fizz")
  end
 elseif math.mod(i,5) == 0 then
   print("Buzz")
 else
  print(tostring(i))
 end
end

and the mod statement would have only been used twice at most. but usually when i write code i make the function work first, then i optimize it later. as for what language, its lua.

what's recursion?

google it

You fail at recursion. Googling Google is recursion. :p

and you fail at recognizing a classic google prank. :D
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Scooby_Doo on February 27, 2010, 11:43:40 pm
From what I remember learning port's version is recursive.... nuke's isn't (not that that's bad, saves on stack space)
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Nuke on February 28, 2010, 12:15:39 am
From what I remember learning port's version is recursive.... nuke's isn't (not that that's bad, saves on stack space)

well we were solving completely different problems. recursion is what makes fractals so damn awesome, want more detail, just run the output back through it some more.

i kinda use recursion in a couple places in lua to covert arrays (or tables as lua calls them) into function arguments. since you can also stick a reference to the function into a table, i stick the function as a named key and the arguments in order from 1-n (n=number of arguments). so i use a recursive function to convert those arguments into a list of arguments and then call the function, all with a single generic call. this is useful for setting up a call to a function that draws a hud gauge, but in a hook that doesnt have readily access to the screen. instead i setup the table as a global variable that gets passed to hud hook, and then when appropriate i deconstruct it into the function call and arguments, and it gets drawn at the correct time. its a lot neater than making almost every value a global.

Code: [Select]
function toargs(tab)
local len = #tab
if len >= 1 then
return tab[1], nextarg(tab,1,len)
end
end
function nextarg(tab,cur,len)
cur = cur + 1
if cur <= len then
return tab[cur], nextarg(tab,cur,len)
end
end

so if i have a function called drawLine(x,y,x2,y2) and i want to draw it sometime later with data thats only available right now. id do something like this

Code: [Select]
t = {}
t.func = drawLine
t[1] = 10
t[2] = 12
t[3] = 11
t[4] = 9

i can call that function with those args with this.

Code: [Select]
t.func(toargs(t))

since the # operator only counts consecutive neumeric indexes starting at 1, it will only count the numeric values. works pretty well.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Davros on February 28, 2010, 07:22:04 am
I looked up recursion in the dictionary  and it says the following

recursion
re·cur·sion  [ri-kur-zhuhn] 
–nounMathematics, Computers.
See recursion
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: The E on February 28, 2010, 07:43:08 am
Nukes solution isn't optimal - as long as you do them in the correct order you don't need the two mods :) (but who cares about optimality in this case :) )

The following in pseudo C:

Code: [Select]
for (i = 1, i++, i <= 100) {
    if !( i mod 3) // Using the C assumption that false == zero
        print("Fizz");
    if !( i mod 5)
        print("Buzz");
    println();
    continue;
    println(i);
}
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: karajorma on February 28, 2010, 07:52:26 am
Ummmm. That's never going to output anything other than Fizz, Buzz or FizzBuzz cause iy will always continue before it prints out the number.

This is one of those examples where simple is best. Nuke's first example might not have been optimal but it was about as easy to read and understand as it gets.

I'm actually kinda intrigued as to Portej05's optimal solution actually. I can see how you'd improve the code so that you could add other tests easily but I can't see how you're doing it with less if statements for only Fizz and Buzz.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: The E on February 28, 2010, 07:56:08 am
/me facepalms

Yeah, I probably should have thought this through, shouldn't I?

Code: [Select]
for (i = 1, i++, i <= 100) {
    if !( i mod 3) // Using the C assumption that false == zero
        print("Fizz");
    if !( i mod 5)
        print("Buzz");
    println();
    if ( !( i mod 5 ) || !( i mod 3 ) )
        continue;
    print(i);
}
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: karajorma on February 28, 2010, 08:18:50 am
I still think Nuke's first was actually easier to read.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: The E on February 28, 2010, 08:21:46 am
Yeah, that it is.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: MP-Ryan on February 28, 2010, 12:20:39 pm
I still think Nuke's first was actually easier to read.

As someone with no programming background whatsoever [and experience in writing code only in the sense that HTML, CSS, and JavaScript all use a logical code], Nuke's first example is intuitive and easy to figure out even for me.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Mongoose on February 28, 2010, 01:15:06 pm
I remember one of my comp. sci. textbooks mentioning that negligible gains in efficiency can often be offset by substantial decreases in readability.  Unless you're trying to squeeze every last processor cycle you can out of code for some time-critical operation, it's usually a better option to write things up as clearly as possible.  Remember, either you yourself or someone else is presumably going to have to read it and figure out what you did somewhere down the line. :p
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: butter_pat_head on February 28, 2010, 02:29:30 pm
Some dialect of basic in 3.25 mins: (and thats including a rewrite half way through  :drevil:)
Code: [Select]
for A=1 to 100
  B$=""
  if A mod 3=0 then B$="Fizz"
  if A mod 5=0 then B$=B$+"Buzz"
  if B$="" then B$=str$(A)
  ? B$
next a

That article was a little shocking.  I wouldn't think myself a good programmer but to find that those people have trouble with something that would have been printed in a 1980's "Getting started with basic" book... and usually something that would be printed near the beginning!
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Nuke on February 28, 2010, 02:47:46 pm
one must also consider that lua is a very high level language. its interpreted and not really compiled. it can be compiled to bytecode but that is not necessary to make it work. for readability lua is hard to beat, its also the simplest language ive ever worked with. so i have no idea what the computer is being asked of when i type a statement. the most programming classes ive had were 3 semesters in high school. they mainly taught c/c++ and vb. for some reason i spent most of my time screwing around with vb (and really didnt accomplish anything better than pong).
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Mongoose on February 28, 2010, 05:08:12 pm
Just about all of the coding classes I took used C/C++ from the Unix command line, save one taught in Scheme (a form of LISP) that I pretty much hated.  Even today, I have little to no idea how Visual C++ actually functions. :p
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Topgun on February 28, 2010, 05:52:54 pm
I can explain it for you if you don't mind my bad English :P
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Nuke on February 28, 2010, 06:12:15 pm
I can explain it for you if you don't mind my bad English :P

its probibly the same under detailed over plagiarized explanation that wikipedia has :D
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Topgun on February 28, 2010, 06:56:57 pm
basically its like this,

there are variables that the os can send to the program like where the mouse cursor is, what keys are being pressed ect. the program catches these variables and does what it wants with them (like rendering the cursor or whatever).
its easier to explain this with some psudo-code:

while (WINDOW_HAS_FOCUS AND I_want_to_draw_something)
{
int draw_cursor (CURSOR_LOCATION, BUTTON_PRESSED)

{

-------do some stuff-----


}
I_want_to_draw_something = false;
}

so every cycle the os gives the program, the condition WINDOW_HAS_FOCUS is checked. of its true, and the program wants to draw the cursor, then the function is called and draws the cursor.

thats the basic idea of windows programming, what visual studio does is it turns all that into objects
so you would have something like this:

class Cursor

int X_LOCATION
int Y_LOCATION
bool is_clicked

method_DRAW()

yeah I know that's not anywhere near valid C++ but whatever, its psudocode. anyway, when you write something in visual studio to do something on an event all it does is create a method that gets called when one of those variables the os gives you is true.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: The E on February 28, 2010, 07:23:35 pm
yeah I know that's not anywhere near valid C++ but whatever, its psudocode. anyway, when you write something in visual studio to do something on an event all it does is create a method that gets called when one of those variables the os gives you is true.

.... Seriously? You think that's "Visual C"?

You just described just one of the many, many functions a full IDE like Visual Studio provides. "Visual C" is just a shorthand for "Visual Studio, preconfigured for development using C/C++". Please learn the terms before trying to describe them, kthx.

While you're at it, please research topics like "Object-oriented programming", Microsoft Foundation Classes, and Windows Presentation Foundation.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Scooby_Doo on February 28, 2010, 07:51:38 pm
yeah I know that's not anywhere near valid C++ but whatever, its psudocode. anyway, when you write something in visual studio to do something on an event all it does is create a method that gets called when one of those variables the os gives you is true.

.... Seriously? You think that's "Visual C"?

You just described just one of the many, many functions a full IDE like Visual Studio provides. "Visual C" is just a shorthand for "Visual Studio, preconfigured for development using C/C++". Please learn the terms before trying to describe them, kthx.

While you're at it, please research topics like "Object-oriented programming", Microsoft Foundation Classes, and Windows Presentation Foundation.

Well it looked a bit like MFC.... which in itself is a coding horror LOL
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: blackhole on February 28, 2010, 08:10:46 pm
Code: [Select]
#include <iostream>

using namespace std;

int main()
{
  for(int i = 1; i <= 100; ++i)
  {
    if(!(i%3) && !(i%5))
      cout<<"FizzBuzz"<<endl;
    else if(!(i%3))
      cout<<"Fizz"<<endl;
    else if(!(i%5))
      cout<<"Buzz"<<endl;
    else
      cout<<i<<endl;
  }
  return 0;
}

About 90 seconds, since everyone else here seems to want to prove they can do it.

EDIT: Whoops, misread the prompt. Make that 170 seconds for time spent fixing it :(
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Scooby_Doo on February 28, 2010, 08:38:50 pm
Ok how about this:

Code: [Select]
using System;

namespace FizzBuzz
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {

            for (int loop = 1; loop <= 100; ++loop)
            {
                bool divBy3 = (loop % 3) != 0;
                bool divBy5 = (loop % 5) != 0;

                if (divBy3 && divBy5)
                {
                    Console.WriteLine ("FizzBuzz") ;
                }
                else if (divBy3)
                {
                    Console.WriteLine("Fizz");
                }
                else if (divBy5)
                {
                    Console.WriteLine("Buzz");
                }
                else
                {
                    Console.WriteLine(loop.ToString());
                }
            }
        }
    }
}
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Aardwolf on February 28, 2010, 09:54:11 pm
Ok how about this:
*snip*

Lol, cookie-cutter code.

/me shortens it, for no benefit.

Code: [Select]
using System;

namespace FizzBuzz
{
    static class Program
    {
        static void Main()
        {
            for (int loop = 1; loop <= 100; ++loop)
            {
                bool divBy3 = (loop % 3) != 0;
                bool divBy5 = (loop % 5) != 0;

                if (divBy3 && divBy5)
                    Console.WriteLine ("FizzBuzz") ;
                else if (divBy3)
                    Console.WriteLine("Fizz");
                else if (divBy5)
                    Console.WriteLine("Buzz");
                else
                    Console.WriteLine(loop.ToString());
            }
        }
    }
}
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Scooby_Doo on February 28, 2010, 10:18:12 pm
LOL well isn't that what this is heading towards? LOL
Actually I check % only twice the entire loop cycle.  I keep track via bool flags.

Also I would have liked to gotten rid of at least one of the if statements, but I don't think that's possible.  If it was doing 3 or 5 then it would be a lot simplier.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: karajorma on February 28, 2010, 11:03:15 pm
It's possible to do it in 3 if statements and no else but the result is more complex code.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: portej05 on March 01, 2010, 01:15:26 am
Code: [Select]
void fizzbuzz( )
{
  bool a = false, b = false;
  do
  {
     a = ( i % 3 == 0 );
     b = ( i % 5 == 0 );
     if ( a )
       printf( "Fizz" );
     if ( b )
       printf( "Buzz");
     if ( !( a||b ) )
        printf("%d", i );
     printf("\n");
  } while( i != 100 );
}

I missed a step when I thought nuke was a little suboptimal. The above is the best I've got at the moment.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Scooby_Doo on March 01, 2010, 01:29:11 am
I think that's what I was trying to achieve.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Nuke on March 01, 2010, 01:59:27 am
Code: [Select]
for i=1, 100 do
 if i%3 == 0 and i%5 == 0 then
  print("FizzBuzz")
 elseif i%3 == 0 then
  print("Fizz")
 elseif i%5 == 0 then
  print("Buzz")
 else
  print(tostring(i))
 end
end

aparently lua supports an operator for modulo
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Bobboau on March 01, 2010, 02:09:52 am
all you people doing fancy stuff would get penalized for prematurely optimizing your code.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: karajorma on March 01, 2010, 02:57:50 am
Yep. The optimised code is much less readable and relies on people realising that for values divisible by 15 both Fizz and Buzz will be outputted.

In return for that it gains a fairly questionable speed increase (and possibly depending on the method maybe the ability to be modified later to add other options).
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Spicious on March 01, 2010, 03:46:45 am
I think everyone who's trying to code it up in brilliant ways has completely missed the point of the article.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: karajorma on March 01, 2010, 04:02:33 am
Not really. They just have a better understanding of what's going to happen than the writers of the article.

If you're asked to code something at a job interview you're going to write the best code you possibly can to solve the problem even if you're told that the idea is to sort out the programmers from non-programmers. Nobody is going to believe that the quality of your solution is only going to be looked at as a pass-fail.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Nuke on March 01, 2010, 05:24:59 am
theres also a reason its called computer science. computers have so many layers of abstraction between the programming language and the machine code, and if you didnt design the whole system from the ground up youself (and even if you did), the only way to know if an optimization is optimal is to generate empirical data to compare against. things like using memory can slow you down a lot more than doing math. many int maths can be done in a single cycle, and its possible that your computer can crunch all 3 mods in a single cycle. you can do things like check the time before and after a function call to see if changes in the call really do speed things up. also not every scrap of code needs to be optimal. init code for example is best left easy to read so that somone looking at the program gets a picture of all the stuff that needs to be done before a subsystem can operate.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Spicious on March 01, 2010, 05:52:52 am
Not really. They just have a better understanding of what's going to happen than the writers of the article.
That seems like quite the logical leap given that the authors of that article and those linked seem to not infrequently be people doing the interviews. Low level optimisations would only be important for a fairly niche job sector.

its possible that your computer can crunch all 3 mods in a single cycle.
Is that a reference to Itanium?
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: karajorma on March 01, 2010, 08:10:56 am
Not really. They just have a better understanding of what's going to happen than the writers of the article.
That seems like quite the logical leap given that the authors of that article and those linked seem to not infrequently be people doing the interviews. Low level optimisations would only be important for a fairly niche job sector.

I think you've missed my point. I wasn't in favour of low-level optimisation. In fact every single post I've made has been against it.

The point of the article was that many people going for coding jobs can't code and therefore a test is needed. I doubt anyone on this board didn't get that point.

My point was that in an interview situation everyone is going to try to come up with a brilliant solution to that test rather than simply slapping one together that works. They're in an interview after all. Making a solution that has a bug in it is going to count against them (in their minds at least), making a solution that is both brilliant and easily readable is going to get them the job since it will impress the interviewers (or so they think). So it's silly to expect people not to try. They will. I'd be surprised if anyone here didn't check to see if they could improve on the examples given here.

The important thing though is to realise that although you might come up with more optimal solutions the one Nuke gave is probably what you should actually hand in if the interviewer is competent. The authors didn't mention this fact though and that's what I mean when I said people on this board had a better understanding. They should have warned the people setting the tests that they shouldn't try to examine the code too carefully as the code from the very best coders is going to look very similar to the code from those who are beginners.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: The E on March 01, 2010, 08:25:32 am
Yeah, the test isn't about the quality of the code (not much, anyway), it's about whether or not the applicant actually HAS coding ability at all.
The examples posted here are things we can come up with when we have ample time to think about it. In an interview situation, the simple solution is probably what the majority of coders will come up with.
The main purpose of this test is to separate the people who have at least some training from those who think that programming is something where you can fake your way through an Interview and learn the stuff later. DailyWTF's Tales from the Interview section has several examples for why tests like these, as trivial as they may seem, are a really good idea.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Sushi on March 01, 2010, 09:50:21 am
I call BS on the article. If a couple of places were getting hordes of unqualified applicants, it's because they screwed something up. If we're going to be throwing around anecdotal evidence, then I'll stick with my own over theirs (which says that the vast majority of people who make it through 4+ years of CS education actually do know something about programming).

But yes, as an interviewer, if you expect someone to write code and don't verify that they know how before you hire them, then you suck at your job and deserve what you get.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: The E on March 01, 2010, 10:37:50 am
Well, during the initial dot-com hype it was not unusual for companies to hire people whose sole qualification for development was there ability to use keyboards.

If a couple of places were getting hordes of unqualified applicants, it's because they screwed something up.

No, not really. There are a LOT of misconceptions about how IT development works floating around, more so than in almost any other profession I know. Granted, this was more of a problem a few years back, during the initial dot-com boom, but the fact remains that there are still people around who think that programming is actually quite easy.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Iss Mneur on March 01, 2010, 01:18:25 pm
Well, during the initial dot-com hype it was not unusual for companies to hire people whose sole qualification for development was there ability to use keyboards.

If a couple of places were getting hordes of unqualified applicants, it's because they screwed something up.

No, not really. There are a LOT of misconceptions about how IT development works floating around, more so than in almost any other profession I know. Granted, this was more of a problem a few years back, during the initial dot-com boom, but the fact remains that there are still people around who think that programming is actually quite easy.

I agree, there are a large number of people that claim to be programmers, and maybe even have been employed as a "programmer" at some point, when in reality the "programming" they were doing amounted to data entry or some such. 

Also, in particular during the dot com boom, being able to mark up text with HTML and copy and paste entire php or VB scripts on a web server is consider by some to be "programming".  Now, not to deride any actual web developers (because this is how I got the "programming" bug (HTML and Javascript, in particular)), but slapping stuff together by following specific instructions is not programming.  This is programming by only knowing how to use the keyboard.

Personally (I know this is anecdotal evidence but whatever), during my time attending College for my Bachelor (I am currently finishing my non-CS stuff now), I have met a number of people that could not pass the Introduction to Computer Science course, which amounted to the instructor giving (at the start of the course) click by click instructions on how to do the lab in a Java IDE (NetBeans, I think it was) to by the end of the course, "implement this data structure that we talked about in class". The class included a printed copy of the instructors slides that had the pseudo code for the data structure in it (sometimes even Java snippets of the important parts of the data structure).  If I was not clear, I mean the instructor basically gave the students the lab assignments to the students in class as copy and paste building blocks to assemble, not write, the lab (thankfully the rest of the courses after that were not handed on a silver platter like that, or I would have gone insane).

That being said, even 1 out of the 10 (of the 40 that started) that passed the first course, still could not figure out basic programmer things like how to debug and reading syntax error messages, even though they understood the data structures from a theoretical standpoint, they could not put it into code.  This was made worse when in the second year we went to C++ and x86 ASM using MASM.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Spicious on March 01, 2010, 02:30:10 pm
I call BS on the article. If a couple of places were getting hordes of unqualified applicants, it's because they screwed something up. If we're going to be throwing around anecdotal evidence, then I'll stick with my own over theirs (which says that the vast majority of people who make it through 4+ years of CS education actually do know something about programming).
While you may be right (though 3 years is an option here), the article works from a more plausible premise of some small set (with or without an education in CS) who can't code bouncing between interviews.

That being said, even 1 out of the 10 (of the 40 that started) that passed the first course, still could not figure out basic programmer things like how to debug and reading syntax error messages
Can anyone read C++ template errors?
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Mika on March 01, 2010, 02:46:14 pm
The article seems to reflect some of the feelings I have got from programming. First thing is that programming is not easy, despite a lot of CS students thinking so when they start. This, like many other trades, is something you need to have an internal desire to do. Getting paid good money is not a good motivator if it is the sole motivation of studies.

Second thing is that I have found out that lots of Physicists are better programmers than Computer Science students in the dirty low to mid level stuff. But there are some catches, Physcists do have it easier to understand low level functions and what physically happens in the motherboard. However, abstration layers, classes, polymorphisms or inheritances are not mentioned that much in the lessons. In the end I find that I can actually program subroutines using Assembly, or vanilla C (Pelles C has been wonderful!), but for some reasons I have an inherent dislike for C++. And especially I hate writing GUIs. But, then again MATLAB has been wonderful!

Bottom line is, every person is different and like different things in programming. I hate Object Oriented programming, cannot stand writing GUI event handlers, but give me anything that needs Maths and I'll be happy! But then again, I write mainly mathematical programs or libraries in the rare case I need them. The whole application development; I'll leave that to somebody else - I don't find it that interesting. So, some people like Table Oriented Programming, some like Procedural and some Object Oriented. Give the person something what they are fluent with and that's where they are most efficient.

As a sidenote, I always found Assembly to be an incredibly useful course of explaining what computer actually does! And C fits in wonderfully to continue on that track. And the pointers are quite clear after that.

Besides, I'm not sure what to think of the replies to that article - even I can spot some of the errors in them. And the same seems to continue here, suddenly everyone has a need to write one as if to prove they are on the good programmers' side. Whatever the reason, be sure to take a look at the dailywtf for the isValidInteger() function... written in Java. How many errors can you spot?

Perhaps I should put up the simple dynamic vector library here for code review - anyone interested?
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Mika on March 01, 2010, 02:59:33 pm
Sorry for not remembering the correct name for the function.

You can find the original article here:
http://thedailywtf.com/Articles/isValidNumber().aspx
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: The E on March 01, 2010, 03:17:24 pm
There isn't that much wrong with it. It does its job. In fact, it's the sort of code one tends to write to appease management.

That being said, this function is about as useless as it gets. It accepts only integers as parameters, and since this is Java, the JVM will scream at you for trying to put something that is not an int in there. Meaning that this function will only fail under one condition: if the parameter passed is NULL. Under other circumstances, it will either fail before it is even executed (or at the very least generate warnings), or return true. Note that it will return true even if the parameter passed is a single, non-numeric char, since those are converted implicitly by Java.

How wrong am I?

Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Iss Mneur on March 01, 2010, 03:46:55 pm
I call BS on the article. If a couple of places were getting hordes of unqualified applicants, it's because they screwed something up. If we're going to be throwing around anecdotal evidence, then I'll stick with my own over theirs (which says that the vast majority of people who make it through 4+ years of CS education actually do know something about programming).
While you may be right (though 3 years is an option here), the article works from a more plausible premise of some small set (with or without an education in CS) who can't code bouncing between interviews.
Yes, I found the long explanation of what you are describing from Joel's post on the topic (http://link=http://www.joelonsoftware.com/items/2005/01/27.htm).
Quote from: Joel on Software
Now, when you get those 200 resumes, and hire the best person from the top 200, does that mean you're hiring the top 0.5%?

"Maybe."

No. You're not. Think about what happens to the other 199 that you didn't hire.

They go look for another job.

That means, in this horribly simplified universe, that the entire world could consist of 1,000,000 programmers, of whom the worst 199 keep applying for every job and never getting them, but the best 999,801 always get jobs as soon as they apply for one. So every time a job is listed the 199 losers apply, as usual, and one guy from the pool of 999,801 applies, and he gets the job, of course, because he's the best, and now, in this contrived example, every employer thinks they're getting the top 0.5% when they're actually getting the top 99.9801%.

Obviously, a very contrived example as he points out in the rest of his post but the premise remains.

That being said, even 1 out of the 10 (of the 40 that started) that passed the first course, still could not figure out basic programmer things like how to debug and reading syntax error messages
Can anyone read C++ template errors?
Yes, either a lot of practice, being good a pattern matching or a long time to reformat the error to be a legible one and not a long line of nested angle brackets.

The article seems to reflect some of the feelings I have got from programming. First thing is that programming is not easy, despite a lot of CS students thinking so when they start. This, like many other trades, is something you need to have an internal desire to do. Getting paid good money is not a good motivator if it is the sole motivation of studies.
Agreed, it depends on what you are trying to do by programming, just get it done, or make it the most elegant and well designed program or library out there.
Second thing is that I have found out that lots of Physicists are better programmers than Computer Science students in the dirty low to mid level stuff. But there are some catches, Physcists do have it easier to understand low level functions and what physically happens in the motherboard. However, abstration layers, classes, polymorphisms or inheritances are not mentioned that much in the lessons. In the end I find that I can actually program subroutines using Assembly, or vanilla C (Pelles C has been wonderful!), but for some reasons I have an inherent dislike for C++. And especially I hate writing GUIs. But, then again MATLAB has been wonderful!
Two things:
1. no programmer really likes doing GUIs, they are best left to the interface designers to layout and implement if the designer is capable, or have the layout and the programmer implement.
2. Unless the physicist also understands electrical engineering, more specifically electronics engineering, they would likely only understand electrical properties of the computer, which really only has a minor effect on understanding what the computer is really doing and how fundamental computer operations are implemented such as dereferencing pointers, virtual memory, or page tables.  That being said, the type of thought process that physics would require (namely the need to be very analytical of everything) is also very helpful as a programmer.

Bottom line is, every person is different and like different things in programming. I hate Object Oriented programming, cannot stand writing GUI event handlers, but give me anything that needs Maths and I'll be happy! But then again, I write mainly mathematical programs or libraries in the rare case I need them. The whole application development; I'll leave that to somebody else - I don't find it that interesting. So, some people like Table Oriented Programming, some like Procedural and some Object Oriented. Give the person something what they are fluent with and that's where they are most efficient.
Programming paradigms has little to do with the original FizzBuzz problem.  The most important part of the FizzBuzz problem is can you implement in code (of any kind) the algorithm that was outlined.  Implementing the algorithm is programming.  Generating the algorithm is Computer Science.  Most programmers that can do both are quite often called "Software Engineers" (much to the annoyance of the rest of the engineers), or "Software developers", and because both get rolled into one a lot they also just get called "Programmers" (mostly because to the layman algorithms are useless and Computer Science and programming (along with most anything computer or technology related) are the same thing, magic).

As a sidenote, I always found Assembly to be an incredibly useful course of explaining what computer actually does! And C fits in wonderfully to continue on that track. And the pointers are quite clear after that.
Defiantly, and if you want to know why a computer does what it does, in the way that it does it, you need to look at a (integrated) circuits course.

Besides, I'm not sure what to think of the replies to that article - even I can spot some of the errors in them. And the same seems to continue here, suddenly everyone has a need to write one as if to prove they are on the good programmers' side. Whatever the reason, be sure to take a look at the dailywtf for the isValidInteger() function... written in Java. How many errors can you spot?
I agree that, it why I refrained from posting my own, though remember that by the fact that we are even here discussing this idea, is a very good indication that we in fact are not one of the 199 that Joel (see quote near the top of this post) and Jeff are talking about.

Perhaps I should put up the simple dynamic vector library here for code review - anyone interested?
Code review is always useful, even though I have no idea what the "simple dynamic vector library" is used for (I can guess) or its relevance to this discussion.

[snip]

How wrong am I?
You are 100% correct the function adds no value as its inputs will always be integers or coerced into being integers.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Scooby_Doo on March 01, 2010, 04:29:34 pm
Sorry for not remembering the correct name for the function.

You can find the original article here:
http://thedailywtf.com/Articles/isValidNumber().aspx

OMG after seeing that java can have null ints, this whole things sucks LOL

I also like how they comment about getting a NumberFormatException then proceed to catch Exception instead LOL
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: chief1983 on March 02, 2010, 02:34:12 pm
You can get a CS degree without writing a lot of code.  Computer Science is too broad of a discipline, and that's a problem.  There's also not an enforced accreditation test like for an engineering degree, so any old place can give out something they feel like calling a Computer Science degree.  It's just a B.S. involving computers :P

Somewhere in all this I found a link to a book about Professional Software Development, and it's something I've been talking about since I got close to graduating.  There needs to be a split in the field, for those interested in theory (who really don't even write a lot of code) and those who want to do nothing but utilize existing principles to design and create a quality product (if only there was a term for people who do that...).  And don't even get me started on most IST majors.  At my uni they were the CS washouts.  A lot of CS programs don't have a backup program like IST so they just push through their comp scis.

Both 'efficient' and 'high maintainability' programs have their purposes, and one or the other might not be discernable in certain programming languages.  Swapping two variables, for example.  Many people point out the XOR as the _correct_ solution, as if it's always right.  These people would get a boot out the door.  You can bring it up of course, but make sure to clarify when it's useful and when you'd have to use other means like a temp var.  Also, throwing something out like python's a, b = b, a can be dangerous as well.  Unless you're intimately familiar with the backend of the language you could very well be creating _two_ extra memory allocations instead of just one temp var for that operation.  Or, the language may not be smart enough to figure out you're doing a swap, and perform the operations in an order that leads to an undesired result (a == b always for instance).  Pointing out that kind of knowledge would not be a bad idea, but if there are that many pitfalls with those methods, you should probably be sticking with a reliable one and explaining why the other ones _aren't_ the best idea.  Too many programmers get stuck on one language and forget that there's more than one way to skin a cat, depending on the type of knife you use (or axe, or flamethrower, or...).

I'm not surprised that many applicants can't create a program from scratch, especially if they haven't been doing that a lot at a previous job.  It's easy to get rusty in certain areas especially if you've been working a repetitive job that doesn't fully exercise your skill set.  But the comment that the place must be doing something wrong to get so many of those coders in the door is probably correct too, to a point.  They may just highly publicize their openings and get mostly responses from those coders who couldn't get a referral from a previous employer, contractor, coworker, etc.  Once you're 'in' in this industry, it shouldn't be too hard to find followup jobs unless you're a complete social failure.  Getting that first one out of college can be tough though, and interviewing college grads can be a pain in the arse, especially with the turmoil in the CS education field.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: castor on March 02, 2010, 03:34:39 pm
One of the failures within CS etc programs is that students are often given assignments like: write a program that does X. What they should be given is a large, more or less messy code base where they need to implement a new feature X. That's what most of them will be doing anyway, once hired by a company.

Actually, it would be good if students would be working with the one and same code base the whole period of their studies. And at the end the whole of the code is evaluated: how well it works, did the code become more messy or more readable in the process etc. That would teach students to give the necessary "love" to their code from the beginning.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: chief1983 on March 02, 2010, 04:05:17 pm
Uhm, sure.  Dunno if that's really necessary.  And real CS programs aren't about that, those are the dull ones I was talking about.  Real CS has things like machine state theory, algorithm design, etc where you actually don't need to write any code at all.  But that's how you get students who _can't_ write any actual code, they never had to take any software production classes.  Just theory.  You either pick it up in your spare time then, likely leading to the hack it together style of code (my favorite), or you end up unable to find a job because you can't remember what C #includes you need for printf() in the middle of an interview.

Students going into the industry to write code, and not do research, at the very least need to be stressed to take industry courses.  Principles of Software Design, Software Quality Assurance, design patterns, etc are all things a student should be utilizing during their education, not just reading about.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: FUBAR-BDHR on March 02, 2010, 05:51:29 pm
I've said it before and I'll say it again:  We need to scrap the whole college system and go to apprenticeships.  The only way you truly learn is by doing.  What they teach you in college is either theory that doesn't apply to the real world or already so outdated by the time you get a job you are years behind what industry is using.  This applies to everything not just CS. 
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Nuke on March 02, 2010, 06:32:14 pm
i realized shortly after getting my 2 year degree that education was a scam. anyone can teach themselves anything in their spare time and end up having better mastery that someone who went to school for 4 years to do the same thing.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: chief1983 on March 03, 2010, 09:52:39 am
How are you going to pick up the things like the complicated math, etc during an apprenticeship?  That's what internships are for.  Maybe at least one year of real life experience should be required before you get your degree.  Engineering fields are already set up similarly to this.  You go to college, pass your FE (Fundamentals of Engineering) exam, and then you're an EIT (Engineer-in-Training).  You have to serve at an accredited firm for several years before you can be considered for your PE (Professional Engineer).  Computer Science doesn't have anything like this.  But getting rid of college isn't the answer, we need a better system for post-college experience, and we need to define the various fields with Computer Science better.  I still think Software Engineering needs to be an accredited engineering discipline, the groundwork for engineering in general is already there so you just need to decide what needs to be learned before you get out into the real world.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Sushi on March 03, 2010, 10:12:54 am
There needs to be a split in the field, for those interested in theory (who really don't even write a lot of code) and those who want to do nothing but utilize existing principles to design and create a quality product (if only there was a term for people who do that...). 

A term like Engineers? :p

The problem is, where exactly do you make that split? I happen to think that the CS program at my university strikes a pretty good balance between theory and engineering. Personally, I wouldn't have it any other way. Knowing the theory makes you a better engineer, and knowing the engineering helps you grok the theory. The theory helps you innovate, and the engineering helps you execute. I've chosen a track that is a bit heavier on the theory side, but I feel comfortable doing that because I've had some good work experience that has given me a chance to learn a lot of the engineering principles in a hands-on sort of way.

Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: chief1983 on March 03, 2010, 10:17:55 am
It's not a hard split, you just simply have two curriculums with some overlap.  I'm a Comp Sci/Comp Eng myself and there's already a lot of overlap even though the Comp Eng field is much more hardware-centric.  A Comp Sci/Software Engineering setup would just simply tailor the program to better define what a student might actually be useful for.  If nothing else the unis at least need some more emphasis programs within Comp Sci.  You literally cannot tell what kind of alternative courses I took just based on my degree title from the Computer Science department.  I could have taken nothing but AI classes and graph theory and algorithm design, or I could have taken every class we had on modern software design practices and all that jazz.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Iss Mneur on March 03, 2010, 10:34:17 am
One of the failures within CS etc programs is that students are often given assignments like: write a program that does X. What they should be given is a large, more or less messy code base where they need to implement a new feature X. That's what most of them will be doing anyway, once hired by a company.

Actually, it would be good if students would be working with the one and same code base the whole period of their studies. And at the end the whole of the code is evaluated: how well it works, did the code become more messy or more readable in the process etc. That would teach students to give the necessary "love" to their code from the beginning.
I don't think giving a student a messy code base to start with is really necessary. A more useful change to the CS programs would be to force the students to work together as 2 or 3 person teams.  This will produce plenty of "bad" and "messy" code because the members will never be at exactly the same level.  As part of a team, you would learn quickly how to modify an existing code base, because while the team started from scratch it will quickly become legacy code especially if it is done over 1 or 2 years.

i realized shortly after getting my 2 year degree that education was a scam. anyone can teach themselves anything in their spare time and end up having better mastery that someone who went to school for 4 years to do the same thing.
Maybe.  The thing about Colleges and Universities (at least good ones) is they will force you to be exposed to several languages, paradigms, and theories whereas the self taught programmer is very likely to be a one trick pony.  That is, they will only know how to code and not do anything else.

The other thing that seems to be missed here is that Colleges and Universities are not in the business of giving people job skills, they are in the business of providing the knowledge and theory about a job field. In this way a Bachelor of Science in Computer Science is no different than a Bachelor of Science in Chemistry.  With the Chemistry degree you would not be expected to start providing chemical analysis of some factories output without on the job training or previous (on the side maybe) experience doing the same thing.

Sushi's and chief1983's replies while I was typing this post also reflect a far more fundamental problem with the entire Computing Science/Computer Science field.  There is nobody to control what a degree title entails, unlike engineering which has a governing body and, at least in Canada and (I think) the USA, the term engineer has a protected status, which is where the terms "Software Engineering" and "Software Engineer" gets into trouble.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: jr2 on March 03, 2010, 02:02:48 pm
I've said it before and I'll say it again:  We need to scrap the whole college system and go to apprenticeships.  The only way you truly learn is by doing.  What they teach you in college is either theory that doesn't apply to the real world or already so outdated by the time you get a job you are years behind what industry is using.  This applies to everything not just CS.  

i realized shortly after getting my 2 year degree that education was a scam. anyone can teach themselves anything in their spare time and end up having better mastery that someone who went to school for 4 years to do the same thing.

:nod:

EDIT: Which is not to say nothing can be gained by the classroom education.  It's just it's lifeless without practical application.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: chief1983 on March 03, 2010, 02:11:37 pm
Engineer is generally discouraged from use in the states unless it is an actual engineering job, but some states like Texas do go so far as to protect it.  But my last job title in Missouri was "Software Engineer".  I *****ed at my boss about it, as he should have known better having gone to the same engineering school I went to.

IssMneur, that's kind of what I've been getting at too.  The IEEE has been trying to reign it in and create a true Software Engineering discipline but it's been going awfully slow from what I can tell.  Plus, it shouldn't even be under their umbrella I don't think.  ACM would be the ideal choice but I don't really know how those societies all work to a great extent.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: castor on March 03, 2010, 02:57:00 pm
I don't think giving a student a messy code base to start with is really necessary. A more useful change to the CS programs would be to force the students to work together as 2 or 3 person teams.  This will produce plenty of "bad" and "messy" code because the members will never be at exactly the same level.
Well, if large code bases that aren't messy exist. :D
Anyway, it needs to be big enough, so that students can't simply "rewrite by will" everything that doesn't fit their way of looking at things.
It needs to be a struggle, they need to learn how to be productive with code they have limited control of, which looks like nothing textbooks would ever teach. They need to be forced to look for second, third and fourth solution to the problem, and learn to know when to be satisfied with what they got.

Instead of writing code that is bound to collapse under it's own weight, write something that at least has a fighting chance to survive. Many, many programmers don't even realize the difference between the two.
 

Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: chief1983 on March 03, 2010, 03:45:21 pm
I don't think it's something to spend 4 years on, but maybe a semester or two.  Although that tends to be what the internship stuff is for.  You'll probably end up dealing with something like that at your first job anyway, and that's the point.  College isn't for that kind of stuff.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Mika on March 03, 2010, 04:19:07 pm
If my observations of CS students are correct, the most likely thing that will happen if team work is forced on the courses is that the one guy who can program does all the work for everybody in his group. This has actually happened to my friends (Theoretical Physics) learning courses in Computer Sciences. They were quite pissed about it, as they realized that the rest of the fifth year CS students didn't know any programming language.

By the way, our department (Physics) actually had a course in Electronics, Processors, Assembly and computers. It was interesting to decipher what's going on in the data bus when using 8086. See all those instructions turn to ones and zeros and seeing the replies by all components, using oscilloscopes and logic analyzers. However, attempting to decipher anything newer than a 80286 is going to give a headache, as the bus traffic might not happen in the sequence listed in the Assembly code... 

In the hindsight, it was one of the best extra curriculum courses I took in the University. Highly recommended for CS students and programmers.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Mongoose on March 03, 2010, 04:27:08 pm
I know that the assembly class I took as part of my language and/or CS requirement for physics was something I found incredibly useful, even if we wound up having to change professors halfway through.  It taught me far more about how computers actually function than I'd ever learned elsewhere.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: chief1983 on March 03, 2010, 05:14:37 pm
Any computer engineering degree will cover that stuff, I dual majored with both.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: spaceranger on March 03, 2010, 06:14:10 pm
I wonder if I'm a special case (I'm sure my mom would agree!  but she doesn't frequent this forum .. that I know of).

I have 10+ years of systems and network engineering experience architecting and leading enterprise scale/class web application projects (i.e. platforms generating millions of dollars of revenue for my company).  I've had to lead teams of programmers, DBAs, network and systems engineers to build application platforms from conception to implementation and support (and BEYOND!  lol).

I've been teaching myself C and C++ for fun, and to build out my skill set professionally.  I'm not a high school grad coming into IT cold, I've had to wrangle teams of developers, DBAs and network/systems engineers into A) talking to each other  :hopping: B) figuring out WTF we're going to do and in what order  :beamz: C) keeping anyone from shooting themselves (and the rest of us) in the a** because they've got their "my stuff" blinders on and the whips of the biz at their backs and D) making certain that everything works as it's supposed to.    :nervous:

My background gives me a perspective that I don't think many college grads have.  I understand the stuff that programs run on, I read network traces de rigeur.   I've compiled BIND daemons for DNS server builds.  I've seen, firsthand, MANY times how bad design can drop a platform into the mud and leave it kicking weakly for help.

And I've forgotten at least 10 times as much as I currently know (as in: know off the top of my head).  But I have a strong grasp of fundamental IT concepts and relationships, and am very successful at finding out anything I don't already know.  I've worked out the orbital elements of a 15 body solar system for fun (masses, densities, orbital elements, etc.).

Can I be an effective programmer w/o college?  I think so.  I'm currently studying function templates and classes.  The hardest concepts to grasp so far have been understanding the complexities of using overloaded operators with various data types, honestly.  There's so many ways to evaluate data.

Interesting discussion!  :yes:

Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: chief1983 on March 03, 2010, 06:57:47 pm
No one said you can't.  And there's been many a watercooler argument between your so-called 'white collar' CS grads and 'blue collar' self-taught programmers about which is 'better'.  I wouldn't say either is, but to say that a college education offers no benefits is just not true.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: spaceranger on March 03, 2010, 07:01:36 pm
Agree.  Education is experience, so any experience vs. education arguments are essentially moot, imo.  I suppose my reply may have sounded defensive or accusatory, not the intention at all.  I was throwing out a case study of sorts for dicussion, really.  Cheers.

EDIT: More useful to discussion perhaps:  what could a self-taught programmer (like me specifically, or generally, w/e) be missing or lacking vis-a-vis a college CS degree?  I'm sincerely curious!
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: chief1983 on March 03, 2010, 10:40:36 pm
Breadth of study typically.  As was stated, self taught programmers tend to have a narrow focus, not a guarantee to be avoided in college but perhaps less common in a good program.  It depends on how thoroughly self taught you are, and that's at least what a degree is supposed to say.  A student is at least _this_ educated.  Depends on the reputation of the school.  Of course, any self-taught programmer worth his salt can probably impress an employer in an interview just as well if not better than a student, but I think it's easier to get a leg up on the job market out of college than out of high school, if you didn't already have an 'in' to the industry.

There's probably a lot of self-taught developers out there who aren't familiar with things like Scrum, agile development, pair programming, code refactoring, ORM, MVC, etc.  But I'm sure there's some that are, so like I said it depends on the quality of your own education.  You can't get a degree at my school without at least a minimal exposure to those however, and some classes require utilization of some of those practices in the capstone or other high level team development courses.  Self-taught programmers are also, from my experience, less likely to have spent much time working in teams, but again that's not always the case.

My friend Andrew though is an amazing sys admin, who can also code very capably, and never went to college.  There's a few industry-type subjects I know a bit about that he hasn't been exposed to but by and large he's a hell of an employee.  He's probably going to work for Facebook in the near future.  But he didn't work on a team of devs until 6 months ago, and he's 26 years old now, been working for the last 8.  He was always a one man show, doing sys admin, web development, the whole works for small companies.  But he's been doing great on a team too.  A lot of your lone coders aren't like that.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: spaceranger on March 03, 2010, 11:37:41 pm
Gotcha, I see your points.  Education implies some certainty of a programmer's breadth of assumed knowledge.  They'd have to learn the more soft/social aspects of working in a dev shop on the job like everyone else, sure, but a coder who comes out of hacking mods in high school could be really caught off guard on all those fronts, as well as only being really good at, say, programming object physics for maps in a particular engine (where they may not even have to work with anyone else on the project more than peripherally).

A college curriculum forces one to study more than they might want to learn.  A coder could come by that philosophy through their own discipline, but that's iffy.  I remember when I first picked up playing guitar, I didn't think I'd have to learn all kinds of things that I wasn't interested in at the time, or that I wasn't going to "need" or use (like modes, lol), but as it turned out I ended up learning all that stuff anyway, the hard way, years after I could have got into them and developed them.  My initial narrow attitude on playing guitar held me back in the long run.

It does come down to one's background, exposure and intention.  One pitfall in structured learning that I've observed is that it can foster a "make me do it" attitude in some, versus an "I'm going to do this" attitude in the really motivated students.  A college degree doesn't necessarily ensure the greatest capability (that's up to how an individual applies themself to the curriculum) but it does ensure a certain degree of exposure, at least.  One can be metaphorically dragged through a curriculum, or one can pioneer their own course through it.

One thing about self-learning is that it's a self-filtering endeavour.  Only those motivated enough to apply themselves to the endeavour really get somewhere with it.

Cheers!
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: FUBAR-BDHR on March 04, 2010, 12:30:11 am
Well I don't know where you get the college educated people don't have a narrow focus.  When I went to school 90% of the stuff was taught on one platform using one language Pascal.  C for instance was 1/4 of one class.  The only other language that had a full class was FORTARN.  You know how much I ever used VM on a mainframe?  Never.  You know how much C and FORTRAN I've ever used?  0.  (No the FS2 source code doesn't count because it doesn't even resemble the C from back then) You know how much of anything I learnd in school I used in the workplace?  0. 

Nothing from school was practical outside in the real world.  The only useful thing I got out of college was learning how to pack the optimal amount of beer in the available fridge space.   

Now for those of you who thing all this theory and other stuff is a must then go through the apprenticeship first then when you have your time in move on to higher learning.  Also I'm not talking about just college I mean school in general.  By the time you get to 10th grade you should have a field chosen and half you school time should be working in that field. 
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Mongoose on March 04, 2010, 01:31:23 am
But who the hell knows what they want to do with their life by the time they're 16?  (Hell, my mom still says that she doesn't know what she wants to be when she grows up. :p)  Even when you get to college, the average person changes their major a few times, and the average worker ends up flat-out changing careers several times over the course of their life.  The whole point of the general education that high school provides and the breadth requirements that most degree courses require is to expose you to a number of different fields, just in case what you want to do now isn't what you want to do in a year or two.  Hell, I'm a living example: I have a B.S. in physics, but by the time I hit senior year, I seriously disliked most of my courses, and now I have no idea what I want to do with my life.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: FUBAR-BDHR on March 04, 2010, 01:52:32 am
That's one of the whole points of apprenticeships.  If you start young enough you will know if you picked the right choice and still have time to change.  I had a good idea of what I wanted to do by the time I was 12 and had already been reverse engineering programming on my Apple  ][+
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: blackhole on March 05, 2010, 09:41:47 am
Quote
But who the hell knows what they want to do with their life by the time they're 16?

The only way for people to become really and truly good at something is to 1. be innately talented at it and 2. be taught it from an extremely young age. I mean teaching math to a 2 year old and getting started with programming with an 8-10 year old. The catch, as you have pointed out here, is that no one knows what they're actually good at and what they want to do until its far too late to teach them anything. There's no point in teaching math to a 2 year old if they're actually a brilliant artist.

I started programming when I was 14 and I wish i had discovered it much, much sooner. I try to compensate by absorbing as much information as I possibly can and forcing myself to deal with increasingly complex problems, but the only reason I even knew about it in the first place was because my dad once wrote me a little program and I was absolutely fascinated about the concept of making the computer do something you wanted it to do.

College is useless because its trying to teach programmers things they should have learned 5 years ago.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: chief1983 on March 05, 2010, 10:01:49 am
Well now we're getting into a debate about primary education styles and theories.  I could go on all day about that stuff too, but since as was said, you can't tell what someone's going to do, the best you really can do is stick to the basics, and attempt to develop the core parts of the brain as much as possible.  I'm talking about promoting things like critical thinking, problem solving, but also the imagination, and artistic endeavors as well.  Skills that will simply help you slide into your field of choice with ease.  It's up to your parents to teach you the family business or something if that's what they want, when you're only 10 years old.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Sushi on March 05, 2010, 10:31:47 am
Furthermore, being awesome at "your field of choice" isn't everything. It's very much worth it to have breadth in education as well as depth: just because it doesn't directly apply to your chosen career doesn't make it a waste of time.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: blackhole on March 05, 2010, 12:16:57 pm
Furthermore, being awesome at "your field of choice" isn't everything. It's very much worth it to have breadth in education as well as depth: just because it doesn't directly apply to your chosen career doesn't make it a waste of time.

Please keep in mind this only applies to normal people (http://www.smbc-comics.com/index.php?db=comics&id=1776#comic).
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Wolfy on March 22, 2010, 02:08:49 pm
Ouch, my own programming skills aren't brilliant, but i did that Fizz Buzz thing. Took 8 minutes. (3 or 4 of those where trying to fix an error), and the code is so ugly, i refuse to show it :).

However, I might not be PEREFCT, but i seem to be a bit better than many applicants, if the quotes from the OP are to be beleived. <--- and thats just scary
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Flipside on March 24, 2010, 04:20:00 am
I do find it interesting that one of industries biggest complaints about applicants is their habit of pumping out programs without proper documentation and design notes one minute, and are then complaining that coders aren't pulling programs out of their arses the next...

Not that the code would be hard to write, but that does strike me as a bit of a double standard...
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Iss Mneur on March 24, 2010, 12:02:54 pm
I do find it interesting that one of industries biggest complaints about applicants is their habit of pumping out programs without proper documentation and design notes one minute, and are then complaining that coders aren't pulling programs out of their arses the next...

Not that the code would be hard to write, but that does strike me as a bit of a double standard...
I don't see it as a double standard. The test is not a test of programming practice, but of programming competence.  That is, this test, if passed would be followed by one that asks the applicant to write and document a data structure (like a linked list), and this would be marked on the quality of the algorithms and the accuracy of the documentation.  The ones that fail the FizzBuzz test are *not* even able to write any code at all. Even when given the algorithm!

FizzBuzz is akin to asking someone that is applying to be a Editor (for a paper or magazine) and asking them to read a question (Describe the room you are in but do not mention anything about the colours) and write their response. And in order to pass they just have to write in mediocre English and not mention any colours.  By mediocre English I mean something that is mostly coherent and recognizable as English. Spelling, proper grammar, and full sentences are not required. That is, something like the machine translators produce would be more than adequate.
Title: Re: Coding Horror: Why Can't Programmers Program?
Post by: Flipside on March 24, 2010, 03:15:13 pm
True, I suppose it's a valid test so long as it's taken into account that it is 'exam conditions', which is far from a coder at their best ;) Y'See the way I'd approach it is with booleans, fizz = (number MOD 3 = 0) buzz = (number MOD 5 = 0), that way if !fizz and !buzz, then you can get straight out of the text checking loop and just throw out the number, and, to me, it makes the code a lot easier to read, I'll agree that ought to be easy for anyone to throw out in 10 minutes, even in those kinds of conditions.