Ruby for Highschoolers?

On Sunday 11 June 2006 7:33 pm, Timothy H. wrote:

For student just starting to learn a language, a good IDE would
help greatly.

All right, I’m listening. How would an IDE help?

Well, if you’re learning to program in Scheme and hear everyone say “Ew,
I can never figure out those damn parens,”[1] you can give them a
real IDE so that they essentially never have to worry about the parens
again (see DrScheme or vim with proper syntax highlighting and %), nor
do they need to learn how to use a more advanced editor.

Now, if you’re learning programming in Ruby, an IDE may not be as
important, but it’s probably useful to remove as many barriers to entry
as possible–you want the kids to be learning the language, not :wq or
CTRL-X CTRL-C.

HTH,
Keith

[1]
On Sunday 11 June 2006 1:54 pm, Nicholas E. wrote:

That said, I saw people getting incredibly confused by the idea of
matching the curly braces up.

On Monday 19 September 2005 12:32 am, Kev J. wrote:

- I think from your list it covers 1,2 and 3 (but only in my

opinion) Cons
- notoriously alternative
- wierd keywords (car?)
- braces everywhere!
- not so easy to learn (not 4 in your list)

On Saturday, 26 Mar 2005 07:44am, Csaba H. wrote:

So the point is that you can get “lisp powa” in a modern scripting
language as well without burying yourself under tons of parens and
whew-how-the-heck-should-I-name-this-one like function names.

Christian N. wrote:

James B. [email protected] writes:

Machine code or bust.

Once you know how a linked list/hash/sort/Delegate/Flyweight works,
you can use the existing version. It’s always been like that, no?

Yes. One could use Ruby to show how various built-in features work,
then use the Ruby version. Students would know the essentials of linked
lists, etc., and could then move on to using the built-in stuff.

Arguing that this may involve too much hand-waving means moving further
down the abstraction layers; the demarcation point, though, may be
arbitrary. At what point do you say, That’s too much low-level detail?

(For the previous poster: Why is it OK to use, say, C to write data
structures? Doesn’t that obscure how something is built (registers,
memory allocation, instruction pointers, etc.) )

A later post by Matthew S. raised some good questions, particularly
regarding what it is that students should be learning. For vocational
training, maybe the copious Java APIs would be best, or C# and WinForms.

But to prepare people to make best use of current computational
technology, how much geeky detail is right? Do people really need to
know the differences among various sorting algorithms? I’m inclined to
think that one cannot call oneself a programmer without some reasonable
knowledge of sorting, searching, various machine architectures,
networking basics; well, basically the stuff one gets from a CS degree.

Much like taking a driver’s ed. course does not make you a mechanic,
knowing how to assemble lines of code to run without errors and produce
correct results does not make you a programmer (except in some loose
populist sense). It means you can get from one place to another
without crashing. Maybe that’s enough.

Does the average coder need to know how to write a search algorithm or
build a linked list? Perhaps students should first be taught good
taste; there seems to be less and less need to solve the low-level
problems. They’re done. The issue now is how to best take available
tools and make good, clean choices, both in the problems to solve and
how the solutions are executed.

Teach aesthetics, not engineering.


James B.

“I never dispute another person’s delusions, just their facts.”

  • Len Bullard

there seems to be less and less need to solve the low-level
problems. They’re done.

Or maybe not!
http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-
it-nearly.html

m.s.

On 6/12/06, Keith F. [email protected] wrote:

real IDE so that they essentially never have to worry about the parens
again (see DrScheme or vim with proper syntax highlighting and %), nor
do they need to learn how to use a more advanced editor.

Now, if you’re learning programming in Ruby, an IDE may not be as
important, but it’s probably useful to remove as many barriers to entry
as possible–you want the kids to be learning the language, not :wq or
CTRL-X CTRL-C.

The navigation tree that shows the ffile’s contents (modules. classes,
methods) that you get with most IDEs is very useful to be able to see
the
structure of the software at a glance. This is very helpful to beginners
and
experts, alike.

Curt

Hello,

I have followed this thread now for a while, and cannot resist to add a
few
words. (Background: Freelance Programmer/Sysadmin with quite some
experience
in teaching ‘Something about Computers’, including various programming
languages. No LISP or Scheme, though.)

