SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast daveg7's Avatar
    Join Date
    Oct 2008
    Location
    Berkeley, California, U.S.
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ruby on Rails--Basic Concepts?

    I've enjoyed the time I've spent playing a lot with CSS, and I expect to learn JavaScript and PHP soon.

    Could someone explain the real basics of what Ruby on Rails would do for me that I'm not already getting?

    Please pretend that I'm in kindergarten and give me simple, clear ideas and examples.

    Thanks for your help,

    Dave

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Ruby is a language. Like PHP. You can use it to write code that runs on the web server.

    Rails is a framework. Frameworks are a bunch of code (Ruby code in this case) already written for you that take care of the elements common to most web applications -- deciding what code to execute based on URLs, sanitizing user input, accessing a database, etc. There are frameworks that do the same thing for PHP or any other language you'd like to use.

    So you don't get anything out of learning both at the same time other than being able to say you know more languages.

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,044
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)
    I guess some would argue that Ruby is easier than PHP. It's supposed to be "simpler" and OOP. That is, everything is an object. And Rails is supposedly easier because it relies on following convention instead of configuration.

    My programming experience goes way back to procedural Basic. so I still have a bit of trouble getting into OOP-think. And I've been writing PHP for years.

    I don't dislike RoR, but it hasn't really "caught fire" with me. I guess my experience is more comfortable and fairly ingrained at this point.

    But the 2 languages do have a lot of similarities. Chances are you could learn both easily enough and decide which you like better.

  4. #4
    Team ********* Louis Simoneau's Avatar
    Join Date
    Sep 2009
    Location
    Melbourne, Australia
    Posts
    228
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The two main advantages of a framework like Rails, from my point of view, is that you get object-relational-mapping, and a convention-based framework from which to start your application.

    Object-relational-mapping (or ORM) is just a way of making stuff in the database available to you as a programmer. If you start learning PHP, pretty soon you'll find yourself querying a database to get info you want. This involves writing some pretty low-level SQL and a lot of code to handle it. An ORM framework abstracts a lot of this low-level stuff and lets you program with the logical objects (so if you want the threads in a given forum you'd type something like "forum.threads" instead of writing SQL). This can be a huge time-saver and keeps your brain operating in "what is the logic of what my application is supposed to be doing?" mode instead of "how do I make this database give me my data?" mode.

    The other advantage is convention. It's a huge help to have the directory structure of your application laid out for you before you start coding. Your view templates are in one place, your application controllers are somewhere else. And everything is already tied into the database and into the URL structure of your site by convention.

    That said, you can get all these advantages by using a framework in any language, not just Ruby. For PHP there are frameworks like Symfony and CakePHP that do all of this same stuff for PHP instead of Ruby.

    So I'd recommend having a look at some basic PHP and Ruby tutorials and deciding upfront which language makes more sense to your brain. They're quite different, and I can definitely see why some people prefer PHP even though I prefer Ruby. And once you have some experience using one, you can look into learning the other to keep your brain excited and in learning mode (if you already know a programming language or two, learning another one is much faster).


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •