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.
Hello Ruby – Almost there
21–30 of 128 posts
Re: Hello Ruby – Almost there
#22It 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
#23Looks 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…
"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
#24Officer, 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
#25Re: Hello Ruby – Almost there
#26I'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…
Re: Hello Ruby – Almost there
#27Re: Hello Ruby – Almost there
#28Earlier 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...
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
#29I'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…
# 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 rubygemsBecause 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
#30I'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…
>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.