views:

1432

answers:

18

I am a capable programmer and I write software for a living. I am taking up a new project to build a website that has a bunch of forms that perform CRUD operations on a database and some multimedia. I am very familiar with PHP and Python and have written some websites in them. I have written some rake tasks and a few ruby scripts that run in production, but I never wrote any websites in ruby. I am considering using Rails, but I have the following questions. It would be great to know the answers to any/all of these:

  • The project should be done in a month and is very time sensitive. Is 1 month enough for learning with and building a website in RoR?
  • Writing direct SQL queries is one of my strengths and I would like to use it. I heard that RoR is a pain to use if I am writing SQL queries directly. Is this true? Or can I just say execute a query, give me the results (as a list or dictionary) and then I will tell you how to render them?
  • I have heard that RoR does joins in memory and doesn't use the facilities offered by the database. Is this correct?
  • I need to create a website that displays a lot of Images, videos and Java applets. Would RoR hinder my ability to do this?
  • I am OK using a PHP framework. Is this a bad idea? If not, which PHP framework is closest to Rails in terms of programming convenience.
+2  A: 

As you have some Python experience have you had a look at Django?

Tim Almond
-1. Not an answer to any of the above questions.
Gabriel Florit
Also, if I have to learn another framework other than RoR I would like to stick with PHP since that's where a bulk of my expertise lies.I want to use RoR just to test the waters.
mansu
"I want to use RoR just to test the waters" then why not spend an hour or two and test the waters with Django too?
dbr
A: 

I think adding the complexity of rewriting what you already know in a month - on a time sensitive project is a bad idea. Using any framework/tools you are unfamiliar with is probably a bad choice on any "time sensitive" project.

That being said the Zend_Framework for php is pretty solid with its form abstractions. I found an easier time moving to ZF than RoR - I tried both at the same time.

The documentation for ZF is fair - reading the actual code of the library is still my best source for documentation though. It isn't that tough to learn or start up - and if you don't mind IRC / stackoverflowing questions you should be able to learn it pretty fast.

gnarf
-1. Not an answer to any of the above questions.
Gabriel Florit
I believe the first question he asked is answered. Mr. Critical ;)
gnarf
True. You're right. Sorry.
Gabriel Florit
+2  A: 

Rails is great for CRUD stuff.

1 - If you're already familiar with Ruby and MVC, a month should be fine. If not, there's a lot to learn.

2 - Rails will let you execute SQL queries, but it's really set up to take advantage of ActiveRecord.

3 - Rails is designed to switch between database types, so ActiveRecord does a lot on its own. Look into ActiveRecord Associations for more info.

4 - Never tried Java applets, but the rest work fine.

5 - If you're more comfortable with a PHP framework it's not a bad idea at all. There are even a few that try to replicate a lot of Rails features, such as CodeIgniter.

Check out RailsGuides for a better idea about all this.

Jarrod
+6  A: 

The project should be done in a month and is very time sensitive. Is 1 month enough for learning with and building a website in RoR?

Given the experience you describe I imagine one month to learn and build a simple-ish app (especially if it is CRUD based) should be enough. If there is a significant level of complexity I would be loath to learn a new technology and deliver a complicated site in one month.

Writing direct SQL queries is one of my strengths and I would like to use it. I heard that RoR is a pain to use if I am writing SQL queries directly. Is this true? Or can I just say execute a query, give me the results (as a list or dictionary) and then I will tell you how to render them?

The rails way is to use the ActiveRecord object mapppings it gives you (and mostly these work very well) It is also very easy to write direct SQL if that is what you want to do

ModelName.find_by_sql('your query')

is how you do that

I have heard that RoR does joins in memory and doesn't use the facilities offered by the database. Is this correct?

ActiveRecord does a lot for you, but wherever performance is an issue, as above you can write your own SQL to leverage the advantages of the database.

I need to create a website that displays a lot of Images, videos and Java applets. Would RoR hinder my ability to do this?

I don't see why it should. There are lots of gems and plugins out there which help with this sort of functionality, so it may well be the case that a lot of code could already be written for you.

I am OK using a PHP framework. Is this a bad idea? If not, which PHP framework is closest to Rails in terms of programming convenience.

I'll let a PHP expert answer this bit.

DanSingerman
+2  A: 

I am OK using a PHP framework. Is this a bad idea? If not, which PHP framework is closest to Rails in terms of programming convenience.

I guess CakePHP is close to RoR for a PHP framework.

I have not tried Rails myself, but wonder if it is a convenience. As far as Ive read (like the guy who spent 2 years making Rails do something it should not) when you need to do something more complex you apparently have to fight and hack the framework.

There are other frameworks for Ruby, PHP and Python. I suggest you look around a bit more before you decide.

If you want to code in PHP you could try Symfony with Zend Framework.

OIS
"like the guy who spent 2 years making Rails do something it should not" this is the article that made me post this question.
mansu
+11  A: 

Answering your questions in order:

  1. You could certainly learn Rails in that time. It's enough time to build a Web site too, but whether it's enough time for you to build your Web site is a different question. I would personally not want to try such a thing on a tight deadline.
  2. You can write your own SQL queries, but there's little point to using Rails if you are going to work around all of its features.
  3. Joins are normally done as part of the database queries generated by ActiveRecord.
  4. Using ROR is pretty much orthogonal to having images, videos, etc. on a page.
  5. I haven't used it, but CakePHP aims to be quite Railsy. Zend and CodeIgniter are more popular and I'm told better by people who have used all three, though.
Chuck
CodeIgniter and Zend are good PHP web-frameworks. CakePHP is a good Ruby on Rails imitation.
dbr
+2  A: 

The project should be done in a month and is very time sensitive. Is 1 month enough for learning with and building a website in RoR?

It could be, but it could also make things unnecessarily harder on you. I usually wait for a project with a relaxed timeline to try and learn a new technology. If time is of the essense, bust out your favorite language and get it done.

Writing direct SQL queries is one of my strengths and I would like to use it. I heard that RoR is a pain to use if I am writing SQL queries directly. Is this true? Or can I just say execute a query, give me the results (as a list or dictionary) and then I will tell you how to render them?

I am not a Rails developer, but I do know it uses ActiveRecord. I am sure, however, that there is also a way to make it execute raw queries as most ORM do. Right there however you're going against the grain of what the framework wants you do and you may run into problems.

I have heard that RoR does joins in memory and doesn't use the facilities offered by the database. Is this correct?

Anything that abstracts out things for you, particularly database relationships, is going to be far from efficient. Worrying about it beforehand is usually not necessary, and once your application is finished it is common practice to then identify any particular slow queries and redo them by hand if necessary.

I need to create a website that displays a lot of Images, videos and Java applets. Would RoR hinder my ability to do this?

I have no idea why it would.

I am OK using a PHP framework. Is this a bad idea? If not, which PHP framework is closest to Rails in terms of programming convenience.

CakePHP is by far the closest framework to RoR. It borrows from a lot of its ideas. I have used it with some success in the past. CodeIgniter, while not related to Rails, is also terrific if you want something lightweight that won't force you to do anything its way.

Paolo Bergantino
A: 

Don't board the Rails train just because it looks cool. I know it's what everyone is talking about these days but to be honest, it's really not that special and you'd be better off using a framework written in a language you are comfortable with. If you are really good at SQL then it would take longer to learn how to use ActiveRecord than to just write the queries by hand, and ActiveRecord is basically half of Rails, which kind of defeats the purpose of using the framework. So based on the background info you provided, I'd say go with a PHP framework like CodeIgniter (haven't used it myself but I heard it's great, sounds like what you need).

musicfreak
+1  A: 
  • The project should be done in a month and is very time sensitive. Is 1 month enough for learning with and building a website in RoR?

If it's time-sensitive, stick with what you know.. That said, Rails has lots of plugins to handle things like image-uploads which may save you a lot of time. Rails has "scaffold generators" which create basic CRUD applications in a single command:

./script/generate scaffold title:text description:text when:datetime

..will generate the controllers/views to create/edit/delete items. You can then easily wrap nicer looking HTML around it, add authentication (via restful_authentication), and you may have your completed application in a few hours..

  • Writing direct SQL queries is one of my strengths and I would like to use it. I heard that RoR is a pain to use if I am writing SQL queries directly. Is this true? Or can I just say execute a query, give me the results (as a list or dictionary) and then I will tell you how to render them?

There's very few situation where you'd need to write SQL with ActiveRecord, but you can. RoR is still Ruby code, so you can always use a MySQL library and do away with ActiveRecord if you really need to write raw SQL (but, again, you almost certainly don't)

  • I have heard that RoR does joins in memory and doesn't use the facilities offered by the database. Is this correct?

There's no reason ActiveRecord cannot perform JOIN's via SQL queries, the ActiveRecord::Associations::ClassMethods mentions associations being performed via JOIN's.

Besides, even if it does do JOINs through memory, it's worked perfectly well for however long Rails has been around..

  • I need to create a website that displays a lot of Images, videos and Java applets. Would RoR hinder my ability to do this?

No. They're all just bits of HTML, which Rails can output as easily as any other framework.

  • I am OK using a PHP framework. Is this a bad idea? If not, which PHP framework is closest to Rails in terms of programming convenience.

Absolutely. If you don't go with Rails, use a PHP framework!

I would recommend against choosing a framework based on "how close to Rails" it is. PHP isn't Ruby. Trying to "port" (in a manner) a framework to a different language rarely works as well as writing a framework for that language.

As I commented on Chuck's answer, "CodeIgniter and Zend are good PHP web-frameworks. CakePHP is a good Ruby on Rails imitation"..

I found CodeIgniter felt much more like PHP (in a good way), it's documentation is also my favourite of any project I've used!

The Zend Framework is very modular, you can drop bits of Zend into an existing PHP app, or use it's MVC routing system.

CakePHP seems to be trying to make PHP act like Ruby, rather than making a framework that fits nicely with PHP.


All that said, the reason you use Ruby on Rails is the community (and thus all the plugins and stuff that revolve around it).

For example, paperclip plugin makes it extremely easy to an image-upload form (along with thumbnailing). To use it you add (to your model):

has_attached_file :photo, :styles => {:thumb=> "100x100#", :small  => "150x150>" }

Then in your view, where you want the upload form to be, add:

<% form_for :user, :html => { :multipart => true } do |f| %>
  <%= f.file_field :photo%>
<% end %>

That's it.


What I would recommend is spend a day making something simple in Rails. There's countless great tutorials (Railscasts are a good, random, example) and plenty of books on it. See if you like it, if not try CodeIgniter, Zend or CakePHP (or Django, or Merb, or.... Just don't spend the whole month trying frameworks!)

dbr
+1  A: 

IMO a month is very tight to learn and launch in a month ( I'm assuming you're not full time though ) and you wouldn't be full time if you're learning as well. You know how it is when you get deeper.

About a month ago I faced the same dilemma between RoR and MVC. After a few weeks (learning at night ) I learned enough about RoR framework but ruby language was very new to me, the client wanted delivery and I was still in the "playground/sandbox" phase

So, because I know c# and the .net framework well and I can find resources quickly I have since open for MVC and within 2 weeks I've delivered something to the client.

So in my experience, learn RoR give it a week. If you're finding it takes more than say 40 hours to get going with the actual application, then stick with PHP and do RoR when you have more time and less time restraints.

Goodluck either way though!!

5x1llz
+1  A: 

If you're comfortable with Model View Controller stucture then Ruby on Rails isn't too hard to learn. I myself came from PHP's Zend Framework to Ruby on Rails and really found it a relief. I like the whole idea of convention over configuration that Rails uses. It keeps your application (and all future applications) well structured, which in my option is extremely important and time saving.

At this time I've been programming in Ruby with Rails for maybe about 6-7 months and I'm really enjoying it. Clean code, VERY fast development, it's really incredible. Especially with the generator files and database migrations.

As for RoR being a pain when writing raw queries, I'm not sure, I never even have to write them but you sure can with a simple method. That shouldn't be a problem.

Once I started developing web applications in Ruby on Rails, I did not want to go back to PHP. Purely because I'm pretty much in love with how Rails works, the conventions, rapid development, clean code, consistent structure etc etc etc. But these days I now and then still get asked by clients to develop a web application with PHP. But in my eyes, if I went back in to Zend Framework I'd probably really get stressed as I find it extremely inefficient. (That might be my own fault, I'm not sure, but in my eyes, compared to Rails, meh). I discovered the PHP Framework "CakePHP". This framework is as far as I know the closest thing to Rails and I currently use it to develop PHP applications. It's pretty straightforward and works great. It also has a VERY nice thing called the "cookbook" on their website which helps you get up and running very quickly. So if you were to choose a PHP framework I would personally go with CakePHP just because its the closest thing to Rails.

The only thing I myself am a little annoyed about with Rails is that it requires a certain version of Rails to be installed, and that version must be compatible with a specific version of Ruby. You'll need to get the hang of Gems, Plugins (which aren't hard to understand, to be honest). But along with deployment, if you're running Apache 2+ then you need Passenger. Also to be safe you will want to freeze your gems and that kind of stuff to avoid conflicts with the servers specifications and installed utilities.

There's a lot more to learn than just the language and the framework when it comes to Ruby on Rails. PHP is pretty simple, just upload and it works. So you might want to look in to that as well before developing the application.

A: 

The project should be done in a month and is very time sensitive. Is 1 month enough for learning with and building a website in RoR?

As its been said before, stick with what you know if the deadline is short.

I am OK using a PHP framework. Is this a bad idea? If not, which PHP framework is closest to Rails in terms of programming convenience.

CakePHP is very ruby like and I have been told that its a good stepping stone for PHP programmers to get in to Ruby and MVC.

Steven smethurst
+1  A: 

I think Rails is great, and it would be my first choice for such a project, but if you are in fact under a tight deadline and you are starting from square one with Rails, just don't do it. Go with what you know. PHP might not be the greatest, but it's a very serviceable language.

Despite what people might say, Rails does have a non-trivial learning curve, especially if you are not familiar with MVC. There's definitely a "Rails Way" to do things, and coming from most other frameworks, it takes a while to grok.

I think if you try to rush and learn Rails, you're just going to get frustrated, and I'm afraid this would taint your impression of it. Instead, try learning it in your spare time, or on a project with a more relaxed timeline. I think you'll get a lot more out of it this way.

Doug R
+2  A: 

http://www.doctrine-project.org/

I've had great success with the doctrine ORM : if you are writing object oriented php then this does the object->database record mapping for you. AFAIK this is one of the plusses to the django / rails framework.

So this links up the oop/database functionality like this:

$foo = new User(); // makes a new 'transitory' user object
$foo->name = 'bob'; // works like you'd expect
$foo->save(); // but this pushes it into the database.
  //(There's a 'name' column in the 'User' table already: set up when Doctrine initializes).

& if you want a framework, it's a part of symfony now.


It's very motivating to have a real project to learn a new technology or approach, but it is possible to take on too much. It'll take 5 times longer than you'd take in the technology you know. Which can be okay - the learning, and the results might be worth it. But doesn't sound like this is appropriate here.

julz
+2  A: 

Rails is a great framework, but learning that framework and becoming more familiar with constructs specific to Ruby might be a bit much to do simultaneously with a one month deadline.

To step into a web application framework, I would recommend using a PHP framework if you are already familiar with PHP. While not a port, CakePHP is very much similar to Rails. It is modeled after Rails, and is my favorite PHP framework. symfony is a solid framework, but if you're looking for something more Rails-esque I recommend you try CakePHP.

