Ruby Curriculum for coworkers

S

ssmoot

I've been tasked with coming up with a curriculum for Rails coworkers.
I was hoping you guys might have some tips to share on how I might go
about this.

Also, any information on formal Ruby or Rails courses (preferrably in
the Plano/Dallas, TX area) such as pricing, skill level, etc would be
appreciated since the assumption right now is that .NET training will
be cheaper for a comparable course.

And if we can persuade Dave Thomas to come out for a day for... lets
see... I've got $20 and a stick of unchewed gum in my pocket... ;-) No
seriously, if there are any skilled trainers/evangelists we can have
come out for a marketing/training blitz for a day I'd love to attempt
to work out a budget.

Anyways, here's my 5-minute attempt at a curriculum. No times or
anything down yet:

1: Install Ruby
2: Go through the TryRuby.Hobix tutorials
3: Read the Ruby Book
3a: Read the Rails book for web development (if applicable)
4: Install Subversion and Eclipse (with Ruby Development Tools) and
recieve basic training
5: Write a series of simple programs (To Be Determined)
6: Code Review and Optimization of task programs
7: (Minor) Code Review and Optimization of existing Ruby projects
8: Review Rails based project (for Web Development) (if applicable)
9: Create Rails based project for simple time-tracking/ticket system
(if applicable)

One of the coworkers is going to be learning Ruby, and the other is
going to be more Rails focused. I don't think it's necessary for the
first to learn Rails, but I'd like the second to get as good a handle
on Ruby in addition to Rails as I can offer.

I'd like to think I and a coworker are pretty decent Rubyists, and one
on one I think I can get the message across with an eager learner, but
I'm anticipating a less than eager reception, and I'm not very good at
marketing. (Which I think is really key here).

Any and all tips/criticism are appreciated!
 
S

Steve Litt

On Wednesday 28 December 2005 10:42 am, (e-mail address removed) wrote:
[clip]
One of the coworkers is going to be learning Ruby, and the other is
going to be more Rails focused. I don't think it's necessary for the
first to learn Rails, but I'd like the second to get as good a handle
on Ruby in addition to Rails as I can offer.

I'd like to think I and a coworker are pretty decent Rubyists, and one
on one I think I can get the message across with an eager learner, but
I'm anticipating a less than eager reception, and I'm not very good at
marketing. (Which I think is really key here).

Any and all tips/criticism are appreciated!

Rather than commenting on the structure of your curriculum, I have some ideas
for how to present that curriculum.

I might have started Ruby 3 years earlier, but was put off by the constant OOP
wardrums of Ruby evangelists. When they touted Ruby as "fully OOP", I read
that as "all OOP all the time" like Java, where you need to create a class to
print "Hello World", and there's really no such thing as a quick and dirty
program.

In teaching these reluctant learners, I would work from the known to the
unknown -- a standard technique for teachers. These people have probably been
hammering C for years -- start by showing them that they can write Ruby the
same way as C, while promising that as time goes on they'll probably want the
advantages only Ruby'esque coding can offer.

Have em start with HelloWorld, then a loop, then an if elsif else. Demonstrate
that most functions are methods of objects, and that integers, floats,
strings and the like are really objects with methods.

With a few programs under their belt, you can say "the stuff you did is the
hardest Ruby you'll ever do. Now let me show you the easy way", and proceed
to show them the real Ruby way of doing things, in each case demonstrate why
the Ruby way is easier.

Personally (Litt dons flameproof suit) I wouldn't stress these long 1 liners
so popular in the Ruby community. There's no shame in using 4 short
statements instead of one long one, and I think the average programmer (not
necessarily Ruby programmer) finds the 4 line version easier to understand.
Remember the complex 1 liners Kernighan and Ritchie used in version 1 of "The
C Language Book"? Weren't they obnoxious? I have the same feeling about long
and complex 1 liners in Ruby.

Show them how beautifully Ruby encapsulates object member data, and yet how
easy it is to reveal them with methods with the same name. Show attr_reader,
attr_writer and attr_accessor. That was a BIG selling point for me. Show them
how, unlike Perl and Python, they have full public, protected and private
methods. Show them how much easier inheritance is in Ruby than in C++. Show
them just how easy it is to make an operator represent a method. Sure, you
can do that in C++, but it's just not as easy.

When you get around to demonstrating blocks:

my_array.each{|element| puts element}

make the point that this feature saved them the need for a confusing callback
routine (pointer to function and the like).

Show them how to use yield() to create a method that can take a block.

HTH

SteveT

Steve Litt
http://www.troubleshooters.com
(e-mail address removed)
 
J

James Edward Gray II

Have em start with HelloWorld, then a loop...

Hmm, that's a tricky one to me. You really need to nail iterators
ASAP to become a Rubyist. If you post code here with a loop, odds
are good we'll start "correcting" it.

Also Ruby has no loop equivalent to the famous for(...; ...; ...)
{ ... } construct from most other languages.
Show them how much easier inheritance is in Ruby than in C++.