Jeremy T. wrote:

On 11-Jun-06, at 12:55 PM, Nicholas E. wrote:

[Ruby or Scheme as programming language?

If you can teach someone to program, learning a new language isn’t going
to be a big problem. Your decision should be less about the language and
more about the concepts you need to be teaching.

I have to support and stress that point. The biggest mistake in a lot of
courses seems to be that the instructor mixes up ‘How to program’ with
‘learning a specific programming language’. The most basic concepts
(calculations, conditions, operators) can be taught with the help of a
multitude of languages. The ‘not-so-basic-anymore’ stuff (for example
variables, functions/procedures, assignment …) will exclude a handful
from
the set, but there’s still enough left.

But all of these things can be presented even without the use of any
language.
These concepts should be like templates or blueprints: (Almost) every
language
has/needs those, and the only difference for the programmer is the
syntax.
Especially for a non-technical person, approaches that use metaphors and
‘real-life examples’ are easier to understand and realize.

It really doesn’t matter which tools you use to visualize and exemplify
those
concepts. The real focus in this phase should be the ease of access to
the
tools of choice for the student. In this case, a scripting language has
immense advantages over every compiled language: no wait for success.
But I
digress.

The more advanced topics will sometimes be bound to the use of a certain
language, but what good does that? Knowing about specifics of a
programming
language does as little for programming skills as knowing (only) about
MySQL
(or dBase, or BDB) teaches about databases. With good basics, though,
one can
come far.

All in all, an understanding is much more productive and helpful than
mechanical repetitions and ‘cookbook recipes’.

So, given all of that, I have two questions for ya, list. One, do you
think there’s any merit from teaching pretty non-technical sophomores
in highschool Ruby over Scheme?

For me, it’s all about the question ‘Which tools will enable the student
to
learn without being sidetracked or even hindered?’

AFAIK, DrScheme or Smalltalk have a clear advantage there. Knowing only
the
latter, I dare to simplify: the IDE is the VM is the IDE. Now, my
personal
preference is still Ruby.

First reason: Because I can – without having to specify anything –
leave the
choice of the most important tool, the editor, to the students whose
interests
are deep enough for making that kind of choice, and show the other
simple yet
powerful alternatives (my own choice doesn’t count, as I personally
prefer
vim, but wouldn’t try to force anyone to make use of all the builtin
goodness).

The second reason is the ultimate blackboard, the try-and-error
playground
which is built in: irb. Readline support, even completion is available,
and
the success for the most basic things is immediately visible, which is
invaluable for overall success and progress.

In the end, it’s all about personal preference. If you feel more
comfortable
with Ruby, stick with it. If any other programming languages feels more
natural to you, and you manage to explain the most basic concepts to
someone
new to programming with the help those, stick with that.

No, I don’t. Keep the language simple, teach them how to program; those
who continue on with programming will find languages that they wish to
pursue, and will learn those when the time is appropriate.

This is the second statement I want to support with all emphasis. The
/concepts/ are more important than any specific language skill at the
end of
the day. There is no need to teach every possible way (as mentioned
somewhere
else in this thread): the skillful will find the way, the less skillfull
will
work with what has been given to them.

Now, I want to freely comment on some other statements within this
thread:

It seems that sometimes ‘learning how to program’ is confused with ‘not
having
fun’ or even ‘no pain - no gain’. I had the mixed blessing to learn
various
things (not only programming) from very different people. The things I
remember best and that helped me most were those where learning was
coupled
with ‘having fun’. And nowadays, where we have (as instructors) the
freedom of
choice of tools, why should we still transfer ‘our’ pain of the past
onto the
back of our poor students?

Or maybe it’s just elitism, and the creepy feeling that these days
‘hackerdom’
isn’t as removed from ‘the masses’ as it has been?

On another note: if a certain concept doesn’t exist in a certain
language, and
the concept is too important to be skipped, why sticking to one language
all
the time? If it’s really that necessary to teach it, there’s ways
around the
‘restrictions’ we put on ourselves. I do not preach babylonic confusion,
but
eclectic picking of choices.

Yes, the signature is random, no, I didn’t pick it. Neat fit, though.

I’ll leave it at that.

t.

On Jun 12, 2006, at 8:25 AM, Matthew S. wrote:

class functions". I admit to a habitual disfluency when it comes
to this distinction**. Or am I missing what you think you’re missing?

matthew smillie

** in my defence, they’re very closely related, and first-order
functions are a subset of higher-order functions, so I claim that I
was technically correct (which is the best kind of correct).

I think what you’re missing that he’s missing is that Scheme has
first-class functions (higher order functions), and is in fact so
wrapped up in them that it’s almost useless (or at least not very
idiomatic scheme) without them. IOW, when comparing Ruby to Scheme
that’s probably not the point to emphasize :wink:

Concerning the ide vs command line: nothing beats irb as a learning
tool. It’s quick, easy, immediate, tangible, heavenly!

I don’t work for or am in any way associated with Thomas/Hunt and/or the
pickaxe books but if I was tasked with designing a course, I would
follow their example. They mentioned in their first book of the
difficulties of putting the book together as they initially wanted to
start with OO but then later realized that it would have to be addressed
only after introducing ‘some’ language constructs or the OO concepts
would have no footing. That book was one of the best books ever written
in the software field and has a great juke box rolling example that you
can base your whole course around.

All basic coding constructs can be expressed as easily in Ruby as any
other language. So what if it has many built in features? I remember
learning all about arrays with my trusty Borland 3.0 c++ compiler and
then being horrified to see that they had an Array class and thinking
that there would never be a need for simple arrays… :slight_smile:

Finally OO IS REAL LIFE, the whole world is made of components
interacting with other components. It is impossible to think of a
component that we use daily that doesn’t have aspects of polymorphism or
encapsulation. We start out at the age of 3 knowing what an object is
only to unlearn it when we start to code!? Anyways, thankfully, I think
the days of OO being some kind of mystery are finally behind us. This
may seem contradictory from what I stated above but isn’t! :slight_smile:

IDE’s are actually confusing to the user as they have to jump 2 steps
instead of one. They may be intimidatd from learning the IDE and that
would deter them from learning the language. I work with Eclipse for my
day job and after years of twiddling with it, have it perfectly tweaked
for my needs, but anyone coming to my office would have a problem being
productive with it. Actually, come to think of it, I don’t think there
is a sigle member on my team that has a simillar development
environment.

p.s. If I was to use Ruby in a teaching course, I would explicitly
express the method signature notation to ease the learning curve.

with love, ilan

ilan berci wrote:

Finally OO IS REAL LIFE,

Really? OO is a gross simplification of real life, handy for code
organization under various (but not all) circumstances.

Luckily, software is not real life.


James B.

“Take eloquence and wring its neck.”

  • Paul Verlaine

On Mon, Jun 12, 2006 at 06:10:37PM +0900, Matthew S. wrote:

Sincere and serious answer: Not really. Most are willing to suspend
their disbelief and take your word for it, given some reasonable
explanations as to how it might benefit them.

Also, you will probably have to do a few sleights-of-hand. For example,
many
people feel driven to use Try Ruby[1] because of the initial fun of just
watching the tutorial work. I knew most people wouldn’t really care
that
“2 + 6” works. The first few lesson are just to get people comfortable,
disarm
their ideas about the difficulty of learning.

I would find some tricks to make your students think they’re learning
faster
than they actually are. It’ll juice the adrenaline just enough.

It’s just like a chemistry teacher having fun with liquid nitrogen and a
banana.
You want to find dramatic, compelling exercises that you enjoy
performing and
that the students totally lap up.

For Ruby, the equivalent of the liquid nitrogen experiment is the social
projector demo. You set up a projector connected to a server. And you
give
each student a REPL (irb) which acts as the client. Then you give
students
commands which will affect the screen. In the past, I’ve used DRb[2]
and students
are given an object and they run methods. I have a number of variations
of this:

  • Each student gets a section of the screen which can be altered in
    color and
    shape. Or a screen full of emoticons or avatars.

  • Students vote on topics and the screen charts their response.

  • You show a picture on screen and ask students to “tag” the picture.
    Words
    appear on screen with size corresponding to the popularity. Use
    ambiguous
    imagery that solicits interesting responses.

The idea here is that students watch the screen fill and feel the reward
as a
group. High school students crave group acceptance anyway, so this
feeds that
craving.

Unfortunately, you may not have the resources to do this, since commerce
has
thieved rabidly any good concentration on education. I have been
working on my
own tools, but I’m a very bad programmer and distracted. It’s sad that
DrScheme
is even considered as an option. Sure, it’s among the best we have, but
it’s
still a bad option. It’s ugly, it has too many menus, the interface is
unnatural. It’s not made for the average kid, it’s made for geek kids.

Anyway, this is Programming I. Lower your goals. I wouldn’t even
attempt to
cover most of the concepts. Just get the class captivated and stay as
simple as
you can. Good luck, intrepid Nicholas. DO NOT TRY TO WRITE A GAME.

_why

[1] http://tryruby.hobix.com
[2] http://www.chadfowler.com/ruby/drb.html

Matthew S. [email protected] writes:

functions". I admit to a habitual disfluency when it comes to this
distinction**. Or am I missing what you think you’re missing?

Well, Ruby doesn’t have first-class functions. It “just” has
blocks, which allow code to be passed around as objects, not as
functions (read: methods).

Compare mymethod(foo) with myblock.call(foo).

matthew smillie

** in my defence, they’re very closely related, and first-order
functions are a subset of higher-order functions, so I claim that I
was technically correct (which is the best kind of correct).

I see what you mean, but it’s important to recognize that Scheme has
true first-class functions (being a Lisp-1), whereas there is a
fundamental difference between Blocks/Procs/lambdas and methods (being
a Lisp-2).

Since Ruby is considered an OO language and Scheme a functional
language, this is fine.

why the lucky stiff [email protected] writes:

DO NOT TRY TO WRITE A GAME.

I’m a bit curious about why you suggested this since writing a game
seems to be precisely the way many beginning programmers learn. (Or at
least it was in the days when practically every computer had QBasic.)
Is it because you’ll get sidetracked by graphics concepts (which don’t
really have much to do with the fundamentals of programming) or is
there another reason?

It seems if it’s done right, writing a game can be a very engaging way
to learn. Perhaps it would be better if the incidentals (like
graphics) were abstracted away–perhaps handled by a program written
by the instructor on one machine hooked up to a projector, while
students only communicated with it over DRb, and thus wouldn’t have to
think about things like rendering.

-Phil H.

http://technomancy.us

Anton ‘tony’ Bangratz [email protected] writes:

AFAIK, DrScheme or Smalltalk have a clear advantage there. Knowing only the
latter, I dare to simplify: the IDE is the VM is the IDE. Now, my personal
preference is still Ruby.

Funny you mention Smalltalk. I think it would make a great teaching
language too. It has an easy and logical, but well readable syntax, a
graphical environment and it’s great for teaching OO, of course.

First reason: Because I can – without having to specify anything – leave the
choice of the most important tool, the editor, to the students whose interests
are deep enough for making that kind of choice, and show the other simple yet
powerful alternatives (my own choice doesn’t count, as I personally prefer
vim, but wouldn’t try to force anyone to make use of all the builtin goodness).

I could imagine these kids post endless stuff on their Livejournal or
MySpace and write that directly into the browser… do you really
think they care that much about editors? Both DrScheme and Squeak
provide convenient and appropriate ways of code editing. (Though I
have to admit that the main reason I don’t use more Squeak is that I
can’t easily edit it in Emacs.)

The second reason is the ultimate blackboard, the try-and-error playground
which is built in: irb. Readline support, even completion is available, and
the success for the most basic things is immediately visible, which is
invaluable for overall success and progress.

Is irb that much better than an evaluation window? Squeak is even
more “live” than Ruby.

James B. [email protected] writes:

Christian N. wrote:

Once you know how a linked list/hash/sort/Delegate/Flyweight
works,
you can use the existing version. It’s always been like that, no?

Yes. One could use Ruby to show how various built-in features work,
then use the Ruby version. Students would know the essentials of
linked lists, etc., and could then move on to using the built-in
stuff.

Exactly.

Arguing that this may involve too much hand-waving means moving
further down the abstraction layers; the demarcation point, though,
may be arbitrary. At what point do you say, That’s too much low-level
detail?

Of course, that’s a question of time. If you only have a half or a
full year, you need to stop digging deeper pretty soon; depending on
what you really want them to learn. Give foundations for figuring out
on their own.

But to prepare people to make best use of current computational
technology, how much geeky detail is right? Do people really need
to know the differences among various sorting algorithms?

People don’t, but a reasonable programmer really ought to. He at
least should know where to lookup sort algorithms, how to evaluate
them and make a good choice, and finally implement them, given a
description in English or pseudocode.

Your PHP codemonkey doesn’t need to be able to do that, but if I hired
a serious programmer, I would expect that.

I’m
inclined to think that one cannot call oneself a programmer without
some reasonable knowledge of sorting, searching, various machine
architectures, networking basics; well, basically the stuff one gets
from a CS degree.

You don’t need a CS degree (there are so many very good self-thought
people around), and you don’t to know all the stuff by heart. But you
need to be able to learn and pickup these things.

Much like taking a driver’s ed. course does not make you a mechanic,
knowing how to assemble lines of code to run without errors and
produce correct results does not make you a programmer (except in some
loose populist sense). It means you can get from one place to
another without crashing. Maybe that’s enough.

That’s a bad analogy.

Driver : Car = User : Application
Mechanic : Car = Programmer : Application

Does the average coder need to know how to write a search algorithm or
build a linked list? Perhaps students should first be taught good
taste; there seems to be less and less need to solve the low-level
problems. They’re done. The issue now is how to best take available
tools and make good, clean choices, both in the problems to solve and
how the solutions are executed.

I’d like to add that it’s wrong to think every problem can be solved
by another level of abstraction.

Teach aesthetics, not engineering.

“Software aesthetics” sounds a lot better than “Software engineering”,
too :slight_smile:

On Jun 12, 2006, at 18:06, Christian N. wrote:

it’s important to recognize that Scheme has
true first-class functions (being a Lisp-1), whereas there is a
fundamental difference between Blocks/Procs/lambdas and methods (being
a Lisp-2).

This has slightly confused me, but I’ll admit that it’s been a while
since I’ve dealt with this sort of thing, so jump in with corrections
as required.

  • A language has first-class functions when a function can be
    assigned to variable, passed to or returned from another function,
    and so on. In Ruby, a = lambda { |x| x + 1 } for example.

  • The distinction between Lisp-1 and Lisp-2 that the latter has a
    separate namespace for functions, in Ruby, for example, def a(x) x +
    1; end can exist alongside a = lambda { |x| x + 1 } (and there’s a
    corresponding hoop to jump through to call the lambda).

What I don’t understand is how it follows that being in a different
namespace implies that Lisp-2 doesn’t have true first-class
functions. The only reason I can think of is the circular one that
“only Lisp-1 has true first-class functions”, which gives it the
distinct flavour of an age-old Lisp holy war (if that’s the case,
consider me uninterested).

matthew smillie.

On 6/12/06, James B. [email protected] wrote:

Do people really need to know the differences among various sorting algorithms? I’m
inclined to think that one cannot call oneself a programmer without some reasonable
knowledge of sorting, searching, various machine architectures, networking basics; well,
basically the stuff one gets from a CS degree.

[ snip ]

Does the average coder need to know how to write a search algorithm or build a linked
list? Perhaps students should first be taught good taste; there seems to be less and
less need to solve the low-level problems. They’re done. The issue now is how to best
take available tools and make good, clean choices, both in the problems to solve and
how the solutions are executed.

James, I think that your conclusion here is correct: there should be a
focus on using the best tools available to complete the current task.
However, might I suggest that there is still much value in focusing on
the traditional CS fare, even for “the average coder”?

Although it may not be important to know the intimate details of
implementing, say a bubble-sort vs. a merge-sort, I would contend that
it is important to know what makes each one (in)efficient and under
what circumstances. Someone learning to code should learn O(n)
notation so that they know how to compare different algorithms–even
one’s of their own creation.

Is it important to know you are using an array rather than a
linked-list? I think so. Even if you don’t know how they are built,
you should know which one to use. Which is better if I need to do
many insertions to the middle of the list? Of course, we CS types
take this sort of thing for granted because we understand the
concepts, even when we aren’t required to implement them.

In fact, my thought here is that the most important stuff really is
the theory: algorithms & data structures, not any particular language.
Students should probably be encouraged to write things out as
pseudo-code before anything else. You don’t need a computer to write
an algorithm. Just ask Euclid =)

