Forum: Ruby New to Ruby and Programming

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Will S. (Guest)
on 2006-01-02 07:25
(Received via mailing list)
Hi folks. Happy New Year!

I have lurked for a little bit to see what this list is like.  I am
please to see how helpful people are.  I have a couple of questions
for someone starting out with Ruby and Programming in general.

Some background... I have some fundamental understanding of
programming, but I have more holes in my foundation than not.  I work
with some friends on a C# project, I learned some basics of Java so I
kind of understand OOP.  But I still do not grasp a lot.

My question:  Where should I start in learning to use Ruby?  I have
some ideas, but I do not want to prejudice the discussion with my
ideas.

Also, I have a project in mind to use Ruby... A Nethack bot.  A friend
programmed one in C# and I thought it would be fun to try and use
Ruby.  I know I have a long way to go but it would be fun for me.

Anyway, thanks for any advice and help you can offer in this new
adventure.

Will



--
Will S.  ( willshattuck.at.gmail.com )
Home Page:  http://www.thewholeclan.com/will

When you get to your wit's end, you'll find God lives there.
M. Edward (Ed) Borasky (Guest)
on 2006-01-02 07:37
(Received via mailing list)
Chris P.'s "Learn to Program" is available now from Pragmatic
Programmers. I'd start there.

Will S. wrote:

>
>Will
>
>

--
M. Edward (Ed) Borasky

http://linuxcapacityplanning.com
J. Ryan S. (Guest)
on 2006-01-02 08:14
(Received via mailing list)
Can you list and describe the programs you've developed in the past?
Were they school related or side projects for fun or for profit?

~ ryan ~
James B. (Guest)
on 2006-01-02 08:32
(Received via mailing list)
Will S. wrote:
>
> My question:  Where should I start in learning to use Ruby?  I have
> some ideas, but I do not want to prejudice the discussion with my
> ideas.


Try here:

http://ruby-doc.org/gettingstarted/

Many resources to get you going. And browse around ruby-doc.org in
general.

James B.


--

http://www.ruby-doc.org       - Ruby Help & Documentation
http://www.artima.com/rubycs/ - Ruby Code & Style: Writers wanted
http://www.rubystuff.com      - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com     - Playing with Better Toys
http://www.30secondrule.com   - Building Better Tools
Will S. (Guest)
on 2006-01-02 08:32
(Received via mailing list)
On 1/1/06, J. Ryan S. <removed_email_address@domain.invalid> wrote:
> Can you list and describe the programs you've developed in the past?
> Were they school related or side projects for fun or for profit?
>
> ~ ryan ~
>

Well... that's just it.  I haven't developed anything really.  I have
done some web programming with PHP, but that has usually consisted of
modifying someone else's work.  So basically nothing :(  That's why I
wanted to start with Ruby.  I noticed that I can cut out many lines of
code by using Ruby so I figured it would be a good start.

Will
J. Ryan S. (Guest)
on 2006-01-02 08:50
(Received via mailing list)
Sounds like your at the cusp of a new and exciting thing, so I want
to give you the best advice I can.

Here's the table of contents from the book "Learning To Program" that
Ed Borasky suggested in a previous post. (http://
www.pragmaticprogrammer.com/titles/fr_ltp/)  Just by glancing at the
chapter titles, which of them seem new, familiar, and old news to you
in terms of your past programming experience?

1. Getting Started
2. Numbers
3. Letters
4. Variables and Assignment
5. Mixing It Up
6. More about Methods
7. Flow Control
8. Arrays and Iterators
9. Writing Your Own Methods
10. There's Nothing New to Learn in Chapter 10
11 Reading and Writing, Saving and Loading, Yin and...
12. New Classes of Objects
13. Creating New Classes, Changing Existing Ones
14. Blocks and Procs

~ ryan ~
Will S. (Guest)
on 2006-01-02 09:20
(Received via mailing list)
On 1/1/06, J. Ryan S. <removed_email_address@domain.invalid> wrote:
> Sounds like your at the cusp of a new and exciting thing, so I want
> to give you the best advice I can.
>

Yep, I am about as crispy... er... cuspy as they come right now :)

> Here's the table of contents from the book "Learning To Program" that
> Ed Borasky suggested in a previous post. (http://
> www.pragmaticprogrammer.com/titles/fr_ltp/)  Just by glancing at the
> chapter titles, which of them seem new, familiar, and old news to you
> in terms of your past programming experience?
>
> 1. Getting Started
It seems I am always doing this with learning to program

> 2. Numbers
> 3. Letters
a..b..c..d..e..f..g.. yep I know my numbers and letters, but I am sure
I don't know what they mean in the Ruby Context.

> 4. Variables and Assignment
Creating and assigning values to variables I understand.  I have done
it in my C# scripting for the mud engine I am helping to create.  foo
= bar; etc etc  ... Then I know how to test for (in)equality... foo ==
bar, foo != bar, foo < bar, etc etc

> 5. Mixing It Up
Not sure what they mean here...

> 6. More about Methods
This is probably where I get hung up the most with classes, methods,
instances, instantiation, encapsulation,etc

> 7. Flow Control
IF, ELSE, THEN, WHILE, etc. I understand the concepts, but will have
to learn The Ruby Way to make them work.

> 8. Arrays and Iterators
I touched on arrays in the "Head Start Java" book I was learning from,
but never got very far.  Iterators are like " foo = foo +1"  or " foo
+= foo " right?

> 9. Writing Your Own Methods
Methods that are inside classes?  Again another place I have a very
basic concept of, but haven't done much with.

> 10. There's Nothing New to Learn in Chapter 10
> 11 Reading and Writing, Saving and Loading, Yin and...
File operations.. I did very little of it. I wanted to write a file
parser in PHP for game group for editing files, but didn't understand
the functions very much.  I understand the concepts, but not the
application.

> 12. New Classes of Objects
> 13. Creating New Classes, Changing Existing Ones
Well I have learned to modify templates, variables, etc in previous
applications, but haven't created any new classes or objects on my
own.

> 14. Blocks and Procs
One word... huh? ;)

>
> ~ ryan ~
>

Thanks for taking the time, Ryan, in helping me.  I really appreciate
all the suggestions.

I'm looking at an older version of "Learn to Program" by Chris P.
that I find in the links that James B. sent.  But I'm starting to
fall asleep now so I probably won't go very far right yet. heh

Will
Scott Smith (Guest)
on 2006-01-02 09:29
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nah, iterating is where you step through the elements of an array. Your
examples are simply assignments--giving a value to a variable (think
basic algebra).

Methods are basically chunks of code split up so they can be reused in
other places. Also good for code maintenance--instead of having one huge
chunk of code, it is broken into smaller bits.

Do you actually have a need to write anything, or is it more of a "Hey
I'd like to learn this, it sounds interesting" thing? It sounds like
most of your prior forays into programming have been the latter. I find
that I learn (and more specifically RETAIN) much much better when I have
a direct need. I can't just grab a book and learn an arbitrary language
just for the hell of it. Something will eventually come up a few days
into it or whatever and I won't have a specific need to keep focused on
it.

Scott

Will S. wrote:

> basic concept of, but haven't done much with.
- --
removed_email_address@domain.invalid
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)

iD8DBQFDuNZQKBeC2yZ3EEsRAkWVAKCGm//cJaKzp1mZ/B/mSpK2ybtt/ACghue4
erRZIJPmDqCnF5uDQmPYjlA=
=tlVU
-----END PGP SIGNATURE-----
J. Ryan S. (Guest)
on 2006-01-02 09:32
(Received via mailing list)
Seems like this book is a good match for you.  And the price is right
too: $20 for a paper back, $13 for the PDF version, or $25 for both.

Also, the "Pickaxe" book is pretty much the standard for learning
Ruby.  I'm not sure if its at the appropriate level for you, but the
first edition is freely available online.  http://www.rubycentral.com/
book/

~ ryan ~
Wilson B. (Guest)
on 2006-01-02 09:38
(Received via mailing list)
On 1/2/06, Will S. <removed_email_address@domain.invalid> wrote:
>
> My question:  Where should I start in learning to use Ruby?  I have
> some ideas, but I do not want to prejudice the discussion with my
> ideas.
>
> Also, I have a project in mind to use Ruby... A Nethack bot.  A friend
> programmed one in C# and I thought it would be fun to try and use
> Ruby.  I know I have a long way to go but it would be fun for me.
>
> Anyway, thanks for any advice and help you can offer in this new adventure.
>

Others have already given very good answers on how to learn Ruby.. but
if you want to learn the fundamentals of programming as a concept
(rather than any specific implementation of that..), I don't think
there's anything better than:
http://www.htdp.org/
..and
http://www2.info.ucl.ac.be/people/PVR/book.html
In theory the second book is only available in hardcover.. but the
Internet Archive still has the old free PDF version, from before it
went to press:
http://web.archive.org/web/20040202004840/http://w...

(The final version has corrections and improvements. If you can afford
it, I recommend it.)
James B. (Guest)
on 2006-01-02 09:41
(Received via mailing list)
J. Ryan S. wrote:
> Sounds like your at the cusp of a new and exciting thing, so I want  to
> give you the best advice I can.
>
> Here's the table of contents from the book "Learning To Program" that
> Ed Borasky suggested in a previous post. (http://
> www.pragmaticprogrammer.com/titles/fr_ltp/)  Just by glancing at the
> chapter titles, which of them seem new, familiar, and old news to you
> in terms of your past programming experience?

<snip/>

Question: Is this teaching just the Ruby syntax for assorted constructs,
or does it also include algorithm analysis and selection,
speed/memory/resource considerations, application composition and
design, and other programming concepts?

Put another way, what does "program" mean in the book title, and is it
what Will means/expects when learning to program?



James
--

http://www.ruby-doc.org       - Ruby Help & Documentation
http://www.artima.com/rubycs/ - Ruby Code & Style: Writers wanted
http://www.rubystuff.com      - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com     - Playing with Better Toys
http://www.30secondrule.com   - Building Better Tools
Martin DeMello (Guest)
on 2006-01-02 10:14
(Received via mailing list)
Wilson B. <removed_email_address@domain.invalid> wrote:
>
> Others have already given very good answers on how to learn Ruby.. but
> if you want to learn the fundamentals of programming as a concept
> (rather than any specific implementation of that..), I don't think
> there's anything better than:
> http://www.htdp.org/

Seconded - this is an amazingly good book.

> http://www2.info.ucl.ac.be/people/PVR/book.html

This one's excellent too, but pretty heavy going. I wouldn't recommend
it as a teach-yourself-programming book.

martin
Wilson B. (Guest)
on 2006-01-02 10:26
(Received via mailing list)
On 1/2/06, Martin DeMello <removed_email_address@domain.invalid> wrote:
> > http://www2.info.ucl.ac.be/people/PVR/book.html
>
> This one's excellent too, but pretty heavy going. I wouldn't recommend
> it as a teach-yourself-programming book.

At least you'll know if you're serious about it, after the first few
chapters. :)
Chad P. (Guest)
on 2006-01-02 10:29
(Received via mailing list)
On Mon, Jan 02, 2006 at 04:29:14PM +0900, Scott Smith wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Nah, iterating is where you step through the elements of an array. Your
> examples are simply assignments--giving a value to a variable (think
> basic algebra).

