[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Good exercises for beginner

Sam Haskins

7/23/2008 11:39:00 AM

Hello all,

I am an unexperienced programer, and though things like why's guide
and other tutorials do a good job of explaining syntax, I am trying to
develop experience in making real projects. I have tried to do the
ruby quizzes, but they are a bit too hard; I don't yet have a great
feel for the best way to approach problems, and so I ended up having
to consult how other people solved the quizzes to get over stuck points.

Are there simpler exercises out there that would be good for a noob
like me, or do you think that reading code for a while might do better
for familiarizing me with technique?

6 Answers

Chris Lowis

7/23/2008 12:01:00 PM

0

> I have tried to do the  
> ruby quizzes, but they are a bit too hard;

There's some discussion on recommended "easier" ruby quizzes here:

http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/56715eaf2f9a657/5739f21adceca0d1?lnk=gst&q=easier+ruby+quiz#5739f2...

I don't think there's any shame in looking at "the answers" after
you've given the quiz a good try yourself -- on the contrary, reading
other peoples code is an excellent way to learn. Ruby quiz solutions
can be small enough to understand in their entirety, unlike the code-
base of a large open source project, for example.

Good luck,

Chris

David A. Black

7/23/2008 1:03:00 PM

0

Hi --

On Wed, 23 Jul 2008, Sam Haskins wrote:

> Hello all,
>
> I am an unexperienced programer, and though things like why's guide and other
> tutorials do a good job of explaining syntax, I am trying to develop
> experience in making real projects. I have tried to do the ruby quizzes, but
> they are a bit too hard; I don't yet have a great feel for the best way to
> approach problems, and so I ended up having to consult how other people
> solved the quizzes to get over stuck points.
>
> Are there simpler exercises out there that would be good for a noob like me,
> or do you think that reading code for a while might do better for
> familiarizing me with technique?

A very good source of exercises is to try to (re)implement some of
Ruby's core methods in Ruby. For example, you could implement
Array#each like this:

class Array
def my_each
i = 0
until i == size
yield self[i]
i += 1
end
self
end
end

and similarly (though a bit more complexly) with other methods like
select and map. Sometimes this takes you into a more "low-level" style
of programming than you might use normally (like, maintaining an
explicit counter rather than just using an iterator), but it's very
good practice and a good way to learn.


David

--
Rails training from David A. Black and Ruby Power and Light:
Intro to Ruby on Rails July 21-24 Edison, NJ
* Advancing With Rails August 18-21 Edison, NJ
* Co-taught by D.A. Black and Erik Kastner
See http://www.r... for details and updates!

Martin DeMello

7/23/2008 4:35:00 PM

0

On Wed, Jul 23, 2008 at 4:38 AM, Sam Haskins <sam.haskins@gmail.com> wrote:
> Hello all,
>
> I am an unexperienced programer, and though things like why's guide and
> other tutorials do a good job of explaining syntax, I am trying to develop
> experience in making real projects. I have tried to do the ruby quizzes, but
> they are a bit too hard; I don't yet have a great feel for the best way to
> approach problems, and so I ended up having to consult how other people
> solved the quizzes to get over stuck points.
>
> Are there simpler exercises out there that would be good for a noob like me,
> or do you think that reading code for a while might do better for
> familiarizing me with technique?

I wrote http://zem.novylen.net/ruby/tutorial/arithmetic-quiz/...
to be a good learning project. It's intended as a followup to Chris
Pine's excellent http://pine.fm/Learn..., so if you haven't
done that one already go through it first.

martin

Todd Benson

7/23/2008 4:57:00 PM

0

On Wed, Jul 23, 2008 at 6:38 AM, Sam Haskins <sam.haskins@gmail.com> wrote:
> I have tried to do the ruby quizzes, but
> they are a bit too hard; I don't yet have a great feel for the best way to
> approach problems, and so I ended up having to consult how other people
> solved the quizzes to get over stuck points.

Try the quizes and make extensive use of irb. Best education, ever.
One thing you should try to avoid is what I used to do, that being
trying to make it perfect on the first try.

Todd

Siep Korteling

7/23/2008 8:51:00 PM

0

Sam Haskins wrote:
> Hello all,
>
> I am an unexperienced programer, and though things like why's guide
> and other tutorials do a good job of explaining syntax, I am trying to
> develop experience in making real projects.

http://www.projec... starts with some easy stuff. When you solve
one, you can see how others did it, in all kinds of languages.

Regards,

Siep
--
Posted via http://www.ruby-....

Marc Heiler

7/23/2008 9:08:00 PM

0

> I have tried to do the ruby quizzes, but they are
> a bit too hard

I could recommend one of these:

- write a simple IRC bot in ruby (hehehe that was my first task)
- write a simple 2 players game (but a bit more complex than "guess a
number", maybe name the capitals of some countries, and store that in a
yaml file)

Or, if you feel adventureous you could try to write a single .rb file
which teaches you ruby. While writing this .rb file, you could write
ruby code.

No kidding btw, this is how I have collected my local FAQ. It is quite
large by now :)
--
Posted via http://www.ruby-....