Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #4332 > unrolled thread

Learning Ruby advice needed

Started byRubist Rohit <passionate_programmer@hotmail.com>
First post2011-05-12 03:54 -0500
Last post2011-05-13 01:28 -0500
Articles 19 — 12 participants

Back to article view | Back to comp.lang.ruby


Contents

  Learning Ruby advice needed Rubist Rohit <passionate_programmer@hotmail.com> - 2011-05-12 03:54 -0500
    Re: Learning Ruby advice needed Regis d'Aubarede <regis.aubarede@gmail.com> - 2011-05-12 06:10 -0500
      Re: Learning Ruby advice needed Rubist Rohit <passionate_programmer@hotmail.com> - 2011-05-12 11:01 -0500
        Re: Learning Ruby advice needed Johnny Morrice <spoon@killersmurf.com> - 2011-05-12 11:57 -0500
        Re: Learning Ruby advice needed 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-12 12:52 -0500
          Re: Learning Ruby advice needed Phillip Gawlowski <cmdjackryan@googlemail.com> - 2011-05-12 13:30 -0500
          Re: Learning Ruby advice needed Johnny Morrice <spoon@killersmurf.com> - 2011-05-12 14:28 -0500
            Re: Learning Ruby advice needed Hassan Schroeder <hassan.schroeder@gmail.com> - 2011-05-12 14:44 -0500
              Re: Learning Ruby advice needed Stu <stu@rubyprogrammer.net> - 2011-05-12 14:48 -0500
              Re: Learning Ruby advice needed Johnny Morrice <spoon@killersmurf.com> - 2011-05-12 14:49 -0500
            Re: Learning Ruby advice needed Johnny Morrice <spoon@killersmurf.com> - 2011-05-12 19:46 -0500
        Re: Learning Ruby advice needed Stu <stu@rubyprogrammer.net> - 2011-05-12 13:34 -0500
          Re: Learning Ruby advice needed John Mair <jrmair@gmail.com> - 2011-05-13 09:23 -0500
            Re: Learning Ruby advice needed Adam Prescott <adam@aprescott.com> - 2011-05-13 10:02 -0500
    Re: Learning Ruby advice needed Johnny Morrice <spoon@killersmurf.com> - 2011-05-12 09:26 -0500
      Re: Learning Ruby advice needed Josh Cheek <josh.cheek@gmail.com> - 2011-05-12 13:20 -0500
        Re: Learning Ruby advice needed Johnny Morrice <spoon@killersmurf.com> - 2011-05-12 14:43 -0500
    Re: Learning Ruby advice needed jake kaiden <jakekaiden@yahoo.com> - 2011-05-12 15:29 -0500
      Re: Learning Ruby advice needed Alexander McMillan <alexandermcmillan@hotmail.com> - 2011-05-13 01:28 -0500

#4332 — Learning Ruby advice needed

FromRubist Rohit <passionate_programmer@hotmail.com>
Date2011-05-12 03:54 -0500
SubjectLearning Ruby advice needed
Message-ID<5c6d6fdb8d7a3429d3a5031248106dcd@ruby-forum.com>
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/.

[toc] | [next] | [standalone]


#4340

FromRegis d'Aubarede <regis.aubarede@gmail.com>
Date2011-05-12 06:10 -0500
Message-ID<eb7418c63516e9c79cbc710620c250cb@ruby-forum.com>
In reply to#4332
> ...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 :)


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

[toc] | [prev] | [next] | [standalone]


#4386

FromRubist Rohit <passionate_programmer@hotmail.com>
Date2011-05-12 11:01 -0500
Message-ID<8ba796d970e0b9c21bf1335f4111f0fb@ruby-forum.com>
In reply to#4340
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/.

[toc] | [prev] | [next] | [standalone]


#4391

FromJohnny Morrice <spoon@killersmurf.com>
Date2011-05-12 11:57 -0500
Message-ID<20110512175738.527d2bf8@killersmurf.com>
In reply to#4386
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.

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.

[toc] | [prev] | [next] | [standalone]


#4398

From7stud -- <bbxx789_05ss@yahoo.com>
Date2011-05-12 12:52 -0500
Message-ID<373a8d2ea13b264eea7d7f0bd77204fa@ruby-forum.com>
In reply to#4386
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/.

[toc] | [prev] | [next] | [standalone]


#4405

FromPhillip Gawlowski <cmdjackryan@googlemail.com>
Date2011-05-12 13:30 -0500
Message-ID<BANLkTimhyeSOwDJxyir9Hs-bfu-SEqyvNA@mail.gmail.com>
In reply to#4398
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.

Suddenly, enlightenment.

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

[toc] | [prev] | [next] | [standalone]


#4415

FromJohnny Morrice <spoon@killersmurf.com>
Date2011-05-12 14:28 -0500
Message-ID<20110512202750.23351198@killersmurf.com>
In reply to#4398
> 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).

