The best practices to learn Ruby

F

Fily Salas

Hi,

I'm currently trying to learn Ruby by watching tutorial reading books an
articles on the internet but I was wondering what would be the best way
to practice it if you dont use Ruby on Rails or dont have any projects
to work on

1-Where and how can I practice Ruby?

2-What kind of project can you do to get better on Ruby?

3-How did you learn Ruby?

4-What you use Ruby for?

Thanks
 
J

J. K.

hi fily -

i'd say the best way to learn ruby, just like anything else is to dive
in and try it.
i started by reading _why's poignant guide, and then writing some
(what now seem like) simple programs.
_why gives you some neat ideas for simple programs to start out with
(printing out the song 99 bottles of beer on the wall, for example...)
try to come up with some ideas on your own too. there are some good
ideas like writing a leap-year calculator (based on a range of years) or
determining what day of the week a certain date was.

i'm using ruby, gtk2, and gstreamer now for an audio player i'm
writing...

play around and have fun!


-j
 
F

Fily Salas

Thanks a lot for your comments!

I'm currently using the command line and sometimes irb I also have
installed FXRuby to try to build programs with some sort of GUI, I hope
i'm on the right path because I dont think I will be using RoR some time
soon until I have a good understanding of the language.

Thanks a lot
 
B

Brandon LaRocque

Every time I've used hackety-hack, I've always run into show-stopping bugs.
 
S

Steve Klabnik

[Note: parts of this message were removed to make it a legal post.]

Windows? My bad, I'm working on the stability. Damn Ruby 1.9.1... of course,
it works great on my system, but threading causes some issues on others'.

If not, mind emailing me off-list, and letting me know what they are? Other
than the random Windows crashes, I'm not currently aware of anything
'show-stopping' outside of that.
 
F

Fily Salas

Thank you all very much for your help.
Chad Perrin

Very good articles thanks.

One more question, is it possible to run a script in a computer that
doesn't have Ruby installed? Not an executable program,just a simple
script that you may want to share with your friends.

Thanks a lot
 
C

Chris Kottom

[Note: parts of this message were removed to make it a legal post.]

Running the script requires a Ruby interpreter of some kind. So the author
doesn't necessarily need to have it installed, but the person who wants to
execute it certainly does.
 
F

Fily Salas

Thank you all very much!

It looks like the main thing is to start scripting a lot. I will try to
find some ideas to start creating some programs to automate some
processes, I think this will be hardest part for me since I don't see
too many options (at least at the moment).

I will also try to buy some books listed here ...
http://www.techrepublic.com/blog/pr...-with-these-10-books-and-other-resources/3886

I currently own "Learning to Program" and "FXRuby".

Thanks
 
G

Gregory Brown

There are lots of ways to practice, and a lot of places to do it. It
really depends on what your interests are and what sort of things you
want to build. I would say though, that tutorials, books, and articles
should be used as learning aides, not as a way to learn. If you study
programming concepts in isolation of active practice on real things you
care about, and don't actually build stuff, you may learn the concepts
but not get anything out of your effort.

Once you have an idea for a project to work on, your ability to make the
most out of tutorials and books will go way up, since you can
automatically filter the information and seek out the stuff most
relevant to you, or at least come up with good questions so that others
can help point you in the right direction.

Any project you work on will improve your programming experience if it's
something that is useful and interesting to you. What kind of work do
you do day to day? Can you think of a way that some software could
improve your daily life? If your hands are tied at work, what are your
hobbies? Is there a way you can write programs to support those activities?

If you're just looking to program for the joy of learning, is there any
kinds of software out there that really excite you and that you'd like
to learn more about? You might learn a lot about those programs if you
attempt to build something similar yourself, but only focus on the
features you really need. Or, you could build a tool to compliment some
existing software you use in some way, something that takes something
you like and makes it even better.

If none of those things spark any ideas, you could consider working on
some puzzles. You could try any of the following:

* http://projecteuler.net/
* http://rubyquiz.com/
* http://ipsc.ksp.sk/
* http://puzzlenode.com (Just launched, this is a project of mine)

I love working on puzzles and programming challenges, but I'll confess
that I don't think they're as valuable as learning tools as people tend
to make them seem. You will learn a ton from a puzzle, but not
necessarily about specific skills that you can use to build tools that
make your life better. That puts them in the same category as other
sorts of entertainment/personal development for me, such as meditation
practice, exercise, and playing board games. Just because something is
fun and good for you doesn't mean it's going to make you good at
something that matters to you.

Of course, if you're new to Ruby, you will need to do a certain amount
of practice with the fundamentals. I think that working on real code is
the best way to do that, but it really helps to do some drills too. For
that, something like Ruby Koans or Hackety Hack are really going to give
you some good base knowledge to work from:

* http://rubykoans.com/
* http://hackety-hack.com/

