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 »

« Advice for Starting Freelancers
Advice for Freelancers [Part 2] »

“JavaScript on ProtoType”

Posted on March 23rd in Learning Ruby — 4 Comments so far. Got something to say?

In learning Ruby on Rails, I’ve come accross this little bump of which I easy surpassed, but it seems to be a problem for many. Here’s what I’ve gathered:

Ruby is the programming language. Rails is a framework. Ruby on Rails is not a language.

This is probably on of the most difficult things for people to get over, but it’s simple if you thing of it in these terms:

  • JavaScript on Prototype
  • PHP on Symfony
  • Language on Framework

Now for the part I’m still unsure about… Is Rails written in Ruby? All the other frameworks (Prototype, Scriptaculous, etc…) are all written in their respective languages. But anyways, enough about that. It’s a pretty simple thing. My new favourite Ruby website is Ruby-Lang.org.

It has some cool examples on the front page that randomly change, and just by looking at those I’ve learned a few things. First of all, in a class if you define “initialize” it will run automatically when the class is called, or upon initialization. The example they use is:

class Greeter
    def initialize
        @name = name.capitialize
    end
    def salute
        puts "Hello, #{@name}!"
    end
end
g = Greeter.new("world")
g.salute

This is another thing I love about Ruby-Lang. The examples it gives you to show Ruby in action are basic, but they give you a good understanding. The above example could be done in PHP, but it would be longer and less efficient, for sure.

Comments

Leave a comment

  • Razor
    March 24th, 2007 at 7:27 PM

    the php version of that code would be almost the same actually

    class Greeter
    {
    function __construct($name)
    {
    $this->name = strtoupper($name);
    }

    function salute()
    {
    echo $this->name;
    }

    $g = new Greeter(”world”);
    $g->salute;

    ok its abit longer but same thing

  • Connor Wilson
    March 24th, 2007 at 8:18 PM

    Yeah the PHP version isn’t bad, but I’m so tired of PHP. I’ve been using it forever and it’s boring now for me to code. I’ll still be using it with WordPress, but Ruby will also open up things like Typo and Mephitso for me.

  • Razor
    March 25th, 2007 at 3:29 PM

    i would like to learn ruby but, what hosts support it and how easy is it to make a simple website :S

    (i use dreamhost)

  • Connor Wilson
    March 25th, 2007 at 3:31 PM

    DreamHost does support it, but it’s definitely not easy to setup, or make a simple website.

    It’s a lot of trouble to go through to set up a Rails app.

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.