Help me (php dev) choose Ruby on Rails. Few questions

Hi,

This is my first post and I have been waiting to try Ruby on Rails since
a long time now. I have a few questions that I am looking an answer
for:

  1. I am intermediate level PHP developer, I have a small project in hand
    which I need to finish in 3 weeks. 3 weeks sounds doable in PHP.
    However, I want to take an opportunity to learn Ruby On Rails. I have no
    experience with Ruby but I just read about the basic syntax and how it
    works - i think it’s much easier than PHP thou. So let’s say if spend my
    first week trying out Ruby on Rails and getting use to the new
    programming language, would it be good enough for me to write the simple
    app that I need in 2 weeks. Assuming I have to ‘not worry about so many
    configurations’ like login, maintaining sessions, paging record sets etc
    etc.

I can pick up languages reasonably quickly, so what do you guys suggest?

  1. Which is the best IDE or editor for ruby on rails, I am not sure
    which one is shown in the Flickr and Blog (take 2 with sound)
    screencasts shown on the website. I am currently coding PHP in VIM and
    like to use Shell for mySQL. What would you guys recommend?

  2. Is the documentation (manual) available as downloadable PDF. I might
    be traveling a bit in the near future and would love to code when I
    don’t have internet around.

  3. How secure is ruby on rails? I know this is too broad a question but
    since it’s framework which takes care of lot of things I would like to
    understand how much does rails focusses on Security. For instance if I
    am using Login Module working the rails way and if I need a dynamic
    image to check if it’s human or a robot trying to login, does rails
    already have such feature built in?

I think these are quite a lot. Thanks in advance. I look forward to take
up rails. cheers!

lin

On Mar 7, 2006, at 8:49 AM, Shalin Jain wrote:

However, I want to take an opportunity to learn Ruby On Rails. I
sets etc
etc.

I can pick up languages reasonably quickly, so what do you guys
suggest?

It’s hard to say from your description of the app you need to build.
Can you elaborate as to what the site will need to do? If you can we
might be able to make better suggestions to you. If its a simple site
then you can probably do it no problem. But you dont want to commit
if its a bigger project with a deadline. That being said, I can
usually build small 8-10 page websites with a few dynamic parts like
a news page and a few other things in 5 or 6 hours. Of course I have
been using rails for a long time now.

  1. Which is the best IDE or editor for ruby on rails, I am not sure
    which one is shown in the Flickr and Blog (take 2 with sound)
    screencasts shown on the website. I am currently coding PHP in VIM and
    like to use Shell for mySQL. What would you guys recommend?

The IDE in the video is textmate for OSX only. http://
macromates.com . But many rubyists use vim and there are even a few
vim scripts to help with ruby/rails coding. Mysql from the cli is
finer, its what I usually do. With rails you can use migrations so
you never have to use the mysql cli except for creating a new
database. All your tables can be created and altered from within ruby.

  1. Is the documentation (manual) available as downloadable PDF. I
    might
    be traveling a bit in the near future and would love to code when I
    don’t have internet around.

There is the Agile Web Dev with Rails book that is available from
http://prafmaticprogrammers.com . It has everything you need to get
going with rails and i highly recommend it. The pdf is pretty cheap
as well, it will be the best $20 you can spend to learn rails.

  1. How secure is ruby on rails? I know this is too broad a question
    but
    since it’s framework which takes care of lot of things I would like to
    understand how much does rails focusses on Security. For instance if I
    am using Login Module working the rails way and if I need a dynamic
    image to check if it’s human or a robot trying to login, does rails
    already have such feature built in?

Rails has everything you need to make your apps secure but you still
have to think before you code just like anything else. There is a
plugin somewhere for the captcha images you mention but its not in
rails proper.

I think these are quite a lot. Thanks in advance. I look forward to
take
up rails. cheers!

lin

Welcome aboard!

-Ezra Z.
Yakima Herald-Republic
WebMaster

509-577-7732
[email protected]

As for the length of time, three weeks can be enough, or be woefully
insufficient, depending on your skills and scope of the project.

As for the best editor, textmate (www.macromates.com) is quite popular
for
those of mac-ish persuasions, and is what is used by the rails
developers
and in the videos. Radrails (www.radrails.org), is more of an ide that
is
based on eclipse that works quite well also on windows, mac and linux.

The best documentation for rails beginners is probably the Agile Web
Development with Rails book from the pragmatic bookshelf. You can get
it as
a pdf for ~$22. Also, when you install rails from gems, the rdoc api
documentation is available offline by running # gem_server, and
accessing
localhost:8808.

As for authenication schemes, rails does not have any “built-in”
authentication system. There are howerver several excellent third party
auth. systems available as plugins, etc. I don’t know of any that
provide
captcha inegration, you might have to add that yourself.

Joe Kowalski

Hi,

it’s great that you want to try RoR and I think there’s no better way
to learn something new than to take it for a spin “in the real world”.

However, I’d like to inject a bit of reality here.

On two different occasions I’ve had people come to me with Rails
projects that needed rescuing. Both times either the client or the
developer asserted that the project was X% done and both times they
had grossly overestimated how much work had actually been completed.

Both times my response was “but there’s nothing there!”. Not one
feature had meaningful unit or functional tests and all they really
had was the result of a database schema and calls to “./script/
generate scaffold”.

Yes, a database schema does take time to define but apart from
that, weeks of development effort had gone into something that any
experienced rails developer could have done in a couple of hours.

It was as if they defined the schema, generated the scaffold and then
said: “now what?”. And they spent weeks trying (and failing) to
answer that question.

So, assuming this isn’t a toy project and you have a real deliverable
for a paying client, here’s my advice:

1 - Budget extra time.

Rails does make things easier but only if you don’t fight the
framework. It’s unrealistic to expect that Rails will shave 30% off
your development effort for a 3 week project if you’re not already
used to doing things the Rails way.

Just how much extra time you budget depends on point #2.

2 - Have an early success metric.

You need to have a milestone that you can hit within your budgeted
“extra” time that will tell you if you need to abort and implement it
in PHP.

My advice is to choose a feature that is at the very core of your
application - an aspect that is at least partly the reason for the
app existing in the first place.

And here’s the critical part: develop that feature from start to
finish. Unit tests, functional tests, all logic. Ignore stuff
like navigation or graphics, even user login - concentrate solely on
the logic and interaction for that one feature.

3 - Decide whether it’s worth the risk for this project.

Once you’ve fully implemented the feature (or you’ve run out of time)
you have to decide whether to continue with Rails for this project.
If the first feature is a resounding success or a dismal failure the
decision is pretty easy.

Chances are though, it’ll be somewhere in the middle. You’ll get it
done but it will have been a struggle. You’ll have to look at the
rest of your app and do some math.

I budgeted X days to do the first feature in PHP and it took me X
days to do it in rails. What lessons did you learn? How much time
did I burn because I didn’t understand “why” something is done a
certain way in Rails? Will I burn less time on the next feature?

Ultimately if your answer to “can I hit my delivery date with Rails”
isn’t “hell yeah!” then you are taking a big risk.

4 - If you decide to abort, try again.

If it doesn’t work out and you decide that (for the client’s benefit)
you’re going to implement in PHP, make sure you revisit Rails - it
really is worth it. An excellent learning experience would be to re-
implement this project in Rails after you’ve delivered the PHP
version to your client.

I hope this all doesn’t come off as too negative. Much of what you
hear about productivity gains can be backed up by a lot of people,
myself included. However, I personally believe you won’t start to
realize those gains until your next “three week” Rails project.

Good Luck!
Trevor

On 7-Mar-06, at 8:49 AM, Shalin Jain wrote:

However, I want to take an opportunity to learn Ruby On Rails. I
sets etc
etc.

be traveling a bit in the near future and would love to code when I
I think these are quite a lot. Thanks in advance. I look forward to
http://lists.rubyonrails.org/mailman/listinfo/rails

Trevor S.
http://somethinglearned.com

Shalin Jain wrote:

works - i think it’s much easier than PHP thou. So let’s say if spend my
first week trying out Ruby on Rails and getting use to the new
programming language, would it be good enough for me to write the simple
app that I need in 2 weeks. Assuming I have to ‘not worry about so many
configurations’ like login, maintaining sessions, paging record sets etc
etc.

I can pick up languages reasonably quickly, so what do you guys suggest?

To reinforce what Trevor S. said:

Given that you would need the whole three weeks to do it in PHP, if you
start by spending a week learning Rails you will have given up any
chance of delivering on time if you find you need to fall back to PHP.

Trying to learn under that kind of pressure would be unwise.

You would only learn the basics of application development in that first
week - you would be by no means expert (how long has it taken you to
become an intermediate PHP developer?). Some of my colleagues - skilled
J2EE developers with plenty of OO and MVC experience - have been using
Rails for prototyping, and being dropped into that as a full time
activity, with no previous exposure to Rails, they took two weeks or
more to become productive. They are very happy with Rails, and the
learning curve is gentle, but that doesn’t mean it is short.

Don’t forget the potentially tricky subject of Rails deployment. Whereas
Rails application development has a gentle learning curve, production
deployment has a steep one. When Ezra’s book comes out I’m sure this
situation will improve, and hosting companies specialising in Rails are
starting to appear, but for now hosting Rails apps is a different world
from hosting PHP apps. If you’ve been following this list, you will have
ample evidence of that.

Perhaps you could finish this project in PHP and spend a little time
each evening learning how to re-create that day’s work in Rails. If that
went well, you might have enough confidence with Rails development to
make it worth spending some more of your time learning how to set up a
production environment. Then you would be able to make an informed
decision regarding what to use for your next project.

regards

Justin

Am 08.03.2006 um 07:41 schrieb Shalin Jain:

Besides, i spent some more time thinking about products that are
deployable. Lets say if I write products or scripts which is typically
not a hosted solution but a re-distributable set of scripts to be
installed by End Users and not developers. Let’s reinforce end
users by
“lots and lots of end users” with cheap hosting accounts ($8.95
etc). Do
you think PHP still takes the lead here?

As far as I can see, PHP will be stronger here than Ruby for some
time simply because you can host much more low traffic applications
on the same server with PHP since it much less memory than Ruby on
FastCGI and is faster than Ruby CGI (even more with a byte code cache).

This means: Many installations of an application as every user has
its own files and databases. If you want to do “forum hosting”, i.e.
you have all the code and there is one big database storing all the
forums then Rails could be a good option.

For example, if you wanted 100 parallel installs of something like
Basecamp then PHP is what you want since it is pretty fast and has a
lower memory footprint. If you wanted to write this from scratch and
offer it as a service … well you know what BC is written in :slight_smile:

If what I said above is exactly true that PHP infrastructure is far
more
available and supported and if I have to write some apps in rails and
some in PHP. Wouldn’t be just better to stick with one language? At
the
end of the day both can create equally well performing applications
while PHP is just a harder approach?

It depends on what you want. If you want a “shrinkwrap” Forum/Gallery
then stick to what’s already there. If you want to write your own
code and you have to write things from scratch anyway then IMO Rails
is the best thing available in any language.

Regards,

Manuel

  1. I am intermediate level PHP developer, I have a small project in hand
    which I need to finish in 3 weeks. 3 weeks sounds doable in PHP.
    However, I want to take an opportunity to learn Ruby On Rails. I have no
    experience with Ruby but I just read about the basic syntax and how it
    works - i think it’s much easier than PHP thou.

I won’t recommend this as a way of learning RoR.
What was recommended to me (by the PHP London group in fact) was to join
or start a sourcforge project. Having read the Agile book and started on
the Pickaxe one this is just what I have done.

I’m still learning PHP (OOP and Pattern design) and it come in useful in
asking questions about RoRs methologies on this forum.

_tony

Thanks Everyone. Trevor and Justin: I think at this point I will stick
to PHP for now and try Rails over a period of time now that I sure I can
make it in just under 3 weeks. So maybe couple of hours of Rails as I
go.

Besides, i spent some more time thinking about products that are
deployable. Lets say if I write products or scripts which is typically
not a hosted solution but a re-distributable set of scripts to be
installed by End Users and not developers. Let’s reinforce end users by
“lots and lots of end users” with cheap hosting accounts ($8.95 etc). Do
you think PHP still takes the lead here?

If what I said above is exactly true that PHP infrastructure is far more
available and supported and if I have to write some apps in rails and
some in PHP. Wouldn’t be just better to stick with one language? At the
end of the day both can create equally well performing applications
while PHP is just a harder approach?

Thoughts?