If you're not already married to using Rails or something like it, I would recommend the Zend Framework. It is by far the most comprehensive web application framework available for PHP.

All of these frameworks will allow you to do all of the things you mentioned. It might be easier to think of them as a select group of building blocks than a comprehensive operating system for your website that you extend with plug-ins. That would be more similar to a CMS like ExpressionEngine. You can do anything with these frameworks, they're simply code bases for you to draw from to make developing web applications less tedious.

The Akelos framework is a PHP framework that purports being a port of Rails, so you might also be interested in that.

As for writing SQL queries, it's possible with any PHP framework, but the idea behind these frameworks is convention over configuration. Each has its own ORM scheme to abstract SQL queries away from the developers. While this might be due to the fact that many web developers, at least in my experience, are terrified of SQL, as someone who also likes writing SQL, I do appreciate the massive amounts of time that an ORM framework can save. Again, when the application is developed it's pretty much standard practice to profile the ORM's performance and look for areas to improve. Rapid-prototyping is a huge part of web application frameworks, so tools like this might actually be a hindrance to you. Like others have said, using one of these frameworks might end up being pointless if you're just going to work around their facilities.

Should you decide not to use one of these, PHP has a plethora of mature projects that will help you build an application, but seeking these out and learning how to implement them may take a great deal longer than learning a framework.

Andrew Noyes
A: 

use php + Zend Framework it's have all features of ror and more faster

ror is very slow, very expensive, and require powerful server

* The project should be done in a month and is very time sensitive. Is 1 month enough for learning with and building a website in RoR?

it's enough to learn Zend Framework

* Writing direct SQL queries is one of my strengths and I would like to use it. I heard that RoR is a pain to use if I am writing SQL queries directly. Is this true? Or can I just say execute a query, give me the results (as a list or dictionary) and then I will tell you how to render them?

should to writing SQL queries directly, ror make very slow and unoptimization queries

* I am OK using a PHP framework. Is this a bad idea? If not, which PHP framework is closest to Rails in terms of programming convenience.

all you need is mvc framework, I offer you take Zend Framework

RoR's performance has been improved immensely over the past year or so. It now outperforms all the popular PHP frameworks.
dylanfm
A: 

For 1 month project use what you know better! Until now I have used Qcodo and Qcubed, but you generate your interface only from the database. Any PHP framework uses DSL. I love Python as language but never used. I was looking Ruby On Rails yesterday and it seems pretty nice. RoR has provided a new way to write agile web applications, but now there is grails too. Grails is written in Groovy, runs over the JVM and is dynamic language. The strengh of Grails is that can use any Java code and framework but with the simplicity of a dynamic language. With Grails you can do the same things of Rails and even more.

My advice, use what you know better, meanwhile learn Grails, this is what I am doing now.

rtacconi
A: 

Is 1 month enough for learning with and building a website in RoR?

Yes.

Writing direct SQL queries is one of my strengths and I would like to use it. I heard that RoR is a pain to use if I am writing SQL queries directly. Is this true? Or can I just say execute a query, give me the results (as a list or dictionary) and then I will tell you how to render them?

Writing raw sql with Rails is not any more difficult than doing it with PHP. The object returned will be a hash of column-name/value pairs. The only problem may come if you decide to start using ActiveRecord which returns an ActiveRecord object (not a plain hash)

I have heard that RoR does joins in memory and doesn't use the facilities offered by the database. Is this correct?

If you use raw sql, Rails shouldn't interfere with it.

I need to create a website that displays a lot of Images, videos and Java applets. Would RoR hinder my ability to do this?

No.

I am OK using a PHP framework. Is this a bad idea? If not, which PHP framework is closest to Rails in terms of programming convenience.

IDK.

I really like using ActiveRecord, but if you prefer raw sql, Rails can still be worth using. You'll get good url handling, a lot of built-in security, nice MVC architecture, and a nifty templating system, all while writing Ruby, which for many, has been a good experience.