To elaborate, I tend to suspect that the arrays and iterators chapter
discusses things like the each method -- that's what is meant by
"iterators" here.  In particular, you could have an array called myarray
(for example) and iterate over its contents using the each method to
perform the same action on each element of the array:

  myarray.each do { |foo| puts foo }

--
Chad P. [ CCD CopyWrite | http://ccd.apotheon.org ]

This sig for rent:  a Signify v1.14 production from
http://www.debian.org/
Esteban Manchado =?iso-8859-1?Q?Vel=E1zquez?= (Guest)
on 2006-01-02 18:15
(Received via mailing list)
Hi,

On Mon, Jan 02, 2006 at 02:24:48PM +0900, Will S. wrote:
> [...]
> My question:  Where should I start in learning to use Ruby?  I have
> some ideas, but I do not want to prejudice the discussion with my
> ideas.

    I think nobody else has actually said it, so: try TryRuby
(http://tryruby.hobix.com/) :-)

    It's very cool and shows basic Ruby in an interactive, fun fashion.
James G. (Guest)
on 2006-01-02 18:15
(Received via mailing list)
On Jan 2, 2006, at 2:29 AM, Chad P. wrote:

> In particular, you could have an array called myarray
> (for example) and iterate over its contents using the each method to
> perform the same action on each element of the array:
>
>   myarray.each do { |foo| puts foo }

Only we would never write that since the following does the same thing:

puts myarray

James Edward G. II
Steve L. (Guest)
on 2006-01-02 18:15
(Received via mailing list)
I concur. The table of contents seems to list the skills you need in the
order
you need them. Looks like a good book, and from the sample chapter I
read,
well written.

One more thing. Whenever I need to learn a new technology, here's the
learning
method I use:

http://www.troubleshooters.com/bookstore/rl.htm#flowchart

SteveT
Will S. (Guest)
on 2006-01-02 20:04
(Received via mailing list)
Man  y'all are amazing.  I'll put my replies to everyone here.

Specific Project or Just Learning:
------------------------
I think it's a little of both.  I always wanted to program from back
in the Apple Basic days.  I just was always better with the
hardware/software troubleshooting stuff.  In my day job I am a Lead
Help Desk Technician.  At work I became good friends with the
programmers there and, since our network/server/sql admin left, I have
had to start learning MS SQL maintenance and some basic DBA Stuff.

As for a Project I want to create a Nethack bot.  Like I said in my
intro a friend created a Nethack bot in C# and I wanted to see if I
could do it in Ruby.  I have read a lot about Ruby in the last few
months, including Ruby on Rails, but I just do not know enough about
Ruby to do anything with it.  I also have in mind to build a Wish List
web application for my family so we can know what everyone would like
for Christmas or for other occasions.


Iteration:
-------------
Thanks for reminding what Iteration is.  As soon as you said it I
went, DUH!, heh.  Arrays and Iteration is where I stopped in the "Head
Start Java" book.  I think I stopped at a combination of frustration
and Real Life took over.


Books:
----------
All the high recommendations on books and websites are great.  I will
begin to check them out.  I have a birthday coming up so I may be able
to give some suggestions for my family when they want to buy me a
present :) heh.   But I'm old enough (married with a daughter) that I
can buy them myself too *chuckle*


Rapid Learning Flowchart:
------------------------
Wow this is cool.  I think I do some of this on my own already.  Not
as refined though. :)



I'll keep you all up-to-date with my progress.  I'm sure you will get
more questions from me.


Thanks again for all the great informatoin and help.

WIll



On 1/2/06, Steve L. <removed_email_address@domain.invalid> wrote:
>
> >
> > > 1. Getting Started
> > > 12. New Classes of Objects
> > >>> ~ ryan ~
>
--
Will S.  ( willshattuck.at.gmail.com )
Home Page:  http://www.thewholeclan.com/will

When you get to your wit's end, you'll find God lives there.
Chad P. (Guest)
on 2006-01-02 21:54
(Received via mailing list)
On Tue, Jan 03, 2006 at 12:03:03AM +0900, James Edward G. II wrote:
> puts myarray
Well . . . true.

This is why I don't teach programming.

--
Chad P. [ CCD CopyWrite | http://ccd.apotheon.org ]

"A script is what you give the actors.  A program
is what you give the audience." - Larry Wall
Michael 'entropie' Trommer (Guest)
on 2006-01-02 22:06
(Received via mailing list)
* Will S. (removed_email_address@domain.invalid) wrote:
> Hi folks. Happy New Year!

peace,

>
> My question:  Where should I start in learning to use Ruby?  I have
> some ideas, but I do not want to prejudice the discussion with my
> ideas.

code little projects which fits your needs, thats imho the only way to
advance in programming (or in a  specific lang).

> Also, I have a project in mind to use Ruby... A Nethack bot.  A friend
> programmed one in C# and I thought it would be fun to try and use
> Ruby.  I know I have a long way to go but it would be fun for me.

code it.

loop do
  if your are ready, look at your code, look at your expierience and
code it
  again if you dont like it .
end

So long
--
Michael 'entropie' Trommer;  http://ackro.org

ruby -e "0.upto((a='njduspAhnbjm/dpn').size-1){|x| a[x]-=1}; p
'mailto:'+a"
Hal F. (Guest)
on 2006-01-02 22:09
(Received via mailing list)
Chad P. wrote:
>>
>>Only we would never write that since the following does the same thing:
>>
>>puts myarray
>
>
> Well . . . true.
>
> This is why I don't teach programming.
>

Actually, I think there's a difference in behavior
if you try them both.


Hal
James G. (Guest)
on 2006-01-02 22:19
(Received via mailing list)
On Jan 2, 2006, at 2:08 PM, Hal F. wrote:

>>>> myarray.each do { |foo| puts foo }
>>>
>>> Only we would never write that since the following does the same
>>> thing:
>>>
>>> puts myarray
>> Well . . . true.
>> This is why I don't teach programming.
>
> Actually, I think there's a difference in behavior
> if you try them both.

Other than the return value?

 >> (1..10).to_a.each { |n| puts n }
1
2
3
4
5
6
7
8
9
10
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
 >> puts (1..10).to_a
1
2
3
4
5
6
7
8
9
10
=> nil

James Edward G. II
Hal F. (Guest)
on 2006-01-02 22:28
(Received via mailing list)
James Edward G. II wrote:
>>>>> (for example) and iterate over its contents using the each  method to
>>> Well . . . true.
>>> This is why I don't teach programming.
>>
>>
>> Actually, I think there's a difference in behavior
>> if you try them both.
>
>
> Other than the return value?

Well, I'm quite wrong. I thought that 'puts myarray' would print
on a single line with elements scrunched together. Maybe this
was true in the past?

Of course, I *could* pretend I was talking about the extraneous
'do' in 'myarray.each do { |foo| puts foo }' ... but I wasm't.  ;)


Hal
Devin M. (Guest)
on 2006-01-02 22:34
(Received via mailing list)
Hal F. wrote:

> Well, I'm quite wrong. I thought that 'puts myarray' would print
> on a single line with elements scrunched together. Maybe this
> was true in the past?

No... that's perl, iirc. :)

> Of course, I *could* pretend I was talking about the extraneous
> 'do' in 'myarray.each do { |foo| puts foo }' ... but I wasm't.  ;)

wasm't?
=?ISO-8859-1?Q?Gerardo_Santana_G=F3mez_Garrido?= (Guest)
on 2006-01-02 22:43
(Received via mailing list)
2006/1/2, Devin M. <removed_email_address@domain.invalid>:
> Hal F. wrote:
>
> > Well, I'm quite wrong. I thought that 'puts myarray' would print
> > on a single line with elements scrunched together. Maybe this
> > was true in the past?
>
> No... that's perl, iirc. :)

It's true for hashes.
unknown (Guest)
on 2006-01-02 23:24
(Received via mailing list)
Hi --

On Tue, 3 Jan 2006, Hal F. wrote:

>>>>>> In particular, you could have an array called myarray
>>>> Well . . . true.
> on a single line with elements scrunched together. Maybe this
> was true in the past?

I think what you're thinking of is array.to_s, which scrunches them
together.  But puts array does a separate puts on each element.


David

--
David A. Black
removed_email_address@domain.invalid

"Ruby for Rails", from Manning Publications, coming April 2006!
http://www.manning.com/books/black
James B. (Guest)
on 2006-01-02 23:45
(Received via mailing list)
Hal F. wrote:

>
> Well, I'm quite wrong. I thought that 'puts myarray' would print
> on a single line with elements scrunched together. Maybe this
> was true in the past?

Maybe.  It certainly struck me as counter-intuitive.  I would think it
would print the results of myarry.to_s or myarry.to_str.

How (and why) did a call to an iterator get in there?

James
--

http://www.ruby-doc.org       - Ruby Help & Documentation
http://www.artima.com/rubycs/ - Ruby Code & Style: Writers wanted
http://www.rubystuff.com      - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com     - Playing with Better Toys
http://www.30secondrule.com   - Building Better Tools
Chad P. (Guest)
on 2006-01-02 23:48
(Received via mailing list)
On Tue, Jan 03, 2006 at 06:22:56AM +0900, removed_email_address@domain.invalid 
wrote:
>
> On Tue, 3 Jan 2006, Hal F. wrote:
> >
> >Well, I'm quite wrong. I thought that 'puts myarray' would print
> >on a single line with elements scrunched together. Maybe this
> >was true in the past?
>
> I think what you're thinking of is array.to_s, which scrunches them
> together.  But puts array does a separate puts on each element.

Maybe he was thinking of "print myarray".

--
Chad P. [ CCD CopyWrite | http://ccd.apotheon.org ]

"A script is what you give the actors.  A program
is what you give the audience." - Larry Wall
Frank S. (Guest)
on 2006-01-03 14:11
(Received via mailing list)
Hi everybody,

I follow this list for some time but due to the volume I might have
missed it, if this was answered before...

I have another problem: I'm programming for some time (~20 years, if you
count the good old BASIC days), I've studied CS, I've used C/C++ (a
bit), Shell (some), Perl (some), PHP (some), Java (a lot) and a lot of
other languages. I think I understand most of the ruby language but I
fear I'm still using it in the wrong way. What I'm looking for, is a way
to learn 'the ruby way'. I'm thinking something like:

- Problem
- This is how you would have done it in another language
- Nice Ruby Solution

I have the pickaxe and the ruby on rails book and I'm reading both at
the moment. I looked through the sample chapter of 'The Ruby Way' but it
seemed more like a cookbook to me.

bye
Frank
Devin M. (Guest)
on 2006-01-03 14:26
(Received via mailing list)
Frank S. wrote:

> What I'm looking for, is a way to learn 'the ruby way'. I'm thinking
> something like:
>
> - Problem
> - This is how you would have done it in another language
> - Nice Ruby Solution

I'm thinking the best way to do that is by posting examples (short,
repeatable code snippets for us to chew on). In general, it's usually
going to involve more functional constructs, and heavy use of blocks. :)
But that's not always the case. Usually, you'll get about Six Ruby Ways.

