News for hackers. Stuff that matters.
Re:Coding - the new Latin by tpatke on Monday November 28, 2011 @07:19AM (#3285557)
When I think about all of the problems with the education system I am not sure that "teaching coding" would top that list. The bottom line is that coding is a profession which is not suited to everyone. I remember being a TA at university in the late 90s when IT was booming. Everyone wanted to learn to program. Once they learned enough to realize it meant sitting in front of a computer alone all day - most moved on to something else. Few people have the concentration / (lack of :-) social aptitude. I believe most people have the intelligence.

Basic computer skills need to be taught. Coding? It should possibly be a required semester in university for all majors. ...beyond that? Does everyone really need to know about recursion?

Re:Coding - the new Latin by _delirium on Monday November 28, 2011 @07:44AM (#3285630)
One proposal, which I'm somewhat sympathetic to, that a general cognitive skill of being able to think procedurally or computationally is important in the 21st century, even if the craft of being able to program is more specialized.

Some papers on that:

http://www.bogost.com/writing/procedural_literacy.shtml

http://dm.lcc.gatech.edu/~mateas/publications/MateasOTH2005....

http://www.cs.cmu.edu/afs/cs/usr/wing/www/publications/Wing0...

Re:Coding - the new Latin by bad_user on Monday November 28, 2011 @08:17AM (#3285701)

     Does everyone really need to know about recursion?
Does everyone really need to know the basics of calculus? Or how about genetics? Does everyone really need to know French? I had classes for the above in my high-school. In fact I can't think of any class I took in high-school that isn't useless to a large portion of high-school graduates.

And I can't think of many examples that are more useful than grasping the concept of recursion.

Re:Coding - the new Latin by jseliger on Monday November 28, 2011 @11:52AM (#3286573)
I think everyone needs to be at least introduced to those fields so they have some shot of figuring out what they might like while learning something that might serve them. Also, if you replace "calculus" with "statistics" and "French" with "English," I would say yes.
Re:Coding - the new Latin by bad_user on Monday November 28, 2011 @02:51PM (#3287315)
You're not dissagreeing with me here.
Re:Coding - the new Latin by jlind on Monday November 28, 2011 @08:50AM (#3285814)
Maybe they do, or maybe they don't. In many cases, I'd argue that it's more about teaching how to think and learn, rather than "an understanding calculus will be required for everything you do in the rest of school / career / life"
Re:Coding - the new Latin by bad_user on Monday November 28, 2011 @08:59AM (#3285848)
Well, if judging from that perspective, I don't think how anyone can argue against teaching programming in high-school.
Re:Coding - the new Latin by sethg on Monday November 28, 2011 @12:10PM (#3286646)
Remember that a lot of people who don’t code as a profession end up doing it as part of their work (just as a lot of people who do not have “writer” in their job titles, and who didn’t major in English, end up doing a lot of writing for their jobs).

One of the most horrifying pieces of Perl I had to work on was written by a biologist who knew just enough Perl to translate certain information from File Format A to File Format B. Or at least, he thought he knew just enough Perl....

A lot of businesses depend on complicated Excel spreadsheets whose authors don’t realize that they are programming.

Re:Coding - the new Latin by Jach on Monday November 28, 2011 @07:34AM (#3285605)
> Does everyone really need to know about recursion?

Yes, and I'd argue indirection as well. If you teach coding without recursion, you're just teaching basic logic coupled with arithmetic, we have classes for that already. (As an aside, I think iteration should be introduced as a special case to recursion.)

Re:Coding - the new Latin by Jun8 on Monday November 28, 2011 @12:52PM (#3286822)
The answer to your question is a very easy YES! Think about it: isn't your question isomorphic to "do all students need high school algebra", "if you're not become a historian do you still needs to know all those details from the history class" and countless others. Some of these questions do have merit (how many among the HN crowd remembers or cares about how photosynthesis works or sin^2 + cos^2 = 1) bu they miss the point: those topics are there to open your brain to ideas, mental weigh lifting if you will. In this sense you most definitely need to teach recursion and coding concepts.

Coding (especially for high schoolers) doesn't have to be "sitting in front of a computer alone all day", in fact if this is how it's presented that's totally the wrong approach. That comes in the pro stage. At he early stage you have to stress the creative and social aspects of coding.

Re:Coding - the new Latin by tapertaper on Monday November 28, 2011 @08:49AM (#3285812)
Everyone who spends their day on a computer would get a productivity boost if they learned to code.
Re:Coding - the new Latin by derleth on Monday November 28, 2011 @09:16AM (#3285908)
Everyone who spends at least part of their day interacting with programmable devices would have their lives improved if they learned to code.

Now... how many people in the industrialized world don't spend at least part of their day interacting with programmable devices?

Re:Coding - the new Latin by randomdata on Monday November 28, 2011 @09:39AM (#3286008)
> Does everyone really need to know about recursion?

Recursion is taught in gym class through the game of dodgeball. Consider the following C-like pseudocode:

    void throw(int *ball, int hits)
    {
        if (hits < NUMBER_OF_PLAYERS)
            throw(ball + angle(), hits + *ball);
        else
            return;
    }
The question then becomes, do people need to learn specific computer languages, or is teaching the underlying concepts in abstract ways enough?
Re:Coding - the new Latin by wcarss on Monday November 28, 2011 @11:41AM (#3286532)
Edit: I began writing this before a different post appeared with the same point. Alas!

I'm sorry to be a jerk, but I found your code pretty tough to decipher. Here's my thought process:

  NUMBER_OF_PLAYERS could be, say, 6.
  the caller calls: throw(ball, 0);
  0 < 6, so throw(ball+angle(), 0+dereference(ball));
So, what is ball? It's either an integer and you're just passing its address around for no particular reason, or it's an integer array and you're using angle() to move around inside the array somehow? Then what exactly is stored in that array, the positions of people? Let's imagine it's 1s and 0s to denote a person or not.

After making that leap of logic, your code starts to make sense. You're adding "some amount" to the address, and then whatever is at that address (1 for hit, 0 for nothing) to hits, and passing them into the next invocation, as long as it's less than the necessary number of hits. Could easily be a while loop, but I'll get to that in a minute. I have some other points:

  - Ball isn't a great name for the list of the positions of the players.
  - It isn't clear that ball is an array.
  - There's a pointless 'else return'.
  - You never address the "I don't have a ball" situation!
This code requires explanations of arrays, pointers, and addresses before you can talk about recursion. I'd express how to play dodgeball to a new programmer as follows:

  throw(angle, enemy_positions):
    # This function takes an angle and a list of
    # the spots where other people are, removing 
    # them from their spot if it registers a hit.
    # Returns true if it's a hit, false if a miss.

  find_ball():
    # Tries to find a ball; returns the number
    # which you found -- 0, 1, or 2.

  load_enemy_team():
    # Returns a list of the spots where other players are

  enemy_positions = load_enemy_team()
  players_on_other_team = enemy_positions.length()
  ball_count = 0 # all balls start in the middle!

  while players_on_other_team > 0:
    if ball_count > 0:
      angle = get_throw_angle() # user inputs this
      hit = throw(angle, team_positions)

      if hit:
        shout("Yahoo!")
        players_on_other_team -= 1 # they're down a guy!
    else:
      ball_count += find_ball() # reload
That should cover it - though I'm sure there's problems with my code too. :)

The biggest point I want to make is that this example is trivially easy to represent without recursion. While recursion can be used in place of any loop, a non-programmer's mind will likely arrive at iteration first for tail-recursive examples. And once someone understands how to solve a problem one way, teaching them a totally different way can be tough.

I personally think people do pretty well at understanding how recursion applies with respect to exploring a maze, which is almost as universal an experience as dodgeball.

Re:Coding - the new Latin by randomdata on Monday November 28, 2011 @11:59AM (#3286607)
> Ball is a terrible name for the list of the positions of the players.

From a code maintainability point of view, yes. I would never write code like this for a real application. However, for analogizing the game in code, I have to strongly disagree.

Ball is not a list of players. It is, just as in the game, a pointer to a location in space. Players may or may not occupy that space. If the player does, a hit occurs. The hit test is based on the intersection of the location in space and the occupation of that space.

I chose to represent my code in a C-like manner because it makes that spacial representation easy to write. People are not thinking about the game in terms of lists and objects, that I am sure.

Re:Coding - the new Latin by sethg on Monday November 28, 2011 @12:03PM (#3286622)
I thought recursion was taught in music class, through the song about the old lady who swallowed a fly.
Re:Coding - the new Latin by Bostwick on Monday November 28, 2011 @10:52AM (#3286327)
I would argue that dodgeball is better expressed as an iterative algorithm. Consider the following pseudocode:

  def dodgeball(players, balls)
    until players.all? { |p| p.is_hit? }
      throw(nearest_ball(balls), nearest_player(players))
    end
  end
Most people think like this. Dodgeball teaches while loops, not recursion.
Re:Coding - the new Latin by marshallp on Monday November 28, 2011 @10:52AM (#3286328)
That kind of attitude (i can/could program but it's boring sitting alone) will change soon enough when you can't feed yourself unless you program all day. The only debate is in how soon that occurs.