Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The difference isn't the actual print operation; it's all the boilerplate that has to go around it.

In Ruby, `puts "Hello World"` and you're done. The most you have to explain is puts and string literals.

In C#, you have to create a class with a static main method. You're then left to choose between explaining classes and methods ("what's static? what's void?"), or skipping that and just treating them as the magic incantation for running a program. Pedagogically, neither is satisfactory.

Ruby wins the Hello World simplicity contest, hands down. The question is whether the long-term benefits of C#'s program structure are worth the increased overhead in the Hello World experience.



I think a huge plus for Ruby is the limited amount of specific punctuation required for calls like this. For you average middle or high school student this might not be a big deal, but as soon as you start working with elementary school students every small barrier to entry is a huge deal.

Books like this shouldn't be designed for the children that would enjoy hunting through and finding the missing quotation mark - those children already have tons of resources out there for them. I think Ruby is a great choice, specifically for this reason, and I wish there were more resources like this available when I was setting up K-5 CS curricula a few years ago.


You don't have to create a class with a static method if you use LinqPad which can run like a REPL. It can also pickup a file with that single line in it and execute it, so there is virtually no difference.


That's too many hoops for a child learning programming to jump through. There is a real difference in simplicity between Ruby and C#.


Installing a program is not too many hoops. You have to setup a computer for ruby too and the kids aren't doing that part.


If I'm on a Mac there is no setup; Ruby is pre-installed. Also, if they are just starting out and they don't want to keep things around there is tryruby.org.

For kids using Windows I usually have them sign up for a free account on Cloud 9; again virtually no setup required.

Also, now you are trying to compare LINQPad, a tool, to just using a language?

In your example you used `Console.WriteLine("Hello World")`, excuse me if I'm wrong since I don't write much C# anymore, but isn't that an invalid statement? I'm pretty sure that's missing a semi-colon at the end. Try explaining that to an 8 year old; because that's the age of kids I start working with.

10.times do

  puts "Hello World"
end

That is just easier to explain to a YOUNG child than the following

// Sorry: Using Java here since I don't do much C#, but I think we're in the same ballpark

public class HelloWorld {

  public static void main(String[] args) {

    for(int i=0; i<10; i++){

      System.out.println("Hello World");

    }

  }
}

None of what I said was an insult against any language; it was based on my experiences trying to teach programming to elementary aged kids (8 to 11 year olds).


The kids could also not have Macs and there are similar services for running C# online, so those reasons don't hold any water with me.

What you're argument boils down to is that `10.times.do` is better than `for(int i=0; i<10; i++)` because all things being equal, that's the real difference. You could argue against braces, but the I could also argue against the lack of braces. So the real difference is how you write the controlling section of the for loop.

Now on that point alone, I'd say that `10.times.do` is certainly easier to parse, but easier is not better. Why teach them a bad habit? Learning `for(int i=0; i<10; i++)` is actually better for kids since it hides less and it is actually much more useful in the real world since that's how the most widely used languages do it. Or, are you one of those adults who thinks that hiding the real world from kids is a good idea?

I guess you could also say that there is a reason we make things slightly easier for beginners of any age. Like having training wheels. But that is so you don't get hurt and the computer is not going to hurt anyone if the program doesn't compile. I also honestly don't think age matters here after they've been through the second grade.

EDIT: Also, yes, you can leave the semi-colon off in a LinqPad expression. But I also don't see a problem with explaining what a semi-colon is to a second or third grader, in the context of programming. I could also say "good luck explaining those oddly placed periods to those same kids" and it would make as much sense.


> Learning `for(int i=0; i<10; i++)` is actually better for kids since it hides less and it is actually much more useful in the real world since that's how the most widely used languages do it.

C-style for loops are useful, though I think the historical window (that started with the dominance of C) where the most popular languages lack a direct and succinct way of expressing simple do-it-n-times iteration is closing.

Ruby's particular form may be different than others, but lots of current languages have succinct, direct methods for expressing the same thing. By the time a young child learning to code today is a professional programmer, having nothing better than C-style general for loops to express that common idiom will probably be unusual in non-legacy languages.


Ruby offers an abstraction that other languages don't. That doesn't mean that using the abstraction is a bad habit.

I agree that C-style for-loops can be handy, but the prevalence of this shorthand doesn't make it good pedagogy to skip right to it. Not everybody is ever gonna enter the real world of programming, and not all of those people are going to use languages with C-style for-loops, and, even then, for-loops aren't fundamental; they're just a shorthand.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: