The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Using the right language?

Hi,

I'm new to web development (I'm familiar with C++), and I'm deciding between learning Ruby and PHP. I mainly want to make mid-sized websites with basic forum and form support. I know my web vocabulary isn't up to par, so let me try to explain.

I was recently advised to purchase the Agile Web Development on Rails book from this community. I started reading it, and then I looked over all the topics. All I see is how to develop complex applications such as a shopping cart (complex for what I'm trying to build). I'm not 100% sure that that's all that's in there, but it is what is definitely focused on.

Am I using the right languages (Ruby/Rails), or should I be learning PHP? I heard that PHP is more of a linear language than Ruby which seems to be quite object-oriented.

Perhaps I'm using the wrong book. I'd like to use Ruby/Rails, but it seems that it's not what I'm looking for. Maybe another book would fit my needs a little more adequately.

Try this to see if you like the way Ruby "feels" before you make your decision. (in fact, just try it regardless, it's a damn cool tool!)

Also keep in mind that PHP has been a much more popular language than Ruby for a longer time, and as a beginner web programmer you are likely to find quite a lot more documentation and online tutorials for PHP. This balance is likely to shift in the medium term, though.

Thanks for the reply. I tried it out, and it seems pretty fun and, perhaps most importantly, very intuitive. That's what drew me to Ruby in the beginning. So, which book would you guys recommend for the web side of Ruby? Pickaxe?

You could create a rails application without learning Ruby, but it will be hard. The agile web development book is aimed at ruby programmers. Here is an online book to learn Ruby: http://poignantguide.net/ruby/

The pickaxe is a really good book (especially if you already are a programmer).

What I'm trying to say is that I (currently) don't see the point in learning how to make such structured things like a shopping cart. I've done some of it, but I feel that I won't retain any of it since I'm just copying code. I get the feeling that the book just tells you to do it instead of really telling you why or giving you the parameters for the methods, etc.

But the whole thing seems too formal and almost extravagant to me. But maybe the shopping cart learning experience will cover everything I need as well.

I was about to go take a shot at PHP, but I guess I'll try Ruby again. It is the language I wanted to learn, and after ghurtado's link, a language I really like.

The book starts with the shopping chart as an example but the rest of the book explains why you have to do these things (and introduces new things too). You'll want to read Part III. But the shopping chart example is actually easier than the forum you want to create unless it doesn't have authentication (login system).

The shopping chart is 133 pages, the rails-framework expanation is 299 pages

If you are doing really simple sites, then PHP is really the way to go. You will find it performant, well integrated with Apache and very easy to get a "Hello world" out the box. For Ruby you have to assemble odds and ends, there are few tutorials when things go wrong and Rails (if you use it) forces you to do things the Rails way. You will also be more likely to find DHTML coders that can work around PHP code.

Once you go beyond simple, it's a matter of choice. Ruby has a nice syntax, a more able community and fewer, but higher quality, libraries. To make use of the Ruby features, you need a high level of OO ability though. It's kind of expected that Ruby is your second programming language.

I find PHP code written by others easier to follow (by the same programmer), but there is a lot of lousy PHP code out there. PHP is easy to host and is proven at high load. If you want to just plug in some component, like a forum or a blog, you will likely find it easier with PHP. Dont ever expect to integrate it with the rest of your code though .

I'd lean to PHP for what you have described, but Ruby for a longer term view. That said, PHP is so easy to learn, why not try both?

Thanks all. I think I'll learn PHP first; my roommate knows it and he can help me along. But I'm definitely not giving up on Ruby. I love Ruby's syntax: it seems so clean and so much like written English (for a language ).

I'm very bad at making decisions, so expect me back here in a day or two asking again about Ruby