Earlier quoted context omitted.
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#.
Hello Ruby – Almost there
81–90 of 128 posts
Re: Hello Ruby – Almost there
#82Earlier quoted context omitted.
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...
Well, given that repeating some piece of code N times involves only two "entities", the code to be repeated and the number of repetitions, i see it as a very natural OO design decision to put that looping logic on a method on one of those two entities. The other possibility would be to make the "code" object respond to a method that tells it how many times to execute:
{ puts "Hello, alternate Ruby" }.do_times(10)
It might be more intuitive to do so if the first object you have is the code you want to repeat, but it doesn't read as nicely :P> 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...
Can you elaborate in this please? I personally think that making nil something else than an object on OO language wouldn't make much sense. It would be an unnecessary complexity to stipulate "the way we interact with objects is through message-passing, except with nil, on which you cannot pass any message, but instead you have to compare it by identity to a global value named nil". Nil being a regular object that responds to things like .to_s or .nil? is pretty handy.
Re: Hello Ruby – Almost there
#83[deleted]
Another personal datapoint — I wrote a book and funded it on Kickstarter as well (similarly named: Hello Web App) and mine was 12 months delayed. Producing a book was definitely way harder than I anticipated, esp. as I am used to the fast-turnaround times of producing something for the web. Additionally, printing alone took two months which was surprising.
I never questioned for a second my purchase of "Hello Web App", but the little girl that I bought "Hello Ruby" for is going to be almost too old for the book finally being delivered.
Re: Hello Ruby – Almost there
#84Earlier quoted context omitted.
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...
> 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). Well, given that repeating some piece of code N times involves only two "entities", the code to be repeated and the number of repetitions, i see it as a very natural OO design decision to put that looping logic on a method on one of those two entities. The other possibility would be to make the "cod…
Ruby has a lot of these special cases where there's a gimmicky way to do something which is not the general purpose way and is not the right way to think about that kind of logic. "== nil" is just as short as ".nil?" and isn't as wacky as intentionally calling methods of nil (and every other object needing to have this nil-specific interface).
Re: Hello Ruby – Almost there
#85Earlier quoted context omitted.
It's always really disappointing for me when people see Kickstarting as a way of purchasing the end product. With economies of scale you should really expect prices to come down for retail. What you're getting for the money with a kickstarter campaign is the chance to help someone realise their product, which hopefully you believe in, without the creative inhibitions that come with strings-attached funding.
You must be disappointed a lot then? I did believe in her product. What I didn't believe in was an utter lack of regard to KS backers, poor communication, misdirections, a publishing contract with Macmillan, a late delivery (while being less than truthful with KS about it). The author bears some responsibility for changing my mind from believing in her product (what you call helping, "someone realise their product")…
1) The end product will probably be cheaper than the kickstarter backing. (You seem to agree with this, at least in general)
2) People shouldn't see backing a product as a purchase. There's clearly risk involved in any transaction where the obligation of the seller to provide anything, let alone meet your expectation of exactly how the end product will be realised.
It's sucky that you've had such a bad time with this KS though, the real value in backing ought to be the opposite of what you've experienced!
Re: Hello Ruby – Almost there
#86Earlier quoted context omitted.
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 w…
That's a big part of what helps a language like c# continuously reinforce a mental model that leads to better/easier understanding. IMO.
You can call `open` and pass it a URL in Ruby. But what does that return? What's the Type? Where do I look up documentation for it? What's available to me _right at this point in my code_?
Ruby makes copying examples a bit easier, but you have to hold a lot more in your head before you could be considered "proficient".
And then there's all kinds of caveats. You want to write an O/RM in .NET? Pick up the PoEAA. You want to do the same in Ruby? Well, one of the first things I did was write DataObjects. Because there isn't a consistent database access API for you already.
From there you want to map Rows into Objects? Be prepared to play Ruby Golf. Because your first shot will be unusably slow. Not because it's wrong. But because it turns out Ruby's performance has real world implications. So you memoize anonymous classes. You cache method handles. You run a thousand different micro-benchmarks on the performance difference between re-binding a cached method handle for a setter, or just calling instance_variable_set.
I think the complete lack of type declarations actually makes developing in Ruby much more complex. Even experience programmers can end up debating wether a breaking change between "truthy" and an actual Boolean is a good or bad thing.
With as much experience as I have in Ruby, `extend` and the self class stanza are still just weird.
Even after developing in Ruby for years I'd still run into code that was just real difficult to understand how it worked at all.
I guess what it comes down to is I'd argue declaring all your method parameters as `Object` in c# is not going to make writing working code easier. It may make compiling easier, but that's not really the goal.
It sounds like you're a fan of Pry. I never cared for it personally. I found it much less intuitive than clicking in the gutter, running my program, and being able to mouse over a variable to see it's value, or look in a panel to see the full program state at this point. For a learning tool, I feel like that's got to be light years better than the solutions I've seen in Ruby. I managed that in c# without any help at all.
As far as exploring, Types generally tell me all I need. In Scala and IntelliJ I just hit ^J. Or I'll jump to the source of a method I'm calling with COMMAND+B. Or the implementation of an interface with COMMAND+SHIFT+B. These are just things I got out of the daily tips popup.
Seeing a function called: `generateDownloadUrl: Photo => String` tells me more in less time and space than the equivalent Ruby method or lambda ever did. Because in Ruby you don't know the requirements until you read the source or documentation. Whereas in Scala (which I wouldn't actually recommend to a beginner, but the same is true in c#) you have to resort to documentation or reading the source far far less frequently. Which for me at least is a much lower cognitive load.
Because of checked exceptions, switch statements and FactoryFactoryFactories I probably wouldn't suggest Java. But I think that languages that self-document the Types at declaration points are much easier to grasp than languages that still have the types, still require an understanding of them to be proficient, but omit those declarations (like Ruby). In Ruby you basically have to memorize a large chunk of the standard library before you feel proficient. The same isn't really true for Scala, Java or c#.
It's easier to build a mental model (for me) in those languages. And that's the biggest barrier to understanding and feeling like you grok it (at least for me).
Re: Hello Ruby – Almost there
#87Earlier quoted context omitted.
> That's really messed up... No, it's a brilliant use of polymorphism. "null" in Ruby is not a value, it's like everything else an object. So it have methods. Just because you are not used to it doesn't make it messed up.
It's the wrong way to think about organization of logic. It's not a number's place to know how to do looping, it's not an object's place to know whether it's nil or not. Why would every single object have a "nil?" method? You can make it work, but it's just not good style ( and it doesn't serve the purpose of implementation efficiency or machine-sympathy, which I would give exception for). (also, special characters i…
If we consider a number as "zero or 1 plus a number", then the "Number" class could very well be the one that knows how to execute a piece of code a number times given that representation. It's actually pretty similar to the Church encoding of numbers in the lambda calculus[1].
Re: Hello Ruby – Almost there
#88Earlier quoted context omitted.
Another personal datapoint — I wrote a book and funded it on Kickstarter as well (similarly named: Hello Web App) and mine was 12 months delayed. Producing a book was definitely way harder than I anticipated, esp. as I am used to the fast-turnaround times of producing something for the web. Additionally, printing alone took two months which was surprising.
I'm not sure what the deleted post was about, but as a backer of both yours and Linda's projects there is quite a bit of difference. You did an excellent job communicating with us exactly what was going on, and why delays were happening. At the end of the campaign I received exactly what I paid for - not some excuse why I was paying an extra $20 to receive it only a month before everyone else can get it on Amazon muc…
Re: Hello Ruby – Almost there
#89Earlier quoted context omitted.
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…
> When I started Ruby, I often didn't understand why something I wrote worked. Can you remember any examples? I can't think of very much in plain Ruby that's non-obvious.
But I remember specifically using open(url), parsing some HTML, and writing out a CSV. Today there are libraries to make that trivial for an experienced Rubyist, but this was Ruby 1.8.0. FasterCSV was still just around the corner, there was no hpricot yet. And you're working with blocks right out of the gate. The little 40 line program (including whitespace) took me quite awhile. It read (what I thought was) very pretty. But I think the Ruby community tends to take for granted how big a role idiom plays in Ruby. In the early days when you didn't necessarily have access to all that, fighting your way through syntax errors trying to learn the language by referencing the pickaxe was definitely one of the bigger challenges I've faced as a programmer.
By that point I was already very proficient with c#, had written a fair about of VBScript in ASP3. But I really struggled with how opaque learning how to be productive in Ruby felt.
Re: Hello Ruby – Almost there
#90Earlier quoted context omitted.
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.
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"
endThat 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
}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).