Finally, I should mention that I run a school for intermediate Ruby
developers which is very supportive of helping people learn. You may not
be at the level yet where you could make the best use of our resources,
but there are lots of problems and exercises listed on our website at
http://university.rubymendicant.com that can at least help you benchmark
your own skillset. We also have lots of nice people in the #rmu channel
on IRC, and do occasional public events for helping beginners, which
might be worthwhile for you.

At first, I was learning Perl from a very good mentor (James Edward Gray
II). He and I both got into Ruby at the same time, and he was a much
more experienced programmer than I was at the time, so I leaned on him a
lot and asked him a lot of questions. This was back in 2004, and I'd say
that a huge amount of my Ruby learning was thanks to this mailing list
as well.

But mostly, I wrote a lot of code on projects that I cared about, and
talked to people / read things to try to improve my craft. As I learned
more, I tried to teach more, because that's a very good way to learn.
Try to write even the most basic tutorial or advice for someone else and
you'll discover lots of holes in your own knowledge that need filling,

I mostly program exclusively in Ruby these days, only because I don't
have a particularly need for using other languages. When I was doing
active consulting work, I used Ruby to do backend work for a lot of
complex business applications, especially reporting related stuff. I'm
the original author of the now-outdated Ruby Reports library and the
not-outdated PDF generation library Prawn.

These days, I use Ruby for supporting the infrastructure of Ruby
Mendicant University, but I confess that most of our actual coding work
is done by our technical co-founder Jordan Byron. So my programming has
become more about building things like games and simulators for the
students at RMU to play with, and of course, whatever scripting makes my
day to day life easier.

Ruby can be used for pretty much anything, and as a programmer, I try to
write code whenever a solution to my problem doesn't exist or isn't to
my liking. That puts me all over the map in terms of the code I write.

-greg

NOTE: I'm not as active on ruby-talk as I once was, but you can follow
@seacreature on twitter to keep up with my latest projects and updates
if you'd like. I'm going to try to check out posts here once or twice a
week and get back into the swing of things, but in case I disappear
again, that's where you'll find me.
 
R

Robert Klemme

It looks like the main thing is to start scripting a lot. I will try to
find some ideas to start creating some programs to automate some
processes, I think this will be hardest part for me since I don't see
too many options (at least at the moment).

Well, is there anything writing textual log files where you work? If so
you could tackle some toy projects reading those log files and
generating interesting statistics. That way you can learn basic file
handling and also various methods to parse data (e.g. parsing timestamps
and creating Time instances from them, parsing error messages etc.). Or
you could parse output of "last" command (if on some kind of Unix) and
generate statistics how often your system was booted per day or how many
days it took etc.

Kind regards

robert
 
F

Fily Salas

Thank a lot Gregory Brown for the good info.
What kind of work do you do day to day?
Can you think of a way that some software could improve your daily life?
If your hands are tied at work, what are your hobbies?
Is there a way you can write programs to support those activities?

Well, I work full time as a Mechanical Engineer with 3D CAD programs
like SolidWorks, but my big hobbies are design and create web sites, I
love to code HTML, CSS, jQuery and Actionscript 3.0 by hand even though
I'm not an expert on any of these languages I feel confortable using
them. Now that I started reading your reply I think you are 100% correct
when you say that practice is the real key since I feel like reading and
reading can help but its easy to forget what you read if you dont put it
in practice.

It looks like I was at first thinking about programming as programs with
GUI and never thought about scripting.

Can you some how interact with programs like Word, Excel or any other
known program or you need to have access to the core files, which of
course is out of my reach?

Sorry if my question doesn't make any sense but believe it or not I'm
learning a lot in this forum, you guys are awesome!

Thank you all very much for your help!
 
P

Phillip Gawlowski

It looks like I was at first thinking about programming as programs with
GUI and never thought about scripting.

Well, depending on your personal pain-threshold, there's several Ruby
GUI libraries. Easiest to start with would probably be Ruby-GNOME on a
GNOME desktop Linux (like Ubuntu). There are also Windows variants of
the major GUI libraries, like Qt, or wxWidgets.
Can you some how interact with programs like Word, Excel or any other
known program or you need to have access to the core files, which of
course is out of my reach?

