Linux Journal article on Ruby

P

Phil Tomson

http://www.linuxjournal.com/article/8356 it's always nice to see another=
=20
article. lwn picked this up as well, so maybe it will get some eyes.
--=20
thanks,
-pate

Nice intro article, though it repeats a common misconception:

"Ruby was designed to be an "object-oriented scripting language", and it
indeed feels like a cross between Perl and Smalltalk. It assumes that you
understand object-oriented programming and probably is not a good first
language for someone to learn."

Why is it that people have the idea the ojects are difficult for
programming newbies? Wasn't Smalltalk intended as a tool for teaching
children to program?

Phil
 
K

Kero

http://www.linuxjournal.com/article/8356 it's always nice to see another=
Nice intro article, though it repeats a common misconception:

and it uses print "\n" and some other non-niceties.
I'm not very much impressed.

The good thing, though, is that the article is enthousiastic and
repeatedly claiming it's such short code.
"Ruby was designed to be an "object-oriented scripting language", and it
indeed feels like a cross between Perl and Smalltalk. It assumes that you
understand object-oriented programming and probably is not a good first
language for someone to learn."

like, where's the object in
puts "Hello, world!"
?
it is there, but you don't see it. You only see scripting (for some
definition of scripting). Sometimes you see only OO.
Why is it that people have the idea the ojects are difficult for
programming newbies? Wasn't Smalltalk intended as a tool for teaching
children to program?

Because many ppl learned OO *after* learning some imperative language?
Which means they had to adapt their mind, instead of using an unspoiled
brain.

We (CS dept) once introduced some secondary school students to programming,
with Gofer; they were running code within minutes. Try that with Pascal or
C. Which made me wondering why on earth we once started with Pascal,
ourselves...

Ruby can do that, too, with irb.
Then after a short while tell them `ruby script.rb` is easier for
somewhat larger stuff and they'll be fine.

Starting with Ruby might make people unable to bear certain other languages.
Which is a Good Thing, in a way :)

+--- Kero ------------------------- kero@chello@nl ---+
| all the meaningless and empty words I spoke |
| Promises -- The Cranberries |
+--- M38c --- http://members.chello.nl/k.vangelder ---+
 
T

Tristan Knowles

--- Kero said:
=20
Because many ppl learned OO *after* learning some
imperative language?
Which means they had to adapt their mind, instead of
using an unspoiled
brain.

I always read this on this message board, but must
confess that being a programming and Ruby beginner,
i'm still not 100% regarding the true meaning of OO.

How Ruby OO is different from any other OO?




=09
=09
=09
___________________________________________________________=20
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voic=
email http://uk.messenger.yahoo.com
 
K

Kero

Why is it that people have the idea the ojects are
I always read this on this message board, but must
confess that being a programming and Ruby beginner,
i'm still not 100% regarding the true meaning of OO.

OO provides a means of abstraction based on inheritance of
functionality. Sometimes you change the implementation, sometimes you
add functionality in a subclass.

The assumption is that you will have many alike objects that will do the
same or similar things.

[I'm sure ppl have other definitions or even plainly disagree with what
I wrote down here, I'm perfectly fine with that, see last remark of this
posting, too!]

If the abstraction is not available in the language, you can still
program OO, but it will be more verbose. We were taught to program in
Abstract Data Types in Pascal (back in 1992), basically put a record and
the functions that work on it in one file. a subclass would be
`cp from.p to.p`
and adding the functionality. more verbose, maintenance nightmare.
How Ruby OO is different from any other OO?

If it is different, knowing OO does not help when learning Ruby :)

And maybe it is. Since everything is an Object in Ruby and Smalltalk,
this has influence on how libraries _can_ be built (and are).

C++ offers templates and MI (with certain 'issues'...)

Self does not have the concept of a class.

So, depending on which OO you learned first, it may be about one thing
or another.

+--- Kero ------------------------- kero@chello@nl ---+
| all the meaningless and empty words I spoke |
| Promises -- The Cranberries |
+--- M38c --- http://members.chello.nl/k.vangelder ---+
 
J

Joost Diepenmaat

I always read this on this message board, but must
confess that being a programming and Ruby beginner,
i'm still not 100% regarding the true meaning of OO.

My take (but since I was programming long before I knew OO, this might
not be at all what you want to know):

"pure" Object Oriented programming languages assume that all
data is stored in an object, and all behaviour is somehow implemented
by calling methods on (or sending messages to, call it what you want)
an object.