Devin
unknown (Guest)
on 2006-01-03 15:58
(Received via mailing list)
Hi --

On Tue, 3 Jan 2006, Frank S. wrote:

> ruby way'. I'm thinking something like:
>
> - Problem
> - This is how you would have done it in another language
> - Nice Ruby Solution

For me, part of the Ruby way is to skip the second of those three
steps :-)  Of course it can be interesting to compare implementations;
but from what I've seen, I don't think writing the code in another
language first is very useful as a way of learning Ruby.  I'd
recommend going straight from problem to Ruby, and then working on the
Ruby.

> I have the pickaxe and the ruby on rails book and I'm reading both
> at the moment. I looked through the sample chapter of 'The Ruby Way'
> but it seemed more like a cookbook to me.

Don't let that stop you from reading it, though.  You'll learn a lot.
And a new edition is coming out, later this year.


David

--
David A. Black
removed_email_address@domain.invalid

"Ruby for Rails", from Manning Publications, coming April 2006!
http://www.manning.com/books/black
RevMike (Guest)
on 2006-01-03 20:12
Frank S. wrote:
> Hi everybody,
>
> I follow this list for some time but due to the volume I might have
> missed it, if this was answered before...
>
> I have another problem: I'm programming for some time (~20 years, if you
> count the good old BASIC days), I've studied CS, I've used C/C++ (a
> bit), Shell (some), Perl (some), PHP (some), Java (a lot) and a lot of
> other languages. I think I understand most of the ruby language but I
> fear I'm still using it in the wrong way. What I'm looking for, is a way
> to learn 'the ruby way'. I'm thinking something like:
>
> - Problem
> - This is how you would have done it in another language
> - Nice Ruby Solution
>
> I have the pickaxe and the ruby on rails book and I'm reading both at
> the moment. I looked through the sample chapter of 'The Ruby Way' but it
> seemed more like a cookbook to me.
>
> bye
> Frank

I'm also a java programmer who is learning Ruby.  So far I installed the
one-click install version on my WinXP laptop, read the entire
"Programming Ruby" book included, and wrote one small app.

But I've gone back and refactored the app 3 times!  And I have another
refactoring planned.  The app has only two classes.

In my opinion, if you know how to do something in one way, make it work.
then go back and refactor over and over again, trying different Ruby
constructs, until you are comfortable with what you are doing.

Mike
Devin M. (Guest)
on 2006-01-04 07:22
(Received via mailing list)
RevMike wrote:

>In my opinion, if you know how to do something in one way, make it work.
>then go back and refactor over and over again, trying different Ruby
>constructs, until you are comfortable with what you are doing.
>
>
+1
stijn (Guest)
on 2006-01-04 13:15
(Received via mailing list)
wow, "the ruby way" may just have gotten ruby's equivalent of
help-me-make-my-program-more-"pythonic".

"deja-vu... a twitch in the matrix. It happens when they change
something."
hehe.
s.
Robert K. (Guest)
on 2006-01-04 13:18
(Received via mailing list)
stijn wrote:
> wow, "the ruby way" may just have gotten ruby's equivalent of
> help-me-make-my-program-more-"pythonic".

In the sense of the programming language or in the sense of the famous
british comedy group?

> "deja-vu... a twitch in the matrix. It happens when they change
> something."
> hehe.
> s.

itch <= twitch - what does this tell us?

    robert
Frank S. (Guest)
on 2006-01-05 12:41
(Received via mailing list)
Devin M. wrote:
> I'm thinking the best way to do that is by posting examples (short,
> repeatable code snippets for us to chew on). In general, it's usually
>  going to involve more functional constructs, and heavy use of
> blocks. :) But that's not always the case. Usually, you'll get about
> Six Ruby Ways.


The problem here is how to find the useful example. If I don't know that
something could be handled in a more elegant way, I don't know that this
could be a good example...

RevMike wrote:
> But I've gone back and refactored the app 3 times!  And I have
> another refactoring planned.  The app has only two classes.
>
> In my opinion, if you know how to do something in one way, make it
> work. then go back and refactor over and over again, trying different
>  Ruby constructs, until you are comfortable with what you are doing.


I think that's a pretty good tip. I'm working on a small Ruby on Rails
application and every time I add new code I refactor a large portion of
old code because nearly every day I find new and easier ways of
doing something in Ruby...

bye
Frank
This topic is locked and can not be replied to.