You can access MS Office programs via OLE. Handily, Ruby has a
win32ole gem (or it's even part of the standard library, I forget),
which allows you to access Excel, Outlook, Word, anything that
supports OLE, really.

Here are some (outdated: They are mostly for Ruby 1.8.6, while 1.9.2
is the current version) guides to OLE with Ruby:

http://rubyonwindows.blogspot.com/

--
Phillip Gawlowski

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

Fily Salas

Wow! nice, was it done all in Ruby? What did you use as GUI, FXRuby,
Shoes etc...?

Thank a lot!
 
J

J. K.

Fily Salas wrote in post #988710:
Wow! nice, was it done all in Ruby? What did you use as GUI, FXRuby,
Shoes etc...?

Thank a lot!

hi fily,

thanks - yep, all done in ruby (i don't know anything else!) i use
gnome2 for the GUI - it's well documented, stable, in active development
and provides a native look to the widgets - and gstreamer for the audio.
you can check out gnome2 here: http://ruby-gnome2.sourceforge.jp/ ...
there's also a subsection of this forum dedicated to gnome2 which is
extremely helpful.

i only started playing around with ruby about a year ago, and i
couldn't agree more with greg, that the best way to learn is to start
coding something that interests you. i'm no kind of programmer
whatsoever, but i love music, have a huge music collection, and haven't
been satisfied with any audio players i've found - so i decided to write
my own. the thing started out quite simple - in fact it took me a while
just to figure out how to make sound come out of the speakers! - but
greg's point is a good one - if you've got a goal in mind, it makes
reading all the tutorials and forum advice make sense, as you filter it
for your own needs and put it into practice. after managing to make
some sounds, it was a step by step process getting things the way i
wanted them. the player now changes the "picture-disc" with each track,
the tone-arm moves with the song progress, and functions as a seek bar -
i've got a playlist and file selection dialog, drag and drop file and
directory entry.... etc.etc.etc.
i've still got a lot of things i want to add (equalizer, spectrum
analyzer, etc.) but it basically functions well at this point. got some
more wrinkles to iron out and i'll be posting the first version on
ruby-forge with a link here on the forum, so you can get an idea of
where a year of fiddling around got me...

happy coding!

-j
 
J

J. K.

Fily Salas wrote in post #988710:
Wow! nice, was it done all in Ruby? What did you use as GUI, FXRuby,
Shoes etc...?

Thank a lot!

hi fily,

thanks - yep, all done in ruby (i don't know anything else!) i use
gnome2 for the GUI - it's well documented, stable, in active development
and provides a native look to the widgets - and gstreamer for the audio.
you can check out gnome2 here: http://ruby-gnome2.sourceforge.jp/ ...
there's also a subsection of this forum dedicated to gnome2 which is
extremely helpful. ah, i realized the screenshot i attached to the last
post is an old one - got it looking a bit better now - attached a new
shot.

i only started playing around with ruby about a year ago, and i
couldn't agree more with greg, that the best way to learn is to start
coding something that interests you. i'm no kind of programmer
whatsoever, but i love music, have a huge music collection, and haven't
been satisfied with any audio players i've found - so i decided to write
my own. the thing started out quite simple - in fact it took me a while
just to figure out how to make sound come out of the speakers! - but
greg's point is a good one - if you've got a goal in mind, it makes
reading all the tutorials and forum advice make sense, as you filter it
for your own needs and put it into practice. after managing to make
some sounds, it was a step by step process getting things the way i
wanted them. the player now changes the "picture-disc" with each track,
the tone-arm moves with the song progress, and functions as a seek bar -
i've got a playlist and file selection dialog, drag and drop file and
directory entry, it's scalable and configurable.... etc.etc.etc.
i've still got a lot of things i want to add (equalizer, spectrum
analyzer, etc.) but it basically functions well at this point. got some
more wrinkles to iron out and i'll be posting the first version on
ruby-forge with a link here on the forum, so you can get an idea of
where a year of fiddling around got me...

happy coding!

-j

Attachments:
http://www.ruby-forum.com/attachment/6056/Screenshot.jpg
 
J

Josh Cheek

[Note: parts of this message were removed to make it a legal post.]

Fily Salas wrote in post #988710:

hi fily,

thanks - yep, all done in ruby (i don't know anything else!) i use
gnome2 for the GUI - it's well documented, stable, in active development
and provides a native look to the widgets - and gstreamer for the audio.
you can check out gnome2 here: http://ruby-gnome2.sourceforge.jp/ ...
there's also a subsection of this forum dedicated to gnome2 which is
extremely helpful.

i only started playing around with ruby about a year ago, and i
couldn't agree more with greg, that the best way to learn is to start
coding something that interests you. i'm no kind of programmer
whatsoever, but i love music, have a huge music collection, and haven't
been satisfied with any audio players i've found - so i decided to write
my own. the thing started out quite simple - in fact it took me a while
just to figure out how to make sound come out of the speakers! - but
greg's point is a good one - if you've got a goal in mind, it makes
reading all the tutorials and forum advice make sense, as you filter it
for your own needs and put it into practice. after managing to make
some sounds, it was a step by step process getting things the way i
wanted them. the player now changes the "picture-disc" with each track,
the tone-arm moves with the song progress, and functions as a seek bar -
i've got a playlist and file selection dialog, drag and drop file and
directory entry.... etc.etc.etc.
i've still got a lot of things i want to add (equalizer, spectrum
analyzer, etc.) but it basically functions well at this point. got some
more wrinkles to iron out and i'll be posting the first version on
ruby-forge with a link here on the forum, so you can get an idea of
where a year of fiddling around got me...

happy coding!

-j
That is incredibly cool and inspiring ^_^
 

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,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top