Understanding Ruby on Rails

Hi,

I'm currently trying to learn Ruby without even trying to look at RoR just yet thinking that I should first have a solid fundamentals on Ruby I hope on the right path, the thing is that I was also learning PHP and MySQL and I was wondering that if I learn RoR after learning Ruby I might not need PHP since according to what I have heard with RoR I could do anything PHP is capable of, correct.

If I learn RoR is there a reason why I would need PHP? If there isn't I want to concentrate in learning RoR and not PHP.

Is RoR a lot harder than PHP?

Can RoR do everything PHP can do?

Is RoR 100% compatible with MySQL? In other words can RoR interact with MySQL like in PHP?

Thanks a lot!

I'm currently trying to learn Ruby without even trying to look at RoR just yet thinking that I should first have a solid fundamentals on Ruby I hope on the right path,

This sounds like a good idea to me. Rails will make a lot more sense if you have some Ruby under your belt.

the thing is that I was also learning PHP and MySQL and I was wondering that if I learn RoR after learning Ruby I might not need PHP since according to what I have heard with RoR I could do anything PHP is capable of, correct.

You might not need PHP... I haven't used it in several years. Unless you have a project that requires it for some other reason such as IT mandate....

If I learn RoR is there a reason why I would need PHP? If there isn't I want to concentrate in learning RoR and not PHP.

if you are just starting out... Learn ruby then rails then PHP if you want to...

Is RoR a lot harder than PHP?

I don't think so. But remember that rails is an entire framework. PHP isn't... So really the question is.... Is ruby harder than PHP. IMHO ruby is a lot easier. It's a very nice language.

Can RoR do everything PHP can do?

No, but Ruby can. I'm sure someone could find some case where that isn't true, but it's probably not critical. Ah.. Here's one.... I don't think you can run ruby/rails on Microsofts IIS web server and you can with PHP... But.. I wouldn't do that with PHP even though I can!

Is RoR 100% compatible with MySQL? In other words can RoR interact with MySQL like in PHP?

Sure. That's not quite a valid question and neither is my answer, but it's correct enough. Ruby has libraries for interacting with mysql that work fine. Rails, through active record, works with mysql just fine too.

Thanks a lot!

No problem. Welcome aboard!

- Philip

Hi,

I’m currently trying to learn Ruby without even trying to look at RoR

just yet thinking that I should first have a solid fundamentals on Ruby

I hope on the right path, the thing is that I was also learning PHP and

MySQL and I was wondering that if I learn RoR after learning Ruby I

might not need PHP since according to what I have heard with RoR I could

do anything PHP is capable of, correct.

correct

If I learn RoR is there a reason why I would need PHP? If there isn’t I

want to concentrate in learning RoR and not PHP.

correct

Is RoR a lot harder than PHP?

nothing is easier than rails for web development

Can RoR do everything PHP can do?

and much more… but since php is so mature there are much more libraries out there already that do a lot

Is RoR 100% compatible with MySQL? In other words can RoR interact with

MySQL like in PHP?

completelly

Thanks a lot!

If you have ever programmed in any language you dont need to learn ruby to use rails, you will mostly use simple programming concept at the beginning and you can learn anything else as you learn rails.

The thing about ruby is that is like c# mixed with basic mixed with c++, let me explain that.

everything is an object like in c# so you can do this

5.to_s

as you see and integer is not a simple data type is really and object and has its methods and everything “inside”, same with this

“hello there”.split(" ")

the string “hello there” is also an object and has its methods and properties.

ruby is also like c++ and basic in the sense that you can any a sintax that resembles to both of them, this is confusing at first but at the end is convenient, here is an example.

puts “hello”

and

puts(“hello”)

one like in basic with the spaces passing the method parameter and one like in c++ with parentesis passing the paremeter, block are flexible too, look

5.times {

puts “hello”

}

like in c++ is the same as

5.times do

puts “hello”

end

as in basic.

You wont need much more than that to start creating you first rails app.

Thank you both for the good info!

It looks like I'm in the right track, so I will continue learning Ruby and later on I will jump into Rails.

The other reason I want to have a good understanding about Ruby is to have the ability to create desktop apps, and as you mentioned it the language just seams clear and with a nice syntax, that's why after reading a tutorial called "Learn How to Program" I decided to give it a try and bought a book and have read some other online tutorials.

Any good tutorials or books about Ruby or Ruby on Rails?

I was looking at Lynda.com and I might subscribe but I also need a book.

Thanks A LOT!

Thank you both for the good info!

It looks like I'm in the right track, so I will continue learning Ruby and later on I will jump into Rails.

The other reason I want to have a good understanding about Ruby is to have the ability to create desktop apps, and as you mentioned it the language just seams clear and with a nice syntax, that's why after reading a tutorial called "Learn How to Program" I decided to give it a try and bought a book and have read some other online tutorials.

Any good tutorials or books about Ruby or Ruby on Rails?

Books

http://pragprog.com/titles/ruby/programming-ruby http://pragprog.com/titles/rails4/agile-web-development-with-rails

Tutorials

Best of luck

Paul

no, ruby is not good for desktop apps, since is slow and if you compile it, it looses some of its advantages.

Paul Hollyer wrote in post #987913:

http://pragprog.com/titles/ruby/programming-ruby http://pragprog.com/titles/rails4/agile-web-development-with-rails

Tutorials http://railscasts.com/

Best of luck

Paul

Thank you for the links

no, ruby is not good for desktop apps, since is slow and if you compile it, it looses some of its advantages.

Wow! I knew that it was slow but I thought that was the only issue which to me its not a big deal since I will be creating small apps. Also I thought it was its (original) main purpose to be used for computer apps.

Can you explain this a little bit more?

Thanks

Paul Hollyer wrote in post #987913:

http://pragprog.com/titles/ruby/programming-ruby http://pragprog.com/titles/rails4/agile-web-development-with-rails

Tutorials http://railscasts.com/

Best of luck

Paul

Thank you for the links

no, ruby is not good for desktop apps, since is slow and if you compile it, it looses some of its advantages.

Wow! I knew that it was slow but I thought that was the only issue which to me its not a big deal since I will be creating small apps. Also I thought it was its (original) main purpose to be used for computer apps.

Can you explain this a little bit more?

It is used quite a lot for scripting on the command-line, similar to what chef does for deployment. Several of the guys in my local RUG are big into automating processes with it, using it as the glue code to tie a bunch of other applications together, similar to AppleScript on the desktop. There is also a MacRuby bridge which lets you write Mac desktop apps in Ruby. My invoicing software (ProfitTrain from http://clickablebliss.com) was written in it. Depends a lot on what you're using it for. You probably wouldn't want to write Photoshop in it, for example.

Walter

There's a FastCGI interface for IIS, so one could *technically* run Rails on IIS with it - in the same sense that one could technically go skinny-dipping in the Antarctic.

For that matter, there's always things like phuby (https://github.com/ tenderlove/phuby) if one simply must run PHP...

--Matt Jones

Well, ruby is never compiled, you can use it to build command line tools or wrappers around fast c++ libraries.

One benefit of been scripted is that is can evaluate its own code on run time which allows for neat tricks like the ones active record uses to create dynamic finders. Is not so slow that is useless, but it cant be compared to C++. But the flexibility it offers makes it great for programmers and on the web the speed does not show when you compare it to network lag.

The other reason I want to have a good understanding about Ruby is to

have the ability to create desktop apps,

no, ruby is not good for desktop apps, since is slow and if you compile it, it looses some of its advantages.

Maybe… maybe not. If your app doesn’t require any speed it’s probably fine. Say, a DNS manager that updates a remote service via some API. 99% of the effort is going to be waiting/sending to the server.

If you’re interested in this, might be worth checking out…

http://www.macruby.org/ (and http://ofps.oreilly.com/titles/9781449380373/)

http://wxruby.rubyforge.org/wiki/wiki.pl

http://ruby4kids.com/ruby4kids (uses gosu game library on mac for games)

http://shoesrb.com/

I’m sure there are others, but those are the ones I know about…

Any good tutorials or books about Ruby or Ruby on Rails?

http://www.rubyflow.com/ (great organizer of blog/article/tips)

Thank you all very much for your help!

Is anybody here that uses Ruby mainly for desktop apps that could share his/her experiences?

Sorry if I deviated from a RoR thread to a Ruby debate

I use ruby to interact with asterisk api. makes everything easier, but you cant for example build asterisk on ruby, since is a real time app and uses DSP a lot. Other than that my experience is related to Rails

Thank you for your comments!

Well, it looks like I miss-understood when I read that Ruby was designed to be a general programming language, also I thought it was since they often compare it to Java, C++, and mainly Python. Any way I will give it a try, the language has a very clear syntax that no one can resist to learn it, plus RoR is a big reason.

One last question, if someone would to ask you why you USE or why you SHOULD use Ruby over PHP, Java or Python what would you say?

Thanks a lot!

I mean, that the better way to learning is to continue in PHP and then start with RoR. If you have some experience with PHP, try to be able work in that and write in that web apps. You will learn some programming practices and other programming language will not a problem... Plus PHP have a quick curve learning...

RoR is not a programming language, but it's a framework.

You wrote you would like to write a desktop application... I'm newbie in Ruby/RoR, but that are tools for building web applications... I think for this will totally better languages like C/C++ or Java...

I see I have other view on this theme than a colleagues, but try everything and you'll see, what will be for you the best :slight_smile:

Thank you for your comments!

Well, it looks like I miss-understood when I read that Ruby was designed

to be a general programming language, also I thought it was since they

often compare it to Java, C++, and mainly Python. Any way I will give it

a try, the language has a very clear syntax that no one can resist to

learn it, plus RoR is a big reason.

Ruby is a general purpose programming language. It is interpreted, as are Python and PHP, which means that compiled languages, like C or C++ or Java, will be faster. That doesn’t mean it couldn’t be used to write desktop applications, just that you probably wouldn’t choose it to write a 3D graphics engine.

(fwiw, PHP is not a general purpose language; it’s designed to be used on the web).

One last question, if someone would to ask you why you USE or why you

SHOULD use Ruby over PHP, Java or Python what would you say?

You should use Ruby if you enjoy programming with it. You can’t know that unless you spend some time using it.

Thank you all very much!

Well, it looks like I miss-understood when I read that Ruby was designed to be a general programming language,

It is a general programming language.

One last question, if someone would to ask you why you USE or why you SHOULD use Ruby over PHP, Java or Python what would you say?

Reason #1: http://pjkh.com/articles/2009/11/13/ruby-in-a-nutshell Reason #2: http://pastefree.pjkh.com/pastes/150

Neither reason above is very serious, but there's always some truth in humor right? :slight_smile:

-philip

Reason #1: http://pjkh.com/articles/2009/11/13/ruby-in-a-nutshell Reason #2: http://pastefree.pjkh.com/pastes/150

Neither reason above is very serious, but there's always some truth in humor right? :slight_smile:

-philip

I like the first one, thanks a lot for your help!