Live data from Hacker News

Hello Ruby – Almost there

blog.helloruby.com

21–30 of 128 posts

Re: Hello Ruby – Almost there

#21
post #19
post #3

Looks great. Recently, I was trying to wrap my head around eigenclass inheritance mechanisms and it was pretty tough. Not to mention the object model, where classes are also objects and the Object - Module - Class relationship. I wouldn't recommend Ruby as a first language to anyone — it may look easy at first, but to grasp it, you need to invest much more time in future.

These are the advance features. You are not required to know how inheritance works (or what the Singleton is) to write runy code. You dont have to use OO design or anything. You can write procedural code in ruby if you want. These advanced fratures are used mostly in metaprogramming. Ruby is like the guitar: easy to learn, hard to master.

Seems a shame to damage the kids learning by introducing the clusterfuck of a language such as ruby. gem install learn_a_better_language

Re: Hello Ruby – Almost there

#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 truck" approach to imports). I could go on.

Ruby isn't widely used in practice (although its users tend to be vocal and particularly prevalent in the web startup scene). Installing it requires some amount of care and technical knowledge (don't even bother installing it with a Linux package manager -- you're almost guaranteed to end up with the "wrong version" of ruby and rubygems).

I understand that Ruby programmers tend to be very emotionally invested in their programming language and that this book is probably written for Ruby programmers looking to teach their kids programming (using their favourite programming language) but it would be nice if there were well-written books aimed at a more general audience.

I'm not sure what the "best" first programming language is. JS has its merits -- it's becoming increasingly important, can be used throughout the entire stack of a web application and all you need to try it out is a modern web browser. Python is a lot more straightforward to learn and has consistent and mostly unsurprising concepts that are generally very compatible with more mainstream languages (plus it was intentionally based on a language developed for beginners). If market use were the main concern you could probably argue for Java or C# (although I think starting with a class-based language locks you into the wrong mental model).

In any case, I don't think Ruby is the best choice, even with its quirky community lore and the general emphasis on "play" and expressing yourself in code (although this seems to have died down a bit as the community matures).

I guess it depends on whether you want to teach programming as an art form and toy, or as a general skill (like maths, biology or chemistry). Both can be fun and entertaining but maybe I'm just getting old and cranky.

Re: Hello Ruby – Almost there

#23
post #3

Looks great. Recently, I was trying to wrap my head around eigenclass inheritance mechanisms and it was pretty tough. Not to mention the object model, where classes are also objects and the Object - Module - Class relationship. I wouldn't recommend Ruby as a first language to anyone — it may look easy at first, but to grasp it, you need to invest much more time in future.

Sometimes the bias you have from learning programming one way makes it more difficult to grasp concepts which are different. I recall a study[1] where they questioned whether recursion is more difficult than iteration if it is introduced first. Certainly recursion was difficult for me when I was first learning because I had done a lot of programming using iteration first. It seems surprising that it may have just bee…

Eigenclasse, had to look that up:

"A hidden class associated with each specific instance of another class." https://en.wiktionary.org/wiki/eigenclass#English

https://gist.github.com/jfarmer/2625060

Yep. Makes perfect sense that if everything is an object, and class methods belong to a class, and a that class method has to be attached to an object -- you'd need an object to attach it to...

Re: Hello Ruby – Almost there

#24
AUCTION..... AUCTION........ AUCTION.......The Nigeria Custom Auctions Is Up Again and Granting Nigerians the Privilege to Own Vehicles at Affordable Rates. Approved By The Federal Government Of Nigeria, All Individuals Should Note That These Vehicles Are Impounded Due To Smuggling And Improper Importation Which Has Resulted In The Forfeiture Of The Said Property As Penalty For The Illegal Act. Consequently, These Impounded Vehicles Are Now Being Auctioned To Eligible Nigerians In The Ongoing 2014/2015 ( N.C.S. Batch B-) Vehicle Auctions And This Action Is In Line With The Directives Of The Government Of The Federal Republic Of Nigeria. These Vehicles are neat, in a perfect condition and Has Never Been Used In Nigeria. The Vehicles Are Currently In The Custom Warehouse At Ogun State, Idiroko Border Ports Awaiting Removal By Clearance.. Contact Address: Operation 2-Enforcement Office, Idiroko BordeCommand. Contact MRS OLORUNDA GLORY ON 08068017569Name:zonal commander Public Relation

Officer, Federal operations Unit, investigation and inspectorate. Contact MRS olorunda glory 08067834923Office Mailing Address: Nigeriacustom916@gmail.com THIS CARS AND SUVS ARE VEHICLES RANGING FROM 2001 MODEL TO 2013 Prices of some Toyota

cars: Land Cruiser-N700,000 • Toyota Prado N900,000 • Toyota Corolla –N500,000 •Toyota 4Runner-N850,000• Toyota Tundra-N700,000• Toyota Tacoma-N750,000•

Toyota Camry Tiny-Light –N350,000• Toyota Camry Spider-N800,000 • Toyota Camry Muscle-N700,000• Toyota Avensis – N200,000-N500,000 • Toyota Yaris – N300,000 • Toyota Matrix – N400,000 • Toyota Camry Big Dady-N 450,000•

Toyota RAV4 SUV –N600,000 • Toyota Hilus -N750,000 • Toyota Dyna Truck – N350,000 • Toyota Hiace Bus – N600,000 •

Toyota Coaster Bus 32 seaters – N600,000 . Toyota highlander- N800,000• Toyota Sequoria-N500,000 • Toyoya sienna -- N550,000 • Toyota Avalon

-- N500,000 • Toyota Venza --N750,000

Prices of some Peugeot Cars Peugeot c230 N300,000 C300 N450,000 Peugeot-406 N500,000 prices of some Honda cars Honda Civic cars – N350,000. Honda CRV 400,000-750,000. Honda EOD 600,000. Honda DC 700,000. Honda Evil Spirit 800,000. NOTE=The nigeria custom service Recruitment and Replacement of new take is on for BATCH 1 hurry up For more enquiry call MRS OLORUNDA GLORY ON 08067834923 Thank for your patronage.

Re: Hello Ruby – Almost there

#26
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…

is for kids. I found you post quite strange. Every language has good parts or bad parts. so, because ruby does not have first-level functions is a bad languages, also because does has block is bad. The same for namespace. But let me put it this way. Are you an expert in language design and are you an expert on how children learn new stuff? Or you just don't like ruby as a language. Also, Ruby developers tend to be emotionally. Again very biased against the people that use ruby

Re: Hello Ruby – Almost there

#27
I found Python's rule of space and tab is the most confusing thing that will happen to a kid. They open a command prompt, then instead starting writing the real code, they have to , blahblah , ... to do something that they hope to run. It's a waste of time.

Re: Hello Ruby – Almost there

#28
post #23

Earlier quoted context omitted.

Sometimes the bias you have from learning programming one way makes it more difficult to grasp concepts which are different. I recall a study[1] where they questioned whether recursion is more difficult than iteration if it is introduced first. Certainly recursion was difficult for me when I was first learning because I had done a lot of programming using iteration first. It seems surprising that it may have just bee…

Eigenclasse , had to look that up: "A hidden class associated with each specific instance of another class." https://en.wiktionary.org/wiki/eigenclass#English https://gist.github.com/jfarmer/2625060 Yep. Makes perfect sense that if everything is an object, and class methods belong to a class, and a that class method has to be attached to an object -- you'd need an object to attach it to...

And in Ruby they are only "special" because they have been intentionally hidden from the publicly visible inheritance chain. Personally I think that's what makes it hardest for people to grasp.

E.g. if you define class methods on class Foo, all that's happening is that the class of the object defining Foo is no longer an instance of Class but of a subclass of Class. But it gets confusing because Foo.class still returns Class.

Re: Hello Ruby – Almost there

#29
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…

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 intro to programming. Ruby has all the building blocks needed for teaching programming.

And you're pointing namespaces but PHP has the exact same problem. Nothing prevents developpers from using namespaces in their scripts.

     #foo.rb
     module Foo
       module Bar
          def biz
            return 10
          end
       end
     end

     # main.rb
     require './foo'
     include Foo::Bar
     biz() # => 10

> don't even bother installing it with a Linux package manager -- you're almost guaranteed to end up with the "wrong version" of ruby and rubygems

Because that's not the case for Python or PHP on linux too? I bet it is,and it has nothing to do with the language itself.

> If market use were the main concern you could probably argue for Java or C#

The course isn't for CS undergrads.

Your opinion but some points aren't fair at all.

Re: Hello Ruby – Almost there

#30
post #29
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…

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…

Your example is understandable, but not the norm. Most ruby in the wild is much more esoteric (and that's what you get when googling).

>Because that's not the case for Python or PHP on linux too? I bet it is,and it has nothing to do with the language itself.

I don't know about PHP, but the Python situation is very workable. It's basically just 2 or 3, and you can write code that is portable between them, or better yet - it's not difficult to only use python 3.

Post reply on HN