PDA

View Full Version : Program Structure


Les
August 8th, 2005, 10:58 AM
Hi,

I'm a newbie with ruby. I can read "the pickaxe" and understand each concept. I can program all the examples in Pine's tutorial. But when I try to write a useful program for my own application I get lost. I don't know how to structure a program properly. I have simple questions, like "Must all class definitions come before method definitions?" Must all methods come before they are used?

I could learn from examples if I could find some complete running ruby programs that I could understand. Usually the complete Ruby programs I find are beyond me because the are large, complex, and use the language in ways that are difficult for a beginner to follow.

I welcome any advice.

Les

bluetechnx
August 9th, 2005, 04:51 PM
well...I suggest looking through the Ruby Application Archive (RAA) which a link can be found for here: http://rubyforge.org/

Learning to structure a program is really dependant on the program, it can differ depending on how you try to attack the problem.

For simple little tasks some example programs can be found here:
http://redhanded.hobix.com/, what comes to mind for me are the "Walking Slide Numbers" ...it is a fully functional program that downloads 60 webpages!...it's also a fairly simple script.

Most applications that need to interact with the OS use ARGV to pass information into the program.

Any other questions, or specifics feel free to write back.

[edit] with RAA you can use the online code browsing tool GONZUI to look at the sourcecode of a program :)