The best practices to learn Ruby

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

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.

as for where and how to practice… irb is a valuable tool for seeing
under the hood of ruby. scite is a nice editor for longer apps, and by
pressing f5, you run the program and receive output (scite doesn’t
recognize the ‘gets’ command for input though… if you want to use
‘gets’ just use a regular text editor and run the program from the
command line.) basically any text editor will work, though something
with code highlighting is nice.

i’m using ruby, gtk2, and gstreamer now for an audio player i’m
writing…

play around and have fun!

-j

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

On Mon, Mar 21, 2011 at 06:27:14AM +0900, Fily S. wrote:

3-How did you learn Ruby?

4-What you use Ruby for?

Here’s an article that discusses some of the books and other resources
available to people new to ruby, and how they might be of some use:

Learn Ruby with these 10 books and other resources
http://blogs.techrepublic.com.com/programming-and-development/?p=3886

You’ve already found at least one of them – this mailing list.

Here’s another article, about approaches to learning to program:

Seven ideas for learning how to program
http://blogs.techrepublic.com.com/programming-and-development/?p=3308

My personal favorite, and probably the best-suited to learning to
program
via Ruby (or any language that fills a similar niche, including Perl,
Python, et cetera) is #6, scripting in the Unix environment.

One of the most simple types of script in design, as well as being one
of
the most useful (especially in a Unix-like environment), is writing
command line filters. Here’s an article that touches on that (not only
in Ruby, but in Perl and Bourne shell as well):

Simple filters in Perl, Ruby, and Bourne shell
http://blogs.techrepublic.com.com/programming-and-development/?p=3481

Aside from Unix environment scripting, another interesting approach you
could take is smartphone scripting. There’s a scripting environment
that
supports Ruby on Android called SL4A, and here’s an article that talks
briefly about that:

Try the SL4A scripting environment for your Android device
http://blogs.techrepublic.com.com/programming-and-development/?p=3932

In addition to SL4A, there’s also Ruboto, a straight-up JRuby
interpreter
that runs on Android. You can get that in the Android Market.

A somewhat gentle, though quick, introduction to Ruby via progressively
more complex variants of a Hello, World program is presented in this
article:

Five Ruby Hello World greetings
http://blogs.techrepublic.com.com/programming-and-development/?p=3177

I use Ruby for all kindsa stuff. I created an ASCII art fortune telling
program (similar to Tarot) for the fun of it recently. I write text
processing utilities regularly. I wrote an IRC dicebot for online
gaming
with the Isaac library, and here’s an article that talks about that:

Let Isaac help you build IRC bots
http://blogs.techrepublic.com.com/programming-and-development/?p=3784

I also wrote my own lightweight Weblog-style CMS in Ruby, and it’s what
I
use on my devlog (development Weblog, that is). A friend of mine,
meanwhile, has written spam filters, reminder software that integrates
with his calendar application, an IM and IRC client, proofreading helper
scripts, and a post-submission script for WordPress so he doesn’t have
to
open his browser to post something. He’s also a much better programmer
than me.

(Full disclosure: the above articles were all written by me, which is
why
I know where to find them all so easily.)

Best o’ luck. Ruby’s a fun language.

I specifically run a project about teaching Ruby:
http://hackety-hack.com/

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.

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

Thank you all very much for your help.

Chad P.

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

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.

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/programming-and-development/learn-ruby-with-these-10-books-and-other-resources/3886

I currently own “Learning to Program” and “FXRuby”.

Thanks

On 21.03.2011 17:07, Fily S. wrote:

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

Thank a lot Gregory B. 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!

On Tue, Mar 22, 2011 at 2:12 AM, Fily S. [email protected]
wrote:

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

hi fily -

don’t be afraid of the gui! (screenshot attached) all-ruby, and it
sounds good too…

best advice is definitely to dive into whatever you’re interested in,
that brings all the theory together into practical learning.

have fun -

j

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

Thank a lot!

On 3/20/11 5:27 PM, Fily S. wrote:

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?

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.

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

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:

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:

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.

3-How did you learn Ruby?

At first, I was learning Perl from a very good mentor (James Edward G.
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,

4-What you use Ruby for?

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.

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

On Tue, Mar 22, 2011 at 8:52 AM, J. K. [email protected] wrote:

and provides a native look to the widgets - and gstreamer for the audio.
just to figure out how to make sound come out of the speakers! - but
more wrinkles to iron out and i’ll be posting the first version on

That is incredibly cool and inspiring :slight_smile:

Thanks a lot for the info!

Fily S. [email protected] wrote:

3-How did you learn Ruby?

It wasn’t easy, so after I finally figured out what was going on, I
wrote a tutorial that might help you:

http://www.apeth.com/rubyIntro/justenoughruby.html

Be warned that this is pre-Ruby-1.9. m.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs