Program writing

i think i understand the basic syntax of ruby, now what do i do with it?
I open up my text editor and draw a blank. How do i get ideas and
actually start programming? Its alot of different than poetry or art
where i can basically start anywhere and just go wild with creativity. I
guess i just dont understand the creative side of programming. I also
dont understand why when i look at o ther peoples code i have no idea
what is going on. its like i learned the syntax from the book and yet i
cant read source code and understand what is happening. Its kind of
frustrating. I thought when i learned the keywords and syntax of a
computer language that it would open up a new door of creativity but i
just have no idea what to do with it.

corey konrad wrote:

i think i understand the basic syntax of ruby, now what do i do with it?
I open up my text editor and draw a blank. How do i get ideas and
actually start programming? Its alot of different than poetry or art
where i can basically start anywhere and just go wild with creativity. I
guess i just dont understand the creative side of programming. I also
dont understand why when i look at o ther peoples code i have no idea
what is going on. its like i learned the syntax from the book and yet i
cant read source code and understand what is happening. Its kind of
frustrating. I thought when i learned the keywords and syntax of a
computer language that it would open up a new door of creativity but i
just have no idea what to do with it.

Programming is not so much an art like poetry as a craft, like making a
chair. I don’t think you can just open up an editor and start typing
code until you have an end in sight. You need an itch to scratch, a need
to fill, a problem to solve. What drew you to the idea of learning
programming to begin with? What did you hope to accomplish?

just have no idea what to do with it.

I would say, first thing you need is a goal. Remember that a computer
language is not a door of creativity, it’s a tool to create something
(as
well as a pen and a paper could be). The creativity is inside yourself;
it’s the ideas you catch. Once you have a nice goal, then you can use
Ruby
to give it shape.

You really need to have a little project that you want to do. Or you
may have a project, written in another language, that you want to re-
write.

If you really get stuck for something to write then checkout http://
www.rubyquiz.com/. Try quiz 14 which I thought was quite easy. My
program worked fine but looked nothing like the other solutions.

The more programming that you do the easier it becomes. Honest!

write a game. like tic tac toe or a text adventure game.

or write a script to make something you frequently do on your
computer go faster. for example i wrote a script that takes all the
warcraft 3 replays on my desktop (where they download to) and puts
them in the right folder.

On May 22, 2006, at 1:26 PM, corey konrad wrote:

cant read source code and understand what is happening. Its kind of
frustrating. I thought when i learned the keywords and syntax of a
computer language that it would open up a new door of creativity but i
just have no idea what to do with it.


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

– Elliot T.

I guess i thought that would just sort of click after i learned a
language, but i guess that isnt how it works. I didnt really begin
learning ruby for any reason other than wanting to know how to program.
I tried getting my first internship doing programming and they said they
wanted someone with an extensive portfolio of software they have
developed. I have no idea what software to work on. I have looked at
some of the open source projects being done and i dont understand what i
am looking at…yet i understood the exercises form the book i was
learning from which went over the syntax and key words etc. Its pretty
confusing its almost like you have to run a program and try to figure
out wht part of a program is doing what even after you know a language.
Programming languages are pretty small things but what you can do with
them is amazing. Just a few words and some syntax rules and you can
build entire operating systems and video games etc. I just thought it
would be a more flowing process i guess. Like ok i am going to sit down
and write a music player all of my own or something but it doesnt work
that way, i think it would take me like a year to make something like
that if not longer. I think my expectations of programming were a bit
unrealistic.

Programming is not so much an art like poetry as a craft, like making a
chair. I don’t think you can just open up an editor and start typing
code until you have an end in sight. You need an itch to scratch, a need
to fill, a problem to solve. What drew you to the idea of learning
programming to begin with? What did you hope to accomplish?

On 5/22/06, corey konrad [email protected] wrote:

out wht part of a program is doing what even after you know a language.
Programming languages are pretty small things but what you can do with
them is amazing. Just a few words and some syntax rules and you can
build entire operating systems and video games etc. I just thought it
would be a more flowing process i guess. Like ok i am going to sit down
and write a music player all of my own or something but it doesnt work
that way, i think it would take me like a year to make something like
that if not longer. I think my expectations of programming were a bit
unrealistic.

Possibly. I blame the book stores:
http://www.norvig.com/21-days.html

I understand what you are going through. I frequently see cool Ruby
projects released and think “man, why didn’t I think of that!”

Basically when it comes to programming you need a problem that you
want to solve. For example let’s say there is some repetitive thing
you always do with your computer (downloading and organizing photos
from a digital camera, ripping your CDs into mp3s, downloading stuff
from the internet, etc.) You can make your life easier by writing a
Ruby script to automate something like that.

If you just have an empty text editor but no pressing need to solve a
certain problem, of course you will draw a blank. If you were an
author of novels and didn’t have even a basic idea of what you wanted
to write about, how much do you think you would write?

As a personal example of using Ruby to solve a problem, I wrote a
script that uses WWW:Mechanize to log into my local library’s web-site
and automatically renew books or DVDs that are due. If something
cannot be renewed the script emails me. I have this loaded on my web
host to run via cron every day. Before I had this I would frequently
forget about books that were due and would then have to make a special
trip to the library to return overdue books and pay needless fees. Now
I can count on the script to let me know when things HAVE to be
returned, and live my life normally otherwise.

That is the kind of problem you need to think about solving.
Technology should make your life easier.

Regarding reading source code, like any language, your reading
comprehension will improve over time. Still, code is frequently much
harder to read than any human language, and even Ruby can be hard to
read if it is written badly. But most of us like Ruby so much because
it is one of the easiest to read programming languages.

Ryan

well actually i read the learn to program book and most of the
programming ruby book.

Bill G. wrote:

On 5/22/06, corey konrad [email protected] wrote:

out wht part of a program is doing what even after you know a language.
Programming languages are pretty small things but what you can do with
them is amazing. Just a few words and some syntax rules and you can
build entire operating systems and video games etc. I just thought it
would be a more flowing process i guess. Like ok i am going to sit down
and write a music player all of my own or something but it doesnt work
that way, i think it would take me like a year to make something like
that if not longer. I think my expectations of programming were a bit
unrealistic.

Possibly. I blame the book stores:
Teach Yourself Programming in Ten Years

hmm i dont really have any problems in life that could solved by
programming. Everything i can think of writing is something that already
exists. It would be kind of rediculous to write a program in ruby that
already exists in another language wouldnt it? I think i would fall
asleep from boredom doing that kind of translation. I dont know i guess
i thought it would be more of a creative and exciting thing to get into
that would fill my head with ideas. I thought i would be able to do
anything on my computer i guess is what i mean, like just deciding to
write a paint program that does something that other paint programs dont
do, but i realize now that a project like that would probably take years
of experience and alot of people working many hours. Like i said i think
my expectations of programming were unrealistic

Ryan L. wrote:

I understand what you are going through. I frequently see cool Ruby
projects released and think “man, why didn’t I think of that!”

Basically when it comes to programming you need a problem that you
want to solve. For example let’s say there is some repetitive thing
you always do with your computer (downloading and organizing photos
from a digital camera, ripping your CDs into mp3s, downloading stuff
from the internet, etc.) You can make your life easier by writing a
Ruby script to automate something like that.

If you just have an empty text editor but no pressing need to solve a
certain problem, of course you will draw a blank. If you were an
author of novels and didn’t have even a basic idea of what you wanted
to write about, how much do you think you would write?

As a personal example of using Ruby to solve a problem, I wrote a
script that uses WWW:Mechanize to log into my local library’s web-site
and automatically renew books or DVDs that are due. If something
cannot be renewed the script emails me. I have this loaded on my web
host to run via cron every day. Before I had this I would frequently
forget about books that were due and would then have to make a special
trip to the library to return overdue books and pay needless fees. Now
I can count on the script to let me know when things HAVE to be
returned, and live my life normally otherwise.

That is the kind of problem you need to think about solving.
Technology should make your life easier.

Regarding reading source code, like any language, your reading
comprehension will improve over time. Still, code is frequently much
harder to read than any human language, and even Ruby can be hard to
read if it is written badly. But most of us like Ruby so much because
it is one of the easiest to read programming languages.

Ryan

maybe i shoud look at opengl or something like that, is it possible to
integrate opengl with ruby or is it even necessary, i could write a text
game i guess but where would i start is what i dont understand. i just
dont get how to begin something like that because i dont understand what
is involved. How do i write a method to allow people to connect to the
program and play the game etc i just have no idea i would have to look
at other peoples source code and rack my brain over it for a couple
weeks to try and figure out how it works but then i would just be doing
something that has already been done. There are hundreds of those games
all over the internet i find it hard to get excited about things like
that. I dont know maybe i should just stick with art, i would like to
get into graphics programming and actually be one of the people who
works on programming things like maya and poser etc but i cant even
begin to fathom how all of that is done is there a grahics api for ruby?

Elliot T. wrote:

write a game. like tic tac toe or a text adventure game.

or write a script to make something you frequently do on your
computer go faster. for example i wrote a script that takes all the
warcraft 3 replays on my desktop (where they download to) and puts
them in the right folder.

On May 22, 2006, at 1:26 PM, corey konrad wrote:

cant read source code and understand what is happening. Its kind of
frustrating. I thought when i learned the keywords and syntax of a
computer language that it would open up a new door of creativity but i
just have no idea what to do with it.


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

– Elliot T.
Curiosity Blog – Elliot Temple

Ask your friends then. :slight_smile:

Hi Corey

On May 22, 2006, at 10:04 pm, corey konrad wrote:

hmm i dont really have any problems in life that could solved by
programming. Everything i can think of writing is something that
already
exists. It would be kind of rediculous to write a program in ruby that
already exists in another language wouldnt it?

Actually, no… you can write such beautiful code with Ruby sometimes
it is worth rewriting stuff for the sake of it. Of course, you need
an understanding of what the program is trying to do before you can
write it yourself. You also need to understand all the features of
the Ruby to take advantage of them. And the catch 22 is you have to
write code to understand how to do it.

Someone suggested you look at past Ruby Q.zes and I think that’s
the right idea. Maybe you should search out some programming puzzles
that will teach you programming ideas. I remember the book “The C
Programming Language” had loads of questions at the end of each
chapter (some REALLY hard!). Something like that would get you
started… perhaps not that book though.

years
of experience and alot of people working many hours. Like i said i
think
my expectations of programming were unrealistic

Writing anything with a GUI is a big job. I wouldn’t even think
about writing a desktop application right now! You’d have more luck
with Ruby on Rails, but even that is not simple (it’s simple if you
already write web applications, but that’s just not an easy job).

Good luck
Ashley

I like to do my command line scripts like this:

file: reports.rb

class Reports
def self.run(args)
process_args(args)

self.do_stuff
end

private
def process_args(args)
unless args.is_a?(Hash)
@args = Hash[*args.collect{ |arg| arg.split(/\s|=/) }.flatten]
else
@args = args
end
end
end

at_exit do
if File.expand_path($0) == File.expand_path(FILE)
Reports.run(ARGV)
end
end

Now if I want to run on the command line I can, like normal, but I can
also require ‘reports’, and interact with it from another script where
it behaves differently.

If I were you I’d start out by creating some tools to help you
program better, like a custom Logger class that emails you when errors
occur, or a reminder program that sends yourself text messages, you
could use that in your Logger also for critical errors.

I find myself having to always go back to stuff I wrote a long time
ago and add better error notification code.

-Jeff

On May 22, 2006, at 4:04 PM, corey konrad wrote:

hmm i dont really have any problems in life that could solved by
programming.

I don’t believe that for a second. Computers are all about
repetition. We all have such tasks.

Everything i can think of writing is something that already
exists. It would be kind of rediculous to write a program in ruby that
already exists in another language wouldnt it?

Not at all. This process is called “porting” and it is extremely
popular. Just one of the many great things it can do is to bring
powerful libraries to Ruby that are currently only available in other
languages.

I dont know i guess i thought it would be more of a creative and
exciting thing to get into
that would fill my head with ideas. I thought i would be able to do
anything on my computer i guess is what i mean…

It can. Give it a shot!

but i realize now that a project like that would probably take years
of experience and alot of people working many hours.

Then get started today! :wink:

One cool aspect of taking on a project that takes a lot of effort is
that you learn so much along the way. You’ll become a better
programmer and you will learn much more about whatever problem domain
you decide to attack. Plus, with us here to help when you need us,
you can’t lose! How cool is that?