Consequently, I think this is one thing scheme (lisp in general) has
going for it. There isn’t really much syntax to learn at all. You
have atoms, lists, and function calls but not much else (well, macros,
but I’ll leave that one alone).

On Jun 12, 2006, at 2:58 PM, Matthew S. wrote:

corrections as required.
What I don’t understand is how it follows that being in a different
namespace implies that Lisp-2 doesn’t have true first-class
functions. The only reason I can think of is the circular one that
“only Lisp-1 has true first-class functions”, which gives it the
distinct flavour of an age-old Lisp holy war (if that’s the case,
consider me uninterested).

matthew smillie.

In a Lisp-2 you have to use special syntax (funcall, apply, #call) to
call a function-value. I believe that was the distinction he was making.

On 12-Jun-06, at 12:08 PM, James B. wrote:

ilan berci wrote:

Finally OO IS REAL LIFE,

Really? OO is a gross simplification of real life, handy for code
organization under various (but not all) circumstances.

People tend to abuse this point of object-oriented languages; they
treat classes/objects like modules, and quite frankly, it’s sometimes
really annoying to read.

Luckily, software is not real life.

Phew!

James B.


Jeremy T.
[email protected]

“One serious obstacle to the adoption of good programming languages
is the notion that everything has to be sacrificed for speed. In
computer languages as in life, speed kills.” – Mike Vanier

Jeremy T. wrote:

People tend to abuse this point of object-oriented languages; they
treat classes/objects like modules, and quite frankly, it’s sometimes
really annoying to read.

Oh, absolutly. But, by the same token, not every line of code needs to
be part of some object scheme.


James B.

“Take eloquence and wring its neck.”

  • Paul Verlaine

http://rubyinstaller.rubyforge.org/), it includes the FreeRIDE IDE (
http://freeride.rubyforge.org/).

Good luck!

I just want to second this. I definitely think Ruby is a useful
language to teach beginning programming. It’s real-world enough that
you might use it for practical purposes further down the line and it’s
easy enough that the kids will think about “what can I do with this?”
instead of just freaking out over the details.

a friend in his early 20s was taking a Java class, I told him drop out
and get “Learn to Program” instead. I definitely endorse that
approach.

Christian N. wrote:

Anton ‘tony’ Bangratz [email protected] writes:

AFAIK, DrScheme or Smalltalk have a clear advantage there. Knowing only the
latter, I dare to simplify: the IDE is the VM is the IDE. Now, my personal
preference is still Ruby.

Funny you mention Smalltalk. I think it would make a great teaching
language too. It has an easy and logical, but well readable syntax, a
graphical environment and it’s great for teaching OO, of course.

I have to take your word for this (and that of a good friend, of
course). After installing squeak, I had a few troubles to get me
started, but that was probably because X.org is a means to hold a
multitude of xterms and three other applications to me. I’m too much
of a console guy, I fear.

I could imagine these kids post endless stuff on their Livejournal or
MySpace and write that directly into the browser… do you really
think they care that much about editors? Both DrScheme and Squeak
provide convenient and appropriate ways of code editing. (Though I
have to admit that the main reason I don’t use more Squeak is that I
can’t easily edit it in Emacs.)

The point-and-click interface is not so intuitive as I hoped, but I
could get used to it.

Is irb that much better than an evaluation window? Squeak is even
more “live” than Ruby.

That’s true. For me, irb is my ‘sandbox’, my testing area where I can
try ideas with a few keystrokes. In my experience, focussing on more
than one window or following instructions around “move the mouse
pointer over the orange tab with the word ‘Navigation’ on it and click
ONCE!” is taxing for most beginners. Typing a word, hitting ‘Enter’
and seeing immediate reaction is more direct - in the beginning.

It’s true that objects and messages can be more easily illustrated and
used in squeak. That’s when the personal preferences hit, about syntax
and intuitive manipulation.

My other ‘thing’ is that I am using ruby for administrative tasks,
complex scripts and Rails. So it has a lot of real-world value and
provides me with a neverending source of useful examples.

Summary: I could not decide which to take if my life depended on it. I
think I’d try to show both, thus stressing the point that concepts are
more important than recipes.

t.