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?

…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

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

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?

On Fri, 13 May 2011 01:01:29 +0900
Rubist R. [email protected] 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.

Yes, store your code in files. It’s The Way ™.

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.

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

Please let me know how to practice basic Ruby?

Pick a window’s text editor and have at it. There are probably 100,000
posts about which text editor to use for any given language.

On Thu, May 12, 2011 at 9:26 AM, Johnny M.
[email protected]wrote:

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

Damnit now I want to code these things.

Cheers
Johnny

lol, did you read the “Land of Lisp”, too?

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

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

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 01:01:29AM +0900, Rubist R. 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.

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 7:52 PM, 7stud – [email protected]
wrote:

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

Suddenly, enlightenment.


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.

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

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.

On Thu, May 12, 2011 at 12:28 PM, Johnny M. [email protected]
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

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

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

It works well with pry as well.

On Thu, May 12, 2011 at 2:44 PM, Hassan S.

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?

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 04:28:50AM +0900, Johnny M. 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).

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

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

Rubist R. wrote in post #998183:

Please let me know how to practice basic Ruby?

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

  • j

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.

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