"Favor composition over inheritance." I think that's even more true
in Ruby where inheriting the core classes sometimes has surprising
side effects.

James Edward Gray II
 
R

Robert Klemme

Steve Litt said:
On Wednesday 28 December 2005 10:42 am, (e-mail address removed) wrote:
[clip]
One of the coworkers is going to be learning Ruby, and the other is
going to be more Rails focused. I don't think it's necessary for the
first to learn Rails, but I'd like the second to get as good a handle
on Ruby in addition to Rails as I can offer.

I'd like to think I and a coworker are pretty decent Rubyists, and
one on one I think I can get the message across with an eager
learner, but I'm anticipating a less than eager reception, and I'm
not very good at marketing. (Which I think is really key here).

Any and all tips/criticism are appreciated!

Rather than commenting on the structure of your curriculum, I have
some ideas for how to present that curriculum.

I might have started Ruby 3 years earlier, but was put off by the
constant OOP wardrums of Ruby evangelists. When they touted Ruby as
"fully OOP", I read that as "all OOP all the time" like Java, where
you need to create a class to print "Hello World", and there's really
no such thing as a quick and dirty program.

In teaching these reluctant learners, I would work from the known to
the unknown -- a standard technique for teachers. These people have
probably been hammering C for years -- start by showing them that
they can write Ruby the same way as C, while promising that as time
goes on they'll probably want the advantages only Ruby'esque coding
can offer.

Although this might be a good move from a pedagogical perspective I feel a
bit uncomfortable about encouraging people to write Ruby like they write
C... :)
Have em start with HelloWorld, then a loop, then an if elsif else.
Demonstrate that most functions are methods of objects, and that
integers, floats, strings and the like are really objects with
methods.

With a few programs under their belt, you can say "the stuff you did
is the hardest Ruby you'll ever do. Now let me show you the easy
way", and proceed to show them the real Ruby way of doing things, in
each case demonstrate why the Ruby way is easier.

Personally (Litt dons flameproof suit) I wouldn't stress these long 1
liners so popular in the Ruby community. There's no shame in using 4
short statements instead of one long one, and I think the average
programmer (not necessarily Ruby programmer) finds the 4 line version
easier to understand. Remember the complex 1 liners Kernighan and
Ritchie used in version 1 of "The C Language Book"? Weren't they
obnoxious? I have the same feeling about long and complex 1 liners in
Ruby.

I'm all with you. There's especially one idiom that makes me wonder why
people use it so often:

if ( foo = calculate_something() ) {
....
}

over

foo = calculate_something()
if ( foo ) {
....
}

It's reasonable to do it in a while loop because that often gives elegant
code by avoiding redundancy:

while ( ( item = io.read() ) != EOF ) ...

but I can't see a reason to do it with simple if statements.
Show them how beautifully Ruby encapsulates object member data, and
yet how easy it is to reveal them with methods with the same name.
Show attr_reader, attr_writer and attr_accessor. That was a BIG
selling point for me. Show them how, unlike Perl and Python, they
have full public, protected and private methods. Show them how much
easier inheritance is in Ruby than in C++. Show them just how easy it
is to make an operator represent a method. Sure, you can do that in
C++, but it's just not as easy.

When you get around to demonstrating blocks:

my_array.each{|element| puts element}

make the point that this feature saved them the need for a confusing
callback routine (pointer to function and the like).

But please use another example because this code is much easier written
"puts my_array". :)
Show them how to use yield() to create a method that can take a block.

Yeah!

Kind regards

robert
 
S

Steve Litt

Hmm, that's a tricky one to me. You really need to nail iterators
ASAP to become a Rubyist. If you post code here with a loop, odds
are good we'll start "correcting" it.

That's precisely my point. I'm advocating some "corretion". If you start a
non-motivated learner with iterators, he'll bail. The long term goal is to
turn him into a Rubyist, but the immediate goal is to have him accept Ruby
enough to learn a couple more things.
Also Ruby has no loop equivalent to the famous for(...; ...; ...)
{ ... } construct from most other languages.

for ss in 1...10
print ss, " Hello\n";
end

ss = 4
while ss > 0
puts ss
ss -= 1
end

The preceding are constructs they've seen in every language. Armed with these
two loops, it is now a perfect time to introduce object.each(){}, introducing
both iterators and blocks. Now show him how much more can be done with
object.each(){}. IMHO the important thing is to move from the known to the
unknown.
"Favor composition over inheritance." I think that's even more true
in Ruby where inheriting the core classes sometimes has surprising
side effects.

OK, show em how easy composition is, and how well it can be encapsulated.
attr_accessor rules.

SteveT

Steve Litt
http://www.troubleshooters.com
(e-mail address removed)
 
S

ssmoot

Thanks for the well thought out and thought-provoking reply!

This is great advice and I'll be sure to give it a lot more
consideration.

This is my fault for not being very clear. Actually the target audience
is an ASP/VBScript programmer, and a SQL developer who has focused on
Microsoft SQL Server 2000's DTS package development for the past few
years.

The mandate is that something is going to change. C# is up for
evaluation. Having done a lot of C#, used NHibernate, Aspect#, ASP.NET,
went to MonoRail, and then to Ruby and Rails, I'm very pro-Ruby.
Technically I suppose anything is up for evaluation, so we could throw
Java in the mix, but I don't see much reason to muddy the waters.

Naturally the more tools available the better IMO, and I plan to use C,
C++, C#, etc in the future, but I'm trying to make a focused effort
here and keep it simple.
 
J

James Edward Gray II

That's precisely my point. I'm advocating some "corretion". If you
start a
non-motivated learner with iterators, he'll bail. The long term
goal is to
turn him into a Rubyist, but the immediate goal is to have him
accept Ruby
enough to learn a couple more things.

It's an interesting idea.
for ss in 1...10
print ss, " Hello\n";
end

1. That's not a loop. (It's syntactic sugar for the each() iterator.)
2. It's not equivalent to for(...; ...; ...) { ... }.
3. I'm against teaching that at all. ;)
ss = 4
while ss > 0
puts ss
ss -= 1
end

If you're looking to go from ugly to pretty, I agree that you've
found ugly. ;)
OK, show em how easy composition is, and how well it can be
encapsulated.
attr_accessor rules.

"Push, don't pull." (I'm just full of great quotes today, eh?
<laughs>)

I think I understand what you're trying to say though...

James Edward Gray II
 
R

Robert Klemme

This is my fault for not being very clear. Actually the target
audience is an ASP/VBScript programmer, and a SQL developer who has
focused on Microsoft SQL Server 2000's DTS package development for
the past few years.

The mandate is that something is going to change. C# is up for
evaluation. Having done a lot of C#, used NHibernate, Aspect#,
ASP.NET, went to MonoRail, and then to Ruby and Rails, I'm very
pro-Ruby. Technically I suppose anything is up for evaluation, so we
could throw Java in the mix, but I don't see much reason to muddy the
waters.

From what you write it seems MS languages are a better choice than Java as
your people have quite a bit of experience in MS land.
Naturally the more tools available the better IMO, and I plan to use
C, C++, C#, etc in the future, but I'm trying to make a focused effort
here and keep it simple.

I'd leave C and C++ out of the mix if you're not forced to do low level
stuff. C# is powerful enough and it might be a good mix together with Ruby
(as replacement for VB?). OTOH the new VB has some nice features - I heard
it supports native threads now - something that Ruby can't at the moment.

Kind regards

robert
 
E

Ezra Zygmuntowicz

Thanks for the well thought out and thought-provoking reply!


This is great advice and I'll be sure to give it a lot more
consideration.


This is my fault for not being very clear. Actually the target
audience
is an ASP/VBScript programmer, and a SQL developer who has focused on
Microsoft SQL Server 2000's DTS package development for the past few
years.

The mandate is that something is going to change. C# is up for
evaluation. Having done a lot of C#, used NHibernate, Aspect#,
ASP.NET,
went to MonoRail, and then to Ruby and Rails, I'm very pro-Ruby.
Technically I suppose anything is up for evaluation, so we could throw
Java in the mix, but I don't see much reason to muddy the waters.

Naturally the more tools available the better IMO, and I plan to
use C,
C++, C#, etc in the future, but I'm trying to make a focused effort
here and keep it simple.


Hey-

I wrote a very simple primer for ruby blocks for iterators and how
yield works with a method for some people at sitepoint.com. It might
be of interest: http://www.sitepoint.com/forums/showthread.php?
t=329378

Cheers-
-Ezra
 
D

Dan Diebolt

--0-1700921862-1135799952=:46219
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
That URL didn't work, even when I pasted the wordwrapped parts together.

I have taken to using rubyurl instead of tinyurl:
=20
http://rubyurl.com/OSm=20

The only problem is that rubyurl does not handle https url correctly.

=09
 
S

ssmoot

I'd leave C and C++ out of the mix if you're not forced to do low level
stuff. C# is powerful enough and it might be a good mix together with Ruby
(as replacement for VB?).

I'd agree except that I really need to learn C++. It would really help
Rails adoption at my company to have an ISAPI RailsRunner for example.

Of course I agree 100% about c#, and I'm certainly planning on writing
plenty of it in the future, but for now, I just want to make sure Ruby
gets a strong foothold. At least until Rite arrives. ;-)

All of you have really helped make some great contributions to my
efforts though, and I appreciate the comments.
 
J

Josef 'Jupp' SCHUGT

Hi!

for ss in 1...10
print ss, " Hello\n";
end

For introduction I'd rather use:

for count in 1..9
print count
puts ". Hello"
end

It introduces both 'print' and 'puts', suggests using telling varible
names, uses quite common '..' (including end point) range in place of
rare '...' (excluding end point) range, and delays interpretation of
strings, the latter of which can then be introduced in a 'bells and
whistles' example showing the power of "#{...}".

But that is just my humble opinion.

Josef 'Jupp' Schugt
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top