Learning Ruby advice needed

While learning a new language, I find it very boring to read again the
same things like variable declaration, data types, loops etc. Somehow I
just brushed up quickly from a basic Ruby programming book, I learn fast
when I am working on a live project and read simultaneously.

With Ruby (and Python as well) there is a confusion for me. They don't
have a fixed IDE like Visual Studio for .NET. I am not dipping my hands
in Rails at this time but want to write simple Windows apps. to learn
the basic concepts. For this, I either need to learn wxRuby or FxRuby,
which are third-party implementations.

Please let me know how to practice basic Ruby? What type of applications
you wrote to practice and what topics you consider important before
jumping to Rails?

···

--
Posted via http://www.ruby-forum.com/.

...I find it very boring to read again the
same things like variable declaration, data types, loops etc.

So try to learn really different language like Prolog, Haskell, Pure,
Lisaac....
You'll be thrown enough for not being bored :slight_smile:

... want to write simple Windows apps. to learn
the basic concepts. For this, I either need to learn wxRuby or FxRuby,
which are third-party implementations.

Gui framework are too complexes for basic learning.
I use Shoes (green-shoes), but it is perhaps too rubish for the basic
learn (it use systematically block with instance_eval, DSL ...)

IDE as Visual studio...

Use irb constantly, and a simple editor will be ok (sublime, komodo
edit...)

Please let me know how to practice basic Ruby? What type of applications
you wrote to practice

* simple script for file manipulation, web scrapping,
* Very little web application with CGI and/or Sinatra :
   To-do-list manager, show task list/kill process, file explorer
   Vector drawing to client canvas, ...

And one big principle: never learn in writing production
code; learn by practice on micro 'game' subject.

and what topics you consider important

* blocs, yield (try to never use 'while') ,
* singleton class (very specific to ruby)
* thread/join/queue,
* error catching/log

···

--
Posted via http://www.ruby-forum.com/\.

Please let me know how to practice basic Ruby? What type of
applications you wrote to practice and what topics you consider
important before jumping to Rails?

Can't help with rails but here are a couple of fun ideas:

1. A tiny text-based game using the socket library (networked hunt the
  wumpus?) Using the network is pretty easy in ruby if you are used to
  doing it via the operating system.

2. Text-mode mandelbrot fractal. Easy if you were to only use one
character.

Damnit now I want to code these things.

Cheers
Johnny

Rubist Rohit wrote in post #998183:

Please let me know how to practice basic Ruby?

Chris Pine's "Learn To Program" has some neat ideas for practice
programs: http://pine.fm/LearnToProgram/

- j

···

--
Posted via http://www.ruby-forum.com/\.

I don't understand how you all feel so comfortable with "irb". It is
good for one line syntax. I want to create a simple Windows app. where I
want to keep classes in a separate file and UI in another file.

How is Aptana Studio 3 that comes bundled with RadRails?

···

--
Posted via http://www.ruby-forum.com/.

lol, did you read the "Land of Lisp", too?

···

On Thu, May 12, 2011 at 9:26 AM, Johnny Morrice <spoon@killersmurf.com>wrote:

> Please let me know how to practice basic Ruby? What type of
> applications you wrote to practice and what topics you consider
> important before jumping to Rails?

Can't help with rails but here are a couple of fun ideas:

1. A tiny text-based game using the socket library (networked hunt the
wumpus?) Using the network is pretty easy in ruby if you are used to
doing it via the operating system.

2. Text-mode mandelbrot fractal. Easy if you were to only use one
character.

Damnit now I want to code these things.

Cheers
Johnny

Try http://www.oldkingjames.org Learn to program there are a few Ruby lessons there - writing to files etc. -It is for beginners to actual programming.

···

Date: Fri, 13 May 2011 05:29:40 +0900
From: jakekaiden@yahoo.com
Subject: Re: Learning Ruby advice needed
To: ruby-talk@ruby-lang.org

Rubist Rohit wrote in post #998183:

> Please let me know how to practice basic Ruby?

Chris Pine's "Learn To Program" has some neat ideas for practice
programs: Learn to Program, by Chris Pine

- j

--
Posted via http://www.ruby-forum.com/\.

Yes, store your code in files. It's The Way (tm).

But irb lets you inside of your code.

It's a good way to exploit the reflexive properties of ruby.

So say we're reinventing pygame and have a file at ui/screen.rb that
looks like this:

class Screen

        # Draw a surface onto this screen
        def blit x, y, surface
                # Unimplemented
        end

        # Flip buffers
        def flip
                # Unimplemented
        end

        # Does this screen support OpenGL?
        def opengl?
                false
        end

end

You can load this into irb like so:

irb(main):001:0> require "./ui/screen"
=> true
irb(main):002:0> win = Screen.new

Then you can tell win to do things, or ask stuff of it. Like ask what
methods it has.

=> #<Screen:0x00000000a8a278
irb(main):003:0> win.methods

=> [:blit, :flip, :opengl?, :nil?, :=== ........and so on]

Considering you can do that with every single value in ruby, it's
pretty handy, no?

You can ask it what its class is:

irb(main):004:0> puts win.class
Screen
=> nil

Or you could get it to do something you've written. In this
case it just a query.

irb(main):005:0> puts win.opengl?
false
=> nil

I guess I just find it very handy! It's not really hugely exciting,
just very useful.

···

On Fri, 13 May 2011 01:01:29 +0900 Rubist Rohit <passionate_programmer@hotmail.com> wrote:

I don't understand how you all feel so comfortable with "irb". It is
good for one line syntax. I want to create a simple Windows app.
where I want to keep classes in a separate file and UI in another
file.

I don't understand how you all feel so comfortable with "irb". It is
good for one line syntax. I want to create a simple Windows app. where
I want to keep classes in a separate file and UI in another file.

These days, I use interactive_editor with irb:

    Use interactive_editor With irb For An Inside-Out Ruby IDE
    http://blogs.techrepublic.com.com/programming-and-development/?p=4125

How is Aptana Studio 3 that comes bundled with RadRails?

No clue. I've never used an IDE with Ruby -- and, frankly, I've never
needed one. I use Vim or vi in cases where I don't feel a need for irb,
and I use Vim or vi from within irb via interactive_editor when I do feel
a need for irb.

···

On Fri, May 13, 2011 at 01:01:29AM +0900, Rubist Rohit wrote:

--
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]

Rubist Rohit wrote in post #998271:

I don't understand how you all feel so comfortable with "irb". It is
good for one line syntax. I want to create a simple Windows app. where I
want to keep classes in a separate file and UI in another file.

How is Aptana Studio 3 that comes bundled with RadRails?

I never use irb or python's irb. I consider them a complete waste of
time.

···

--
Posted via http://www.ruby-forum.com/\.

lol, did you read the "Land of Lisp", too?

No! It looks fantastic though, cheers for putting me on to it.

I learned functional programming the dull and boring way by
implementing virtual Turing machines in Haskell. I really prefer their
sort of silly thing.

Uhh . . . technically, it's not "python's irb". It's Python's REPL, just
as irb is Ruby's REPL.

Just thought I'd mention. . . .

···

On Fri, May 13, 2011 at 02:52:14AM +0900, 7stud -- wrote:

Rubist Rohit wrote in post #998271:
> I don't understand how you all feel so comfortable with "irb". It is
> good for one line syntax. I want to create a simple Windows app. where I
> want to keep classes in a separate file and UI in another file.
>
> How is Aptana Studio 3 that comes bundled with RadRails?

I never use irb or python's irb. I consider them a complete waste of
time.

--
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]

Suddenly, enlightenment.

···

On Thu, May 12, 2011 at 7:52 PM, 7stud -- <bbxx789_05ss@yahoo.com> wrote:

I never use irb or python's irb. I consider them a complete waste of
time.

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

Glad to see I inspired you. A blog post and everything. I have hacked
that gem a bit a this point. Have you built anything on it?

···

On Thu, May 12, 2011 at 12:18 PM, Chad Perrin <code@apotheon.net> wrote:

On Fri, May 13, 2011 at 01:01:29AM +0900, Rubist Rohit wrote:

I don't understand how you all feel so comfortable with "irb". It is
good for one line syntax. I want to create a simple Windows app. where
I want to keep classes in a separate file and UI in another file.

These days, I use interactive_editor with irb:

Use interactive_editor With irb For An Inside-Out Ruby IDE
http://blogs.techrepublic.com.com/programming-and-development/?p=4125

How is Aptana Studio 3 that comes bundled with RadRails?

No clue. I've never used an IDE with Ruby -- and, frankly, I've never
needed one. I use Vim or vi in cases where I don't feel a need for irb,
and I use Vim or vi from within irb via interactive_editor when I do feel
a need for irb.

--
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]

I never use irb or python's irb. I consider them a complete waste of
time.

I find this sentiment rather amusing!

I do use irb on occasion but it does suck rather.

For instance, it has no memory of the last session (it does not keep
records like .bash_history).

? Funny, the irb I'm using does :slight_smile:

And +1 to using interactive_editor -- handiest new tool that I've found
in months... YMMV

···

On Thu, May 12, 2011 at 12:28 PM, Johnny Morrice <spoon@killersmurf.com> wrote:

I do use irb on occasion but it does suck rather.

For instance, it has no memory of the last session (it does not keep
records like .bash_history).

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

twitter: @hassan

I've just been using the heck out of it, for the most part, rather than
hacking interactive_editor itself. I mean, I puttered around in the
source (as the TechRepublic article should suggest to a reader), but I
have not yet found any particular need for making changes.

···

On Fri, May 13, 2011 at 03:34:06AM +0900, Stu wrote:

Glad to see I inspired you. A blog post and everything. I have hacked
that gem a bit a this point. Have you built anything on it?

--
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]

That's reasonably easy. Here's an example:

    http://snippets.dzone.com/posts/show/2586

···

On Fri, May 13, 2011 at 04:28:50AM +0900, Johnny Morrice wrote:

> I never use irb or python's irb. I consider them a complete waste of
> time.

I find this sentiment rather amusing!

I do use irb on occasion but it does suck rather.

For instance, it has no memory of the last session (it does not keep
records like .bash_history).

--
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]

It works well with pry as well.

···

On Thu, May 12, 2011 at 2:44 PM, Hassan Schroeder <hassan.schroeder@gmail.com> wrote:

On Thu, May 12, 2011 at 12:28 PM, Johnny Morrice <spoon@killersmurf.com> wrote:

I do use irb on occasion but it does suck rather.

For instance, it has no memory of the last session (it does not keep
records like .bash_history).

? Funny, the irb I'm using does :slight_smile:

And +1 to using interactive_editor -- handiest new tool that I've found
in months... YMMV

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
Hassan Schroeder | about.me
twitter: @hassan

? Funny, the irb I'm using does :slight_smile:

Ah good shout, I'll have to see what's wrong here. Thanks!