Forum: Ruby Ruby Curriculum for coworkers

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2005-12-28 17:43
(Received via mailing list)
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 T. 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 D.) (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!
Steve L. (Guest)
on 2005-12-28 18:14
(Received via mailing list)
On Wednesday 28 December 2005 10:42 am, removed_email_address@domain.invalid 
wrote:
[clip]
> 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 L.
http://www.troubleshooters.com
removed_email_address@domain.invalid
James G. (Guest)
on 2005-12-28 18:38
(Received via mailing list)
On Dec 28, 2005, at 10:13 AM, Steve L. wrote:

> 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 G. II
Robert K. (Guest)
on 2005-12-28 18:51
(Received via mailing list)
Steve L. <removed_email_address@domain.invalid> wrote:
>> not very good at marketing. (Which I think is really key here).
> 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... :-)

> 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.

>
> 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
Steve L. (Guest)
on 2005-12-28 18:57
(Received via mailing list)
On Wednesday 28 December 2005 11:37 am, James Edward G. II wrote:
> On Dec 28, 2005, at 10:13 AM, Steve L. wrote:
> > 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.

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.

>
> > 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.

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

SteveT

Steve L.
http://www.troubleshooters.com
removed_email_address@domain.invalid
unknown (Guest)
on 2005-12-28 19:03
(Received via mailing list)
Thanks for the well thought out and thought-provoking reply!

>> In teaching these reluctant learners, I would work from the known to the
>> unknown -- a standard technique for teachers.

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

>> These people have probably been hammering C for years

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.
James G. (Guest)
on 2005-12-28 19:18
(Received via mailing list)
On Dec 28, 2005, at 10:54 AM, Steve L. wrote:

> 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.

>> 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

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.  ;)

>>> 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.
>
> 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 G. II
Robert K. (Guest)
on 2005-12-28 19:30
(Received via mailing list)
removed_email_address@domain.invalid wrote:
> 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
Ezra Z. (Guest)
on 2005-12-28 20:43
(Received via mailing list)
On Dec 28, 2005, at 9:02 AM, removed_email_address@domain.invalid wrote:

>
> 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
Steve L. (Guest)
on 2005-12-28 20:58
(Received via mailing list)
On Wednesday 28 December 2005 01:40 pm, Ezra Z. wrote:

> 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

That URL didn't work, even when I pasted the wordwrapped parts together.

SteveT

Steve L.
http://www.troubleshooters.com
removed_email_address@domain.invalid
Dan D. (Guest)
on 2005-12-28 22:02
(Received via mailing list)
>That URL didn't work, even when I pasted the wordwrapped parts together.

  I have taken to using rubyurl instead of tinyurl:

  http://rubyurl.com/OSm

  The only problem is that rubyurl does not handle https url correctly.
unknown (Guest)
on 2005-12-28 23:51
(Received via mailing list)
> 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.
Chad P. (Guest)
on 2005-12-29 01:18
(Received via mailing list)
On Thu, Dec 29, 2005 at 03:56:33AM +0900, Steve L. wrote:
>
It worked for me:

http://www.sitepoint.com/forums/showthread.php?t=329378

Maybe you just caught it at a time when there was a network hiccup, or
something like that.

--
Chad P. [ CCD CopyWrite | http://ccd.apotheon.org ]

This sig for rent:  a Signify v1.14 production from
http://www.debian.org/
Josef 'Jupp' SCHUGT (Guest)
on 2005-12-29 21:45
(Received via mailing list)
Hi!

At Thu, 29 Dec 2005 01:54:20 +0900, Steve L. wrote:
> 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
This topic is locked and can not be replied to.