First off I've got to set things straight.  Ruby is to CF as Rails is
to Fusebox, Mach-II, Cold-spring, or whatever your framework choice
is.

As to Ruby vs CF, Ruby is more of a general purpose language that is
easily extended to make a domain specific language.  Rails, is a huge
domain specific language.  The use of a DSL makes creating the web app
a lot more english-like.  For instance.

class Company < ActiveRecord

  validates_uniqueness_of :name  <-- this is an example of a DSL
  validates_acceptance_of :terms
  validates_presence_of :address

  has_many :contracts <-- this is an example of a DSL that sets up a
relationship to the contracts table

  acts_as_versioned <-- this is an example of a DSL that automatically
handles version tables

end

With this simple setup, I've set the appropriate validations, a
relationship and a versioning system.  It follows along with the
original reasoning I had for CF, less code does a lot more.

The other thing that I like that I originally didn't think I would
like is that everything has it's place.  Do you have a stylesheet, if
so, it goes in the /public/stylesheets/ directory.  Javascript, same
deal.  Model?  it goes in the app/models directory.  It's very
limiting, but also very freeing in that I can concentrate more on
business logic than where code should go.

Ruby is also OO from the ground up.  It took me a while to transition,
but now, I miss static methods when I program in CF.  Another biggie
is there's no such thing as an Application scope in Rails.  I've
learned ways around that.  Each ruby site is it's own entity and has a
share nothing architecture.  This is good in that fact that you can
restart one site and not worry about it bringing all the other sites
down like when you cycle the CF app server.  The sites are also self
contained.  No mappings to worry about, no special custom tag
directories to twitter with.  If you have a plugin that you want to
use on a site, that plugin will go in a special plugin directory that
is part of your site.

SES urls....Rails has them by design as demonstrated by the above url.
 It also has the ability to create your own url rules....got a
controller named "suckers", but don't want that to show up in the
site? "map.route 'clients', :controller=>'suckers'", now
www.mysite.com/clients/show/1 is equivalent to
www.mysite.com/suckers/show/1

Other things that are cool:

I'm rewriting a CF app right now that handles Projects, Companies,
Contracts, Users, Faqs, etc.  I'm about 80% done and still have not
written any sql.  All of my relationships are there and I can do look
ups like Project.find(:first).contracts.find(:first).company.name and
this will give me the name of the Company that has the first contract
on the first project.

Ruby methods and properties have the same look.  Say for instance I
have a user model that has a property of hashed_password.  Typically,
you wouldn't want to have to write user.hashed_password =
hash(thisPassword).  So in my user model, I write a method as such

def password=(pass)
  self.hashed_password = hash(pass)
end

and now I can use this syntax, user.password="fido".  It's not a big
difference, but it makes the code a lot more readable and more
'blackbox' like.  There's no need to use getters and setters from the
start to abstract it out.

TDD is baked into the rails framework, although I have to admit, I
suck at creating tests for it.


Now, things aren't all rosy.  Deployment is tougher than CF's ftp and
go.  There's more to a site set up than that.  Caching is more
important in rails apps, but luckily there are some good baked in
methods to doing it.

Rails works with sqlserver, but there are some issues with binary
objects and there's not a lot of attention paid to it.  Mysql and
postgresql get all the attention.  It's an interpreted language (for
now...although there's a jruby implementation about to go 1.0 and
there's work on a .net version)

Overall, I enjoy doing ruby/rails development over CF nowadays, and
I've been a CF developer since 97.  I've programmed in many languages
and never had as much fun as ruby.

I could go on and on about it, but just reading about it isn't near as
much fun as actually doing a project in it.  It's all free, what can
it hurt to try it out.











On 5/29/07, Vivec <[EMAIL PROTECTED]> wrote:
> Mm..not bad.
>
> So what do you think are the advantages vs CF if any?
>
> On 5/29/07, Zaphod Beeblebrox <[EMAIL PROTECTED]> wrote:
> > If you're using the rails framework, it would look similar to this.
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Community/message.cfm/messageid:235771
Subscription: http://www.houseoffusion.com/groups/CF-Community/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5

Reply via email to