Connor Wilson
  • Home
  • About
  • Archives
  • Contact

Established October 2006.

connorwilson: People, you don't need PHP to switch a CSS file! or AJAX! Jeez.

Follow me »

« 5 Ways to never be Bored on the Internet Again
Cracks the Technorati 100k with a Bang? »

Learning Ruby: What’s Worked So far

Posted on March 18th in Learning Ruby — 2 Comments so far. Got something to say?

I’ve been speculating about documenting my ‘quest’ so to speak on learning Ruby on Rails. What’s drawn me to this, over PHP5 which to this point I’m completely comfortable with, is that RoR is said to be the best for developers, and you can do things that would take PHP thousands of lines in 60! That’s probably not always the case, but there’s a screen cast (warning: that links right to the movie/.mov file) of a guy writing a blog system in 58 lines.

The progress I’ve made so far hasn’t been that great, but with previous programming experience it’s easier than I would imagine for some. Some of the things I’ve gathered so far have been pretty usefull, and I’ll document them as I go along, as well as some code examples that help me get the syntax. Some of the links so far:

  • Ruby on Rails.org Screen casts
  • SitePoint’s indepth Beginner’s Guide
  • The Official Site? Maybe, but its good.
  • InstantRails for localhost development

Some basic code examples now, that as someone who already knows PHP, found greatly helpful.

# Comment, obviously
# The "Hello World" thing is always a first step
puts "Yo, world, what up?"
# or...
print "another way, slghtly different probably"
# notice the lack of semi colons...

That’s pretty much the first thing anyone learns with anything, whether it be PHP’s echo(), JavaScript’s document.write, etc… Getting into some variables is pretty easy too.

# variable time
text = "variables pretty similar to javascript..."
puts text
# one of my favourite things, you can grab one word out a sentence
# and change it, array style almost
text['javascript'] = “JavaScript”
puts text
# also some cool stuff like the uppercase function
puts text.upcase
# also really cool:
50.times { puts text }

As you can see it’s not bad so far. The classes are pretty much the same idea. Simple, English like syntax and always a cool array of stuff to do

class SomeStuff
    def moreStuff
        coolVar = "this is a class"
        puts coolVar.upcase
    end
end
newClass = SomeStuff.new
newClass.moreStuff
# should output: THIS IS A CLASS

That’s all for now. The formatting I attempted to use in the code examples with most likely be taken out by WordPress’ WYSIWYG editor. I’d just like to take the time now and clear up that contrary to what some believe:

WYSIWYG = What you see Isn’t what you get

Comments

Leave a comment

  • Andy
    March 19th, 2007 at 6:31 PM

    I’ve been looking at Ruby for a while, it’s next on my “To Learn List” now that I have some tutorial DVDs. ;)

  • Connor Wilson
    March 19th, 2007 at 8:11 PM

    I’m hesitant to even buy a book, but I would never go for a DVD (unless they were free of course :P).

    A book you can at least sit down with and try to get it in your head.

Respond

Login »

Need an account?

Blog Categories
  • Apple (12)
  • Blogging (44)
  • Design (32)
  • Free Resources (4)
  • Freelance (4)
  • Friday Roundup (4)
  • General (43)
  • Ideas (16)
  • Improve Your Blog (7)
  • Learning Ruby (4)
  • My Sites (16)
  • Personal (27)
  • Quick (9)
  • Ramblings (30)
  • SEO (15)
  • Site Development (31)
  • Sports (1)
  • WordPress (22)
Subscribe

Get updates to the RSS reader of your choice by subscribing.

    Subscribe to RSS

  • Subscribe in a Reader
  • Subscribe by email
Search

You can search all posts on the site, or visit the full archives to look around some more.

Top Commenters
  • Marketing (3)
  • Brady Valentino (2)
  • Como Emagrecer Rapido (2)
  • SJL Web Design (2)
  • Maria (2)
  • Jekyll Island Vacation (2)
  • Online Photo Editor (1)
  • hosting (1)
  • RandyBrown (1)
  • paulette (1)
Recent Posts

All content is copyright © Connor Wilson 2006-2008. If you want to use something just ask. Powered by WordPress.