Ruby for beginners (was: Re: Hello)

On Tue, Apr 12, 2011 at 5:08 PM, Vincent M. [email protected] wrote:

A: What do I do?
B: Well, go to www.ruby-lang.org, and they have all the information you need.

Been there, done that, had to recommend books to go with my
recommendation.

When I used to do software engineering training for a company I used to work
for, one of the
more popular courses I ran was called `Programming for Non-Programmers’, aimed
at giving
people exactly that framework. A lot of beginners get stuck there, and can’t
easily move
forward without a bit of help.

Considering you have educational expertise, how would you go about this?

I don’t think that a link to Chris P.'s Learn to Program
Learn to Program, by Chris Pine is sufficient.

Considering the target audience (non-programmers with slight, if any,
technical background running Windows of some sort), there’s a a lot of
stuff that needs to be included:

  • Ruby (obviously)
  • text editor (simple enough to be easily learned, malleable enough
    that it could be customized for a Beginner’s Ruby package)
  • guide to programming*
  • guide to Ruby*

The problem I’ve run into is that I can’t write a programming guide
worth a damn. Mostly, because I have no idea where to begin to be
thorough enough that a newby can do simple stuff, and yet is able to
find out what else to learn going forward. And I don’t want to rip off
Chris P.'s excellent work. :wink:

  • _why’s Poignant Guide doesn’t cut it. It’s far too eccentric for
    most people (not to mention that it is outdated). Neither does
    Programming Ruby, since it’s a guide by programmers for programmers,
    and the free version that was donated to the community is outdated as
    well (by 2 generations now!).


Phillip G.

Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.

On Tue, Apr 12, 2011 at 10:30 AM, Phillip G. <
[email protected]> wrote:

  • guide to programming*
  • guide to Ruby*

When I was first learning to program I got into Ruby (on Windows at that
time). The download from ruby-lang.org had the option to install SciTE
with
it and it was all hooked up so that you just pressed f5 to run your
program.
If it wasn’t that simple, I probably would have gotten overwhelmed and
given
up.

As for my schoolwork, in C, I had to get my school’s sysadmin to install
linux on my laptop and hook up gcc and everything. If not for that, I
honestly would have changed majors to math. It was another couple of
years
before I figured out Linux well enough to understand most of the things
I
initially had so much trouble with.

Maybe these things were easier for other people, IDK, but for me, if
there
hadn’t been simple ways to get started, I’d be doing math now, thinking
I
was too dumb to program.

I think newbies need as much of the tangential tasks abstracted away as
possible. If I don’t program and I’m thinking about checking it out, I
want
to play with Ruby, not have to learn a thousand bits of arcane knowledge
before I can even begin. I think it is important, in general, to be as
accessible as possible, but especially for someone who just wants to
come
and try it out. They can invest into all the tangential knowledge (how
to
install Ruby, the devkit / compiler, editing the path, rvm, which
version to
use, which implementation to use, which editor, ide, os, etc) after they
are
sure this is something they want to delve further into.

On Tue, Apr 12, 2011 at 10:30 AM, Phillip G. <
[email protected]> wrote:

On Tue, Apr 12, 2011 at 5:08 PM, Vincent M. [email protected] wrote:

This does bring up an issue. I would like to see www.ruby-lang.org have
a page
`Totally new to programming’, with appropriate resources; this page would
be
prominently linked to on the front page.

This is what TryRuby.org is suppose to be.

I am currently working on a offline and mobile version of that project.
Additionally, I have been working on adding new lessons and more
capabilities.

Additionally, TryRuby is linked on the front page of ruby-lang.org as
well
as on reddit.com/r/ruby.

There was an earlier comment that _why’s poignant guide to ruby is too
eccentric for most people. This is a new insight to me. I found that
guide
to be very playful and fun.

Respectfully,
Andrew McElroy
http://TryRuby.org

On Tue, Apr 12, 2011 at 7:48 PM, andrew mcelroy [email protected]
wrote:

This is what TryRuby.org is suppose to be.

I am currently working on a offline and mobile version of that project.
Additionally, I have been working on adding new lessons and more
capabilities.

How are the lessons (well, the content, really, as opposed to the
code) licensed?

Additionally, TryRuby is linked on the front page of ruby-lang.org as well
as on reddit.com/r/ruby.

Well, not everyone wants to try a programming language in a web browser.

It’s more something for the technologically savvy, than the Average
Joe (GMail vs Hotmail users, to use stereotypes :P).

There was an earlier comment that _why’s poignant guide to ruby is too
eccentric for most people. This is a new insight to me. I found that guide
to be very playful and fun.

Oh, it can be. But not every one has the mindset of dealing with
playfulness or the quirky sense of humour the Guide has.

Of course, I’ve recommended it as a resource, way back when, since
there’s no arguing taste.


Phillip G.

Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.

OK, so here’s another kick at the can.

  1. I would be willing to draft a `Totally New To Programming’ page for
    ruby-lang.org, if there’s sentiment that this would be a useful thing.

  2. tryruby.org is very meritorious, but doesn’t really replace having
    Ruby on one’s own machine. It gives you the experience of interacting
    with Ruby, but doesn’t show you how to transfer that to writing and
    running programs on your own machine.

  3. An IDE for beginners should be relatively limited, with relatively
    few dingbats and gizmos to confuse. It should focus on offering basic
    editing facilities, along with the ability to write and run programs.
    Beginners don’t need API documentation, though a Ruby reference card
    would probably be handy.
    Such an IDE should be something that can be included with the
    installers, and depend upon nothing else. Of course the model here is
    Python’s IDLE, which IMHO isn’t suitable for serious programming, but on
    the other hand is very useful for getting started with Python. I used to
    use it in all my Python courses, even with programmers who presumably
    knew other editors well.

And that suggests using Tk as the GUI, because that’s included in every
Ruby distribution. So the one-click installers could thus incorporate a
basic IDE that was at least useful enough to get people started.

Is there any sentiment that this would all be a worthwhile effort?

– vincent

Andrew Mcelroy wrote in post #992351:

This is what TryRuby.org is suppose to be.

i think that TryRuby is a great start, though i agree that making the
jump from an online irb to actual programming might be frustrating for
the “total” beginner. i was in fact confused by irb at first, thinking
that it was some kind of command line ide or editor, rather than more of
a reference tool. obviously once you know what it’s for, it’s a great
tool.

i also used (and still do at times) scite for my first whacks at
programming ruby, and i think the ease of pressing F5 and having output
in another pane is a great idea for getting folks to see what they can
do.

ubuntu has a “Ruby Browser” package, which is a great concept, but is
unfortunately incomplete and a bit buggy. it’s basically a list of all
ruby base classes/modules, as well as Atk, Cairo, Gtk, Gst, and other
library classes/modules. the idea is that you click on a class or
module and up pop the class and instance methods… by clicking on a
method, an explaination of the arguments appears.

if these two could be combined, so that in one pane you’d have the API
information, in another the text editor window, and in another the
output - i think it could be a very useful tool for those who are new to
ruby and programming in general. this could be combined with the other
suggestions (all very good in my opinion) about a package which manages
installation and environment, and with some simple tutorials.

it’s a shame to see folks who would like to get started with
programming and ruby get frustrated and give up…

-j

For what it’s worth I have been using interactive_editor gem in irb for
a
bit now. It allows me to open nvi or vim within irb and also supports
other
cli editors( emacs, pico/nano, and even ed for those still <3 the
original
unix line editor)

Though it is the reverse of setting up your editor to execute the script
from within the editor it has been quite a pleasant experience with
adhoc
irb sessions.

Features are simplified. For example from within irb I type vim and then
a
temp file is created which treats it as a *.rb file and allows syntax
color
highlighting.

After write out the temp file the buffer is pushed back into the irb
interpreter and ready to use.

If I need to refactor my code further I can reopen the temp file again
and
edit. If I’m done and happy with my creation I can save it as a named
file.
If I am not content when I leave irb it will simply be flushed.

Of course you can open named files from within irb and within your text
editor running on top of irb as well.

Anyone who prefers these type of editors and has not discovered
interactive_editor may want to investigate this gem. I use it daily and
I am
content as it fills the gap of experimentation much the same as posix
programming an almquist shell script directly in the terminal command
line.

Now if there was a gem to manipulate irb’s completion system to
act
just like zsh’s innovative completion system it would be one hell of a
development environment.

On Wed, Apr 13, 2011 at 3:30 AM, Vincent M. [email protected] wrote:

OK, so here’s another kick at the can.

  1. I would be willing to draft a `Totally New To Programming’ page for
    ruby-lang.org, if
    there’s sentiment that this would be a useful thing.

I for one would approve of this.

It wouldn’t even have to be in depth, just enough to get one going,
and do so in an easy to understand fashion (which makes jargon
problematic).

  1. An IDE for beginners should be relatively limited, with relatively few
    dingbats and
    gizmos to confuse. It should focus on offering basic editing facilities, along
    with the
    ability to write and run programs. Beginners don’t need API documentation,
    though
    a Ruby reference card would probably be handy.

Cheat sheets are very nice to have, but I wouldn’t discard API
documentation completely. But it’d have to be made a bit more
accessible to Joe Average (who may or may not be a plumber), than the
current documentation is. Maybe condensed into what’s used often, and
should be known to every one using Ruby.

Such an IDE should be something that can be included with the installers, and
depend
upon nothing else. Of course the model here is Python’s IDLE, which IMHO isn’t
suitable for serious programming, but on the other hand is very useful for
getting started
with Python. I used to use it in all my Python courses, even with programmers
who
presumably knew other editors well.

Well, if there is a single download for beginners, this download can
deploy what is needed. It’d be necessary to keep download sizes
small(ish), though.

And that suggests using Tk as the GUI, because that’s included in every Ruby
distribution. So the one-click installers could thus incorporate a basic IDE
that
was at least useful enough to get people started.

irb(main):001:0> require ‘tk’
LoadError: no such file to load – tk
from internal:lib/rubygems/custom_require:29:in require' from <internal:lib/rubygems/custom_require>:29:in require’
from (irb):1
from C:/Ruby192/bin/irb:12:in `’

Not any more. Though, I guess that it’d be easy to create something
with other toolkits, or to use Shoes.

Is there any sentiment that this would all be a worthwhile effort?

Certainly.


Phillip G.

Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.

Vincent M. wrote in post #992403:

  1. I would be willing to draft a `Totally New To Programming’ page for
    ruby-lang.org, if there’s sentiment that this would be a useful thing.

i definitely think this would be useful. ruby is such a ‘friendly’
language, that it invites people with little or no experience
programming (like yours truly) to get started… i do think a page for
the absolute newb would be useful for a lot of people.

  1. An IDE for beginners should be relatively limited, with relatively
    few dingbats and gizmos to confuse. It should focus on offering basic
    editing facilities, along with the ability to write and run programs.
    Beginners don’t need API documentation, though a Ruby reference card
    would probably be handy.

agreed that it shouldn’t be too complex - that could just frustrate
people more, but i think something fairly in depth would be good - just
the nuts and bolts, but well explained (method arguments, examples,
etc.)

And that suggests using Tk as the GUI, because that’s included in every
Ruby distribution.

if Tk isn’t working, shoes might be a good option, as it is easy and
comes with an interpreter built-in. i use gtk2 myself, but i know it
isn’t so cross platform friendly. i would be happy to help out with
layout/design in any way that i can.

Is there any sentiment that this would all be a worthwhile effort?

absolutely…

  • j

On Tue, Apr 12, 2011 at 8:30 PM, Vincent M. [email protected] wrote:

OK, so here’s another kick at the can.

  1. I would be willing to draft a `Totally New To Programming’ page for
    ruby-lang.org, if there’s sentiment that this would be a useful thing.

I think it would be good. New to programming tutorials should be very
different from tutorials for people who already program.

well.

And that suggests using Tk as the GUI, because that’s included in every
Ruby distribution. So the one-click installers could thus incorporate a
basic IDE that was at least useful enough to get people started.

Is there any sentiment that this would all be a worthwhile effort?

Are you thinking of building your own editor? Surely this work has
already
been done.

On Wed, Apr 13, 2011 at 5:23 AM, Stu [email protected] wrote:

For what it’s worth I have been using interactive_editor gem in irb for a
bit now. It allows me to open nvi or vim within irb and also supports other
cli editors( emacs, pico/nano, and even ed for those still <3 the original
unix line editor)

CLI editors are great – for advanced users.

But the vast majority of people are used to WIMP interfaces, and
that’s who should be targeted. vim and EMACS are nice editors, but
they overwhelm non-technically-trained people far too soon.

(How do you generate a random string? Sit down a new student in front
of a vim session.)


Phillip G.

Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.

On Wed, Apr 13, 2011 at 4:48 PM, Vincent M. [email protected] wrote:

Just to make it clear, I am ABSOLUTELY NOT thinking of building another
editor.
My operative philosophy comes from Tom Lehrer’s song, `Nikolai Ivanovich
Lobachevsky’,
on how to succeed as a mathematician:

IOW: Good artists create, great artists steal. :wink:

Good thing for open source and Creative Commons licensing.

As for Tk not appearing with current Ruby installers, oops on my part.

How often do you check for Tk? :wink:

So. How do we get an IDLE-like editor that will work at least on Windows and Mac
that is
plausible to ship as part of the installers?

Preferrably, something written once, yet running everywhere. I’d
suggest using JRuby, and a JRuby-based editor, that is easy to use,
yet works well enough with Ruby (it doesn’t have to be perfect: A
newby who wants to explore programming in the first place isn’t going
to complain about having the wrong editor, as as long as there is an
editor).

Redcar looks very simple, and meets the criteria, so I’m taking the
liberty of investigating it a bit more.

As for dealing with a potential lack of a Java VM: It’s possible to
have a (Windows) installer check for, and then install Java.

Likewise, you could offer a default download that includes Java
(vendor’d, possibly), and one without Java.

The downside is that JRuby, great as it is, doesn’t allow for C
extensions as seamlessly as the Windows Ruby with Devkit (I’m sure
Charles will now drop in and correct me :slight_smile: ). OTOH, the end of a “Ruby
for newby” guide could include a means of getting a more, er,
conventional Ruby installed and set up.


Phillip G.

Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.

On 2011-04-13, at 05:59, Josh C. wrote:

Are you thinking of building your own editor? Surely this work has already
been done.
Just to make it clear, I am ABSOLUTELY NOT thinking of building
another editor. My operative philosophy comes from Tom Lehrer’s song,
Nikolai Ivanovich Lobachevsky', on how to succeed as a mathematician: "Plagiarize,/Let no one else's work evade your eyes,/Remember why the good Lord made your eyes,/So don't shade your eyes,/But plagiarize, plagiarize, plagiarize -/Only be sure always to call it please 'research'." (To which I would addwith attribution’.)

As for Tk not appearing with current Ruby installers, oops on my part.

So. How do we get an IDLE-like editor that will work at least on Windows
and Mac that is plausible to ship as part of the installers?

– v

On Wed, Apr 13, 2011 at 11:14 AM, Jim M. [email protected] wrote:

  1. How to use Notepad as a program editor

Can Notepad do syntax highlighting? I think their editor / IDE should be
able to at least highlight code and if it could also run Ruby, that
would be
fantastic. I really liked SciTE. It highlighted the code, it had lines
indicating starting and closing of indentation (newbies need
encouragement
to format their code well), and you could run it by pressing f5. I think
it
is good to give them something simple enough to understand, yet
something
clearly uniquely tailored to writing code (it is simply “cooler”, which
makes it more motivating and helps to create an experience).

I agree that this is an important need. I suspect Ruby is not as
broadly accepted as it could be because we all assume a basic knowledge
of computers that probably is WAY beyond most people. But, really, Ruby
is just plain great and we need to figure out how to make it accessible
to the masses.

I believe that many people may balk at “Absolutely New to Programming”,
since they may have taken an Intro to Programming using
Basic/Cobol/Whatever. Perhaps just say “An Easy Start for Ruby”, or
something.

I believe the vast majority of the under-served Ruby illiterate are
using Windows (not Macs and not Linux). In Windows, I think all one
really needs is:

  1. How to download and execute RubyInstaller
  2. How to use Notepad as a program editor
  3. How to access and use a Command Window
  4. How to run a Ruby program in a Command Window

I’ve TALKED a few people through this, while standing over their
shoulder. I ain’t no great writer, so I’m not gonna be able to help
there.

