Live data from Hacker News

Hello Ruby – Almost there

blog.helloruby.com

61–70 of 128 posts

Re: Hello Ruby – Almost there

#61
post #22

I'm not sure whether Ruby is a good intro to programming. It doesn't have first-level functions, instead it has blocks (which can take parameters to serve the same use as functions but aren't). What would syntactically be a reference to a method in other languages instead invokes the method with no arguments. It doesn't have namespaced imports, instead its imports effectively behave like includes (i.e. the "dump truc…

I've gotten several people into programming. I have them start with Python & Ruby. They always think Ruby is simpler and easier to understand. Why's Poignant Guide to Ruby is a great read, too.

Re: Hello Ruby – Almost there

#62

Earlier quoted context omitted.

This is a book for teaching young kids. Trying to start them off with a language like Java or C# would be a terrible idea; not because they are bad languages, but because they have such a high learning curve. With something like Ruby we can start the child right off with puts 'Hello World' Immediately they have a positive feedback cycle. At this stage they don't need to know that a top level object has been implicitl…

Sure, C# has a terrible learning curve because you'd have to type `Console.WriteLine("Hello World")` instead of `puts 'Hello World'`. `Console.WriteLine` is also totally unclear as to what it does compared to `puts`, which basically says exactly what it does. /s

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.

Re: Hello Ruby – Almost there

#63
post #22

I'm not sure whether Ruby is a good intro to programming. It doesn't have first-level functions, instead it has blocks (which can take parameters to serve the same use as functions but aren't). What would syntactically be a reference to a method in other languages instead invokes the method with no arguments. It doesn't have namespaced imports, instead its imports effectively behave like includes (i.e. the "dump truc…

oh wow. there are a couple of things here I strongly disagree with.

> Ruby isn't widely used in practice.

Rails, Chef, Puppet, Homebrew, Cocoapods, Vagrant, Jekyll... The list goes on.

> Ruby programmers tend to be very emotionally invested in their programming language.

replace Ruby with any programming language and the statement it's true. human beings just work this way.

> I'm not sure what the "best" first programming language is

This misses the point completely. There is no best first language. People think they have all the answers, when in reality the experience of each individual is unique. Anything that gets you interested in programming / lower the entry barrier is a win in my book.

Re: Hello Ruby – Almost there

#64
post #56
post #29

Earlier quoted context omitted.

Well ruby can be written in a very boring way if it's what you don't like : # nobody can say he doesn't understand that code , whatever language he is used to reducer = lambda {|res,val,array| return res+val} def reduce(array,reducer,initial) res=initial for i in 0...array.length res = reducer.call(res,array[i],array) end return res end reduce([1,2,4],reducer,0) # => 7 But there is no perfect language which is a good…

I actually found c# much easier to learn than Ruby. (I learned it before Ruby). The compiler helped a lot. It's also a lot more consistent. When I started Ruby, I often didn't understand why something I wrote worked. That's not a feeling I got very often from c#. That's just my experience. But I'd suggest c# is probably a better beginner's language. Especially paired with VS and an outstanding OOB debugging experienc…

I write Ruby for my day job (about a year and a half now) and C# for my own stuff (about ten years) and I'd go with Ruby as a pedagogical language ten times out of ten. C# is a good (not great, but good) language for building stuff you want to put in a production environment, but there's so much drag in the language that I would seriously worry about discouraging novices long before they get to the point where Ruby would bite them in the ass. C#, meanwhile, forces a novice programmer to understand types at a fairly deep level before they actually know how to make things work.

Ruby, on the other hand--well, SublimeLinter or equivalent provides detailed and well-explained warnings if Ruby code doesn't make sense or is potentially problematic. And while, IIRC, RubyMine offers a good interactive debugger if you're willing to pay for it, Pry freely offers an interactive REPL experience at any point in the codebase that, while less mousey, is IMO a better exploratory tool than you get with C#--you can't just drop into your app, at a specific breakpoint, and start whacking at things in the shell, it doesn't work. This is a huge demerit for exploratory programming. And I would gently suggest, and I'm not trying to rip on you in saying this, that it would be worth introspecting to determine whether Ruby's perceived inconsistencies were more on your preconceptions than on the language--because I felt the same way until I internalized it a little bit and went "whoa, that makes total sense, I was just looking at it backwards".

Re: Hello Ruby – Almost there

#65
post #62

Earlier quoted context omitted.

Sure, C# has a terrible learning curve because you'd have to type `Console.WriteLine("Hello World")` instead of `puts 'Hello World'`. `Console.WriteLine` is also totally unclear as to what it does compared to `puts`, which basically says exactly what it does. /s

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 in…

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.

Re: Hello Ruby – Almost there

#66
post #22

I'm not sure whether Ruby is a good intro to programming. It doesn't have first-level functions, instead it has blocks (which can take parameters to serve the same use as functions but aren't). What would syntactically be a reference to a method in other languages instead invokes the method with no arguments. It doesn't have namespaced imports, instead its imports effectively behave like includes (i.e. the "dump truc…

I'm probably in the minority here, but I think that starting with the low level - bits, data representation/interpretation, and logic (which leads to CPU operation) - is the best path to go when starting to learn programming, because it really dispels a lot of the "magic" and mystery behind computers that can confuse beginning programmers when their code doesn't work as they expect. The idea that computers are concep…

I'm sympathetic to this approach, though it's not necessarily the one I'd pick anymore. I think there's real value to understanding systems at this level, and I find that it informs my everyday work. I'm not sure, however, that it's necessarily the best way to get somebody engaged and interested. I'm sure there are personalities that dig this sort of thing (mine does) but loads of people I've worked with or taught seem to be most engaged by the fast iteration cycle of something like a REPL. Personally, that makes me lean towards teaching with Ruby or Python (probably Ruby, as I think it has more to teach). I guess it's horses-for-courses.

Re: Hello Ruby – Almost there

#67
post #22

I'm not sure whether Ruby is a good intro to programming. It doesn't have first-level functions, instead it has blocks (which can take parameters to serve the same use as functions but aren't). What would syntactically be a reference to a method in other languages instead invokes the method with no arguments. It doesn't have namespaced imports, instead its imports effectively behave like includes (i.e. the "dump truc…

As an early programmer, I love Ruby. Not just in an emotional way, but rather a practical one.

I started out wanting to learn RoR and took a step back to learn the underlying language. What I found was something that read smoothly and just. Made. Sense.

Beyond that, community support and overall tutorial quality tends to be very high, which I largely attribute to my continued usage of it.

Re: Hello Ruby – Almost there

#68
post #62

Earlier quoted context omitted.

Sure, C# has a terrible learning curve because you'd have to type `Console.WriteLine("Hello World")` instead of `puts 'Hello World'`. `Console.WriteLine` is also totally unclear as to what it does compared to `puts`, which basically says exactly what it does. /s

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 in…

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.

Re: Hello Ruby – Almost there

#69

Earlier quoted context omitted.

What i don't like about Ruby is that undefined variables can be accessed without error (just like javascript); Python is better in this regard; However pythons indentation think is not so great for teaching intro to programming. i have my own small project - the pooh language; it probably has other features which might annoy some people (downside is that it does not have all these libraries that the grown up language…

> What i don't like about Ruby is that undefined variables can be accessed without error (just like javascript) What do you mean by this? Can you give an example?

another example: > a=a => nil

but then:

> a=b NameError: undefined local variable or method `b' for main:Object

Re: Hello Ruby – Almost there

#70
post #22

I'm not sure whether Ruby is a good intro to programming. It doesn't have first-level functions, instead it has blocks (which can take parameters to serve the same use as functions but aren't). What would syntactically be a reference to a method in other languages instead invokes the method with no arguments. It doesn't have namespaced imports, instead its imports effectively behave like includes (i.e. the "dump truc…

I learned to code at age 7 with QBasic, deconstructing Gorrilas in DOS, and later SmallTalk. Both languages are horrible, but were incredibly easy to learn. No one taught me, I played with them until I learned, and back then there was no internet. There are so many aspects of Ruby that make it well suited for teaching kids about programming that go WAY, WAY beyond the ridiculous observations you've made. You might as…

To me that appears to be the strangest way to express a loop in any language I've used (and I've used a lot of them).

It also really bothers me that in ruby you can invoke a function on a null value to see if its null (myvar.nil?). That's really messed up...

Post reply on HN