[toc] | [prev] | [next] | [standalone]


#4419

FromHassan Schroeder <hassan.schroeder@gmail.com>
Date2011-05-12 14:44 -0500
Message-ID<BANLkTikKR3wm4YjnbN3m8by-JATUWS+QFg@mail.gmail.com>
In reply to#4415
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   :-)

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

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

[toc] | [prev] | [next] | [standalone]


#4421

FromStu <stu@rubyprogrammer.net>
Date2011-05-12 14:48 -0500
Message-ID<BANLkTik5x2ozkK05PXTADJNdWoyvmaeuzg@mail.gmail.com>
In reply to#4419
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   :-)
>
> And +1 to using interactive_editor -- handiest new tool that I've found
> in months...  YMMV
>
> --
> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
> http://about.me/hassanschroeder
> twitter: @hassan
>
>

[toc] | [prev] | [next] | [standalone]


#4422

FromJohnny Morrice <spoon@killersmurf.com>
Date2011-05-12 14:49 -0500
Message-ID<20110512204925.7aa9623f@killersmurf.com>
In reply to#4419
> ? Funny, the irb I'm using does   :-)

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

[toc] | [prev] | [next] | [standalone]


#4450

FromJohnny Morrice <spoon@killersmurf.com>
Date2011-05-12 19:46 -0500
Message-ID<20110513014516.412f23c9@killersmurf.com>
In reply to#4415
> > 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

Thanks!  I'm a bit glaikit sometimes: never thought of making it do
that!

Good craic
Thank you
Johnny

[toc] | [prev] | [next] | [standalone]


#4407

FromStu <stu@rubyprogrammer.net>
Date2011-05-12 13:34 -0500
Message-ID<BANLkTi=ArJQ341C=s2EOPDe0_vyWqxG0LQ@mail.gmail.com>
In reply to#4386
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 ]
>

[toc] | [prev] | [next] | [standalone]


#4491

FromJohn Mair <jrmair@gmail.com>
Date2011-05-13 09:23 -0500
Message-ID<f1093e800e276242213109fd61cea3d0@ruby-forum.com>
In reply to#4407
I added an `edit-method` command to pry, which works in principle 
similarly to interactive_editor.

Except you can just go `edit-method obj.meth` and the source file for 
the method is opened and fast forwarded to the first line of the method. 
The file is re-loaded once the editor returns to the pry session too. 
Check out the docs on the `edit-method` command here if you're 
interested

http://rdoc.info/github/banister/pry/master/file/README.markdown

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

[toc] | [prev] | [next] | [standalone]


#4497

FromAdam Prescott <adam@aprescott.com>
Date2011-05-13 10:02 -0500
Message-ID<BANLkTikQc2Bj+z46vMRpPHChNOSif-j3=A@mail.gmail.com>
In reply to#4491
[Note:  parts of this message were removed to make it a legal post.]

On Fri, May 13, 2011 at 3:23 PM, John Mair <jrmair@gmail.com> wrote:

> I added an `edit-method` command to pry, which works in principle
> similarly to interactive_editor.
>
> Except you can just go `edit-method obj.meth` and the source file for
> the method is opened and fast forwarded to the first line of the method.
> The file is re-loaded once the editor returns to the pry session too.
>

Cool!

[toc] | [prev] | [next] | [standalone]


#4366

FromJohnny Morrice <spoon@killersmurf.com>
Date2011-05-12 09:26 -0500
Message-ID<20110512152419.1799a83d@killersmurf.com>
In reply to#4332
> 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

[toc] | [prev] | [next] | [standalone]


#4402

FromJosh Cheek <josh.cheek@gmail.com>
Date2011-05-12 13:20 -0500
Message-ID<BANLkTikah3m+1A0ucB6+j9NF0UniVHdV8w@mail.gmail.com>
In reply to#4366
[Note:  parts of this message were removed to make it a legal post.]

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
>
>
lol, did you read the "Land of Lisp", too?

[toc] | [prev] | [next] | [standalone]


#4418

FromJohnny Morrice <spoon@killersmurf.com>
Date2011-05-12 14:43 -0500
Message-ID<20110512204310.66552482@killersmurf.com>
In reply to#4402
> 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.

[toc] | [prev] | [next] | [standalone]


#4429

Fromjake kaiden <jakekaiden@yahoo.com>
Date2011-05-12 15:29 -0500
Message-ID<681837d7708699902354f83dfcc3c244@ruby-forum.com>
In reply to#4332
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/.

[toc] | [prev] | [next] | [standalone]


#4463

FromAlexander McMillan <alexandermcmillan@hotmail.com>
Date2011-05-13 01:28 -0500
Message-ID<BAY152-w48DE7D75036E05FAE2672AA6880@phx.gbl>
In reply to#4429
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.ruby


csiph-web