Ditch the negative attitude. You’re a programmer now! Master of the
(computer) universe. You are all-powerful and can do ANYTHING! Go
forth spreading joy into the world…

James Edward G. II

On May 22, 2006, at 6:23 PM, James Edward G. II wrote:

Ditch the negative attitude. You’re a programmer now! Master of
the (computer) universe. You are all-powerful and can do
ANYTHING! Go forth spreading joy into the world…

I found it amusing that you used the words “forth” [1] and “joy” [2]
in the same sentence, while talking about programming, but didn’t
mention the word “stack” once.

[1] Forth - Wikipedia
[2] Joy (programming language) - Wikipedia

corey konrad wrote:

of experience and alot of people working many hours. Like i said i think
my expectations of programming were unrealistic

I won’t say it’s true for every programmer, but it’s true for every
programmer I know: once you try programming the problem is not thinking
what to do, it’s finding time to do everything you want to do. I wrote
my first program 27 years ago and I still write code almost every day of
my life.

So programming doesn’t click for you? Go do something else. I spent a
summer learning to kayak and finally realilzed I hated kayaking. My wife
spent a summer learning to scuba and finally realized she hated scuba.
Life’s too short to waste your time doing stuff that doesn’t reward you.

On 23 May 2006, at 06:23, corey konrad wrote:

doing
something that has already been done. There are hundreds of those
games
all over the internet i find it hard to get excited about things like
that. I dont know maybe i should just stick with art, i would like to
get into graphics programming and actually be one of the people who
works on programming things like maya and poser etc but i cant even
begin to fathom how all of that is done is there a grahics api for
ruby?

There’s more to computer/algorithmic art than just writing tools
(like Maya and Poser) for other artists to use. A friend of mine at
work wanted to learn some graphics programming, so he wrote a short
program that could take a bitmap and a few parameters on the command
line and generate a new distorted image. It was simple and dumb, but
we had a fun (and creative!) afternoon sticking photos of our faces
into the algorithm and seeing what weird effects we could come up
with. This was written in C, but there’s no reason why Ruby couldn’t
do something similar with the SDL or even OpenGL interfaces.

http://raa.ruby-lang.org/project/ruby-sdl/
http://raa.ruby-lang.org/project/opengl/

If you’re more interested in music then I’d recommend SuperCollider3:
it uses Smalltalk-like (and hence vaguely Ruby-like) syntax to
generate music/sounds. There’s a whole new learning curve to tackle,
but it might be fun along the way if you have an interest in music. I
don’t know if there’s anything similar for Ruby itself.

Playing around with these tools is OK, but to progress you WILL need
to get a project to work on. Even if (to start with) it’s something
totally stupid and made-up. As one of the previous replies mentioned,
there are very few novelists who can just sit down and write without
having a larger plan in mind.

Dr Alex G.
Post-Doctoral Researcher

Bioinformatics Center
Institute for Chemical Research
Kyoto University
Gokasho, Uji, Kyoto 611-0011
Japan

corey konrad wrote:

i think i understand the basic syntax of ruby, now what do i do with it?
I open up my text editor and draw a blank. How do i get ideas and
[snip]
computer language that it would open up a new door of creativity but i
just have no idea what to do with it.

Something I suggest to beginning programmers is to find some existing
project which you really like or admire or find very useful, then find
some tiny aspect about it that you think could use some improvement.
Then open up the source code and tweak it so that it works the way you’d
like.

It could be something as trivial as making a textual change, such as
changing the name of a main character in a game.

Many open source projects maintain issue/bug trackers to list problems
and feature requests. You could skim them, and maybe find one that
looks simple. After writing (and testing), you could submit a patch,
and help the open source universe. :slight_smile:

Pistos

corey konrad wrote:

just have no idea what to do with it.

The creativity comes only when you have mastered the basics, not
when you’ve just been exposed to them.

Think of it as like playing an instrument. You’re a beginner.
Take it slow.

I recommend finding some freshman-level programming exercises
and trying them out.

You have to play “Mary Had a Little Lamb” with confidence
before you can jump on stage with Miles Davis and improvise.

Hal