an object in its basic form is then just a set of data (properties)
and methods. It's generally considered useful to keep the data internal
to the object, and only allow "outside" access to that data via methods.

What makes OO interesting is polymorphism: 2 objects that somehow support
a shared interface (one or more method signatures) can be interchanged
in the code to allow different behaviour by only passing a different
object. The code interfacing with that object does not need to know what
the difference is.

A very simple example:

class Printer
def initialize( stream )
@stream = stream
end

def print_content()
puts @stream.read
# note that puts is a method of the Printer object, since puts is
# pulled in from Kernel via Object
end

# ... do more interesting things here
end

This code can print from any object as long as that object implements
a read() method.

OO *can* also help software design, as it tends to lead to fairly
natural divisions in responsibility - in the Printer example above, I
could have added methods for retrieving data via HTTP, or shared memory
etc, but since those actions don't have anything to do with the printing
action, they're better implemented somewhere else (in the stream object,
in this case). But OO design is no guarantee of good design, and it
takes a lot of time to learn how to do OO "right" in complex systems.
How Ruby OO is different from any other OO?

* Ruby is just another interpretation of OO - most languages differ in
their implementation.

* Alhough in ruby's, everything is an object, the syntax has a lot of
shortcuts for constructs that would be annoying to type and difficult
to read in a "pure" OO way.

* In Ruby, the only way to access properties from outside the object is
via methods. A lot of other languages allow methods of some object to
directly access (some) properties of another object.

* Ruby does not have an explicit way of stating interfaces: all objects
that have a useful implementation of the required methods can be used
polymorphically, unless you explicitly check for "type". Most dynamic
languages I know that support OO techniques do the same. Most statically
typed languages require you to explicitly state the interface one way
or the other (in java's you can use the interface keyword, in C++ you need
multiple inheritance).

* Explicitly supporting modules / mixins is fairly unique (as far as I
know)

* Ruby is flexible in modifying objects / classes / inheritance *and* it
makes that flexibility explicit.

* Like most languages, Ruby has a class-based object system (though more
flexible than most, see above). For another interesting implementation of
OO, see the protype-based javascript / ecmascript language (it's more
flexible in some ways, but you need to overcome the annoyingly C-like syntax)

Joost.
 
J

James Britt

Tristan said:
I always read this on this message board, but must
confess that being a programming and Ruby beginner,
i'm still not 100% regarding the true meaning of OO.

There is an interesting overview here:

http://www.paulgraham.com/reesoo.html

James

--

http://www.ruby-doc.org - The Ruby Documentation Site
http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys
 
D

David Vallner

Phil said:
Why is it that people have the idea the ojects are difficult for
programming newbies? Wasn't Smalltalk intended as a tool for teaching
children to program?
Hmm, wasn't that Squeak? I'm pretty much certain Smalltalk was intended
as a "normal"
programming language.

The objects being hard idea is indeed a very unfounded one. I'm sitting
next to a children's
programming summer day camp in the office, and there's quite a few 12
year olds that can
hack Game Maker stuff better than I could ever do anything that required
graphics. I'm
also plotting on tainting my 11 year old sister's soul with Ruby, so
I'll see where that leads.

David
(a poor likkle newbie if there ever was one)
 
P

Phil Tomson

Hmm, wasn't that Squeak? I'm pretty much certain Smalltalk was intended
as a "normal"
programming language.


Squeak is a more recent incarnation of Smalltalk with graphics.

Here are some quotes that seem to support the idea that Alan Kay had
children in mind when he created Smalltalk:

"After writing a thesis about graphical object-orientation and being
awarded a Ph.D. at the University of Utah he spent two years teaching at
the Stanford Artificial Intelligence Laboratory. While there he began
thinking about a book-sized computer that the user, especially children,
could use in place of paper. He dubbed his project "KiddieKomp." It was at
this time that he also began work on the Smalltalk language.

Smalltalk was designed to mimic Kay's biological model of individual
entities, or "cells," communicating with each other via messages.
Eventually his Smalltalk language would father the genre of Objected
Oriented Programming languages.

In 1972 Kay took a job at Xerox's Palo Alto Research Center (Xerox PARC)
and began using Smalltalk in an educational context. Young children were
exposed to computers and their reactions were analyzed. Kay concluded that
children learned more through images and sounds than through plain text
and, along with other researchers at PARC, Kay developed a simple computer
system which made heavy use of graphics and animation. Some of the
children became very adept at using this system; in fact, some developed
complicated programs of their own with it! (3) "

from:
http://ei.cs.vt.edu/~history/GASCH.KAY.HTML


Phil
 