But one thing I noticed when TALKING is that jargon is a killer. Very
basic concepts (to me) are WAY beyond the newcomer. They’ve never
downloaded and installed nothin’ (at least, that they know). They never
heard of Notepad. They aren’t aware that a Command Window is available
(or what it is or how to use it or why). And every other word out of my
mouth is Greek to them (e.g., What’s a program? What’s a script?
What’s an object? etc., etc.)

I thinkin’ we need instructions a 5th grader could understand, who’s
only used a Windows computer to play games on Facebook. Just WHAT to do
and HOW to do it to get Ruby up and running on their Windows platform
and run a simple program (I beg you, please, NOT “Hello World”).

After they have it, then we can point them to lots of doc (though
someone needs to prepare a “curriculum” for newbies).

If this takes off, I’ll follow the thread and look to see if there’s any
way I can help.

On Wed, Apr 13, 2011 at 12:23:22PM +0900, Stu wrote:

For what it’s worth I have been using interactive_editor gem in irb for a
bit now. It allows me to open nvi or vim within irb and also supports other
cli editors( emacs, pico/nano, and even ed for those still <3 the original
unix line editor)

Holy crap! How is it I never knew about this? Thank you for mentioning
it. I love interactive_editor. I think I hear wedding bells.

I’m going to have to crack open the source for interactive editor and
see
how it decides things like what editor executable names to recognize.
This is way cool.

On Thu, Apr 14, 2011 at 02:27:33AM +0900, Josh C. wrote:

understand, yet something clearly uniquely tailored to writing code (it
is simply “cooler”, which makes it more motivating and helps to create
an experience).

It used to be the case that the standard Ruby installer for MS Windows
came with SciTE. Is that still the case? I do have a current install
of
Ruby on Win7, but I fire up the Great White Satan so rarely that I don’t
even remember what was installed with it.

Anyway . . . if installing a separate editor is necessary to get syntax
highlighting for the Absolute Noob, I vote “no”. Get 'em up and running
with what’s already on the computer – or, more to the point, point a
finger in the direction of what should already be on the computer,
ensuring that the new user will not open something like MS Word that
will
actively hinder writing code, and let the new user choose some other
editor if (s)he is savvy enough to be aware of text editors. If editors
outside of what should already be on the computer by default are
mentioned at all, it should be in a footnote.

On Wed, Apr 13, 2011 at 06:08:08PM +0900, Phillip G. wrote:

overwhelm non-technically-trained people far too soon.
This is not a problem. Once you have your .irbrc file set up, start irb
and try this:

irb(main):001:0> ENV['EDITOR'] = 'xedit'
=> "xedit"
irb(main):002:0> ed

I use xedit here because it’s likely to be just about anywhere people
are
using the X Window System. Replace it with gvim, scite, or gedit if you
like. You can also set your EDITOR environment variable in your
standard
shell environment (of course), or add the editor setting line above to
your .irbrc file if you like, so that setting up interactive_editor
config in .irbrc looks like this:

require 'rubygems'
require 'interactive_editor'
ENV['EDITOR'] = 'xedit'

Then . . . you just enter “ed” at the irb prompt and it automatically
opens that editor, even if it’s a GUI editor. Some editors may benefit
from special command line options.

(How do you generate a random string? Sit down a new student in front
of a vim session.)

How do you generate the complete works of Shakespeare within your
lifetime? Teach your monkeys how to use Vim. (It’s not as hard as it
seems, once you get past the initial confusion over modal editing).

Anyway, interactive_editor supports nano “natively” (without the
environment variable trick), which is really easy for beginners to
understand. They’ll just have to learn to use arrow keys instead of the
mouse.

Chad P. wrote in post #992591:

It used to be the case that the standard Ruby installer for MS Windows
came with SciTE. Is that still the case?

another vote for SciTE! it helped get me motivated to start
programming when i was still weary of the linux command line. the
syntax highlighting is decent, and the ability to run programs with a
button push is a huge plus. only downside i can see is that the “gets”
command so common in early programs doesn’t work with SciTE.
the license is open source - and while it’s an older program it seems
that it is still actively developed.

-j

On Thu, Apr 14, 2011 at 10:35:42AM +0900, Vincent M. wrote:

This might be a good way to go. I’m queasy about requiring Java to be
installed, though. Your thoughts on redcar might well alter that.

That bothers me, too. We should have an option that does not require
installing more than one programming language.