A

Ara.T.Howard

Squeak is a more recent incarnation of Smalltalk with graphics.

Here are some quotes that seem to support the idea that Alan Kay had
children in mind when he created Smalltalk:

"After writing a thesis about graphical object-orientation and being
awarded a Ph.D. at the University of Utah he spent two years teaching at
the Stanford Artificial Intelligence Laboratory. While there he began
thinking about a book-sized computer that the user, especially children,
could use in place of paper. He dubbed his project "KiddieKomp." It was at
this time that he also began work on the Smalltalk language.

Smalltalk was designed to mimic Kay's biological model of individual
entities, or "cells," communicating with each other via messages.
Eventually his Smalltalk language would father the genre of Objected
Oriented Programming languages.

In 1972 Kay took a job at Xerox's Palo Alto Research Center (Xerox PARC)
and began using Smalltalk in an educational context. Young children were
exposed to computers and their reactions were analyzed. Kay concluded that
children learned more through images and sounds than through plain text
and, along with other researchers at PARC, Kay developed a simple computer
system which made heavy use of graphics and animation. Some of the
children became very adept at using this system; in fact, some developed
complicated programs of their own with it! (3) "

from:
http://ei.cs.vt.edu/~history/GASCH.KAY.HTML

Phil

interesting. there is an article about how 'dual representations'
(understanding that a symbol is both on object itself and a simulacrum of
another thing) hinders learning in children in scientific american this month.
the article implies that teaching children, for example, how to do arithmetic,
with blocks instead of numbers on paper is actually counter productive. this
seems to be at direct odds with kay's observations... wonder why?

cheers.

-a
--
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| My religion is very simple. My religion is kindness.
| --Tenzin Gyatso
===============================================================================
 
T

Trey Campbell

Squeak is a more recent incarnation of Smalltalk with graphics.

Here are some quotes that seem to support the idea that Alan Kay had
children in mind when he created Smalltalk:

"After writing a thesis about graphical object-orientation and being
awarded a Ph.D. at the University of Utah he spent two years
teaching at
the Stanford Artificial Intelligence Laboratory. While there he began
thinking about a book-sized computer that the user, especially
children,
could use in place of paper. He dubbed his project "KiddieKomp."
It was at
this time that he also began work on the Smalltalk language.

Smalltalk was designed to mimic Kay's biological model of individual
entities, or "cells," communicating with each other via messages.
Eventually his Smalltalk language would father the genre of Objected
Oriented Programming languages.

In 1972 Kay took a job at Xerox's Palo Alto Research Center (Xerox
PARC)
and began using Smalltalk in an educational context. Young
children were
exposed to computers and their reactions were analyzed. Kay
concluded that
children learned more through images and sounds than through plain
text
and, along with other researchers at PARC, Kay developed a simple
computer
system which made heavy use of graphics and animation. Some of the
children became very adept at using this system; in fact, some
developed
complicated programs of their own with it! (3) "

from:
http://ei.cs.vt.edu/~history/GASCH.KAY.HTML

Phil

interesting. there is an article about how 'dual representations'
(understanding that a symbol is both on object itself and a
simulacrum of
another thing) hinders learning in children in scientific american
this month.
the article implies that teaching children, for example, how to do
arithmetic,
with blocks instead of numbers on paper is actually counter
productive. this
seems to be at direct odds with kay's observations... wonder why?

cheers.

-a
--
======================================================================
=========
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| My religion is very simple. My religion is kindness.
| --Tenzin Gyatso
======================================================================
=========

I don't follow how the symbol for a number written on a piece of
paper is less of a dual representation that using manipulatives is.
They reported a difference in speed of problem-solving, but I didn't
see where they compared the accuracy of the work (that's usually
where the number-sense developed by working with manipulatives shows
up).

Trey
 
K

Kero

interesting. there is an article about how 'dual representations'
(understanding that a symbol is both on object itself and a simulacrum of
another thing) hinders learning in children in scientific american this month.
the article implies that teaching children, for example, how to do arithmetic,
with blocks instead of numbers on paper is actually counter productive. this
seems to be at direct odds with kay's observations... wonder why?

Define "children" in both contexts (i.e. their age).

I was tought basic numbers and computations at the age of 7;
I've heard that's way too early.

If it is, messing with abstractions, blocks and whatever won't
help, I suppose.

+--- Kero ------------------------- kero@chello@nl ---+
| all the meaningless and empty words I spoke |
| Promises -- The Cranberries |
+--- M38c --- http://members.chello.nl/k.vangelder ---+
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top