PHP Vs Ruby CakePHP Vs Ruby On Rails Gautam Rege A brief debate between PHP and Ruby, CakePHP and Rails
About Me Gautam Rege Director @ Josh Software Pvt. Ltd. 9+ years software experience. Rubyist & Entrepreneur  @gautamrege http://gautamrege.wordpress.com Josh Software Ruby On Rails, Ruby On Rails, Ruby On Rails Little bit of J2EE and .NET
Am I out of place?? What will you gain by listening in on the debate between 2 RAD frameworks? Is this about Rails propaganda? Do you have rotten tomatoes to throw? Don't throw shoes and make me famous! ;)
Ruby – Overview Object Oriented Scripting language. Classes, Objects, instance methods etc.  Blocks (yield) Simple 'Duck Typing' using 'responds_to' Mixins Simplicity of single inheritance Power of multiple inhertitance Meta-programming !
Ruby On Rails - Overview Framework built in Ruby (obviously) MVC pattern RESTful  ORM using ActiveRecord Inbuilt Caching  Object Caching Query Caching Fragment Caching
What do we discuss now? PHP Vs Ruby CakePHP Vs Rails What is Ruby and Ruby On Rails?
PHP Vs Ruby Patched Obj. Oriented ?? Reflection & Meta-programing ?? ?? Extremely Popular ! Tons of people Pure Object Oriented Easy to read !! Inherent reflection & meta-programing use Code blocks Gaining popularity Small community
TIOBE Programing Community Index – Jan 2010
Relative Language Popularity over  5, 10, 25 years
Programing Community Index
CakePHP Vs Ruby On Rails CakePHP has been inspired by Ruby On Rails. Modeling, Routing is similar  IDEAL for PHP programmers who Do not have a choice but to use PHP Do not want to learn a new language. Why not try the real thing?
CakePHP Vs Ruby On Rails AppModel Associative Arrays $user['User']['first_name'] Relationships belongs_to has_many has_one  has_and_belongs_to_many 'on the fly' relations bindModel ActiveRecord Ruby Objects @user.first_name Relationships belongs_to has_many has_one  has_many :through => … meta-programing
CakePHP Vs Ruby On Rails AppController AppController set()  method to  access data from controller in a view. ?? html AJAX $ajax->link ActionController ActionView Instance Variables in controller 'magically' available in views. responds_to? | format | html, xml, json, js AJAX link_to_remote
What I found missing in CakePHP aka – Rails rocks! ;) Migrations are missing or not not recommended. Even the tutorials do not use migrations but raw SQL. No mention of deployment.  Guess its a standard Apache + mod_php setup. Use of associative arrays instead of objects $user['user']['first_name'] instead of @user.first_name
What I found missing in CakePHP aka – Rails rocks ! ;)  No support for RESTful routes map.resources :users Provides CRUD for User model /users ( GET | POST ) /users/:id ( GET | DELETE) /users/:id/edit (PUT)
What I found missing in CakePHP aka – Rails rocks ! ;)  There is still a lot of code visible. Lot of configuration  Lot of coding / views etc. etc. DEMONSTRATION of  the Rails way ??
Demonstration - Blog Create a web application for blog posts. A post has a Title and some body text. A post may be published optionally. We should be able to create a post. We should be able to edit a post. We should be able to delete a post. We should be able to list all posts. All information should be stored in database.
Time and Effort Estimate How much  TIME  would you take for this? How many  LINES OF CODE  would you write? Modules: Database configuration Database Schema Logic for posts HTML design Testing
Ruby On Rails I hereby promise that we shall develop  the blog application  WITHOUT TYPING A SINGLE LINE OF CODE in 1 MINUTE.
Steps Create a rails project Create the “post” scaffold Update the database Start the server Test it out  Create a post Edit a post
Steps Create a rails project Create the “post” scaffold Update the database Start the server Test it out  Create a post Edit a post
Steps Create a rails project Create the “post” scaffold Update the database Start the server Test it out  Create a post Edit a post
Steps Create a rails project Create the “post” scaffold Update the database Start the server Test it out  Create a post Edit a post
Steps Create a rails project Create the “post” scaffold Update the database Start the server Test it out  Create a post Edit a post
Satisfied? Are we ever satisfied? NOW lets add some fancy stuff to this. Lets add some validation A post cannot be created without a title. NOW we do a little bit of coding !!
Satisfied NOW?? No?  Alright! Now you are becoming a programmer! Lets add some UI styles to make it look better Some more 'coding' here!
Thank You! - Shoot me? (with questions only please)

Rails Vs CakePHP

  • 1.
    PHP Vs RubyCakePHP Vs Ruby On Rails Gautam Rege A brief debate between PHP and Ruby, CakePHP and Rails
  • 2.
    About Me GautamRege Director @ Josh Software Pvt. Ltd. 9+ years software experience. Rubyist & Entrepreneur @gautamrege http://gautamrege.wordpress.com Josh Software Ruby On Rails, Ruby On Rails, Ruby On Rails Little bit of J2EE and .NET
  • 3.
    Am I outof place?? What will you gain by listening in on the debate between 2 RAD frameworks? Is this about Rails propaganda? Do you have rotten tomatoes to throw? Don't throw shoes and make me famous! ;)
  • 4.
    Ruby – OverviewObject Oriented Scripting language. Classes, Objects, instance methods etc. Blocks (yield) Simple 'Duck Typing' using 'responds_to' Mixins Simplicity of single inheritance Power of multiple inhertitance Meta-programming !
  • 5.
    Ruby On Rails- Overview Framework built in Ruby (obviously) MVC pattern RESTful ORM using ActiveRecord Inbuilt Caching Object Caching Query Caching Fragment Caching
  • 6.
    What do wediscuss now? PHP Vs Ruby CakePHP Vs Rails What is Ruby and Ruby On Rails?
  • 7.
    PHP Vs RubyPatched Obj. Oriented ?? Reflection & Meta-programing ?? ?? Extremely Popular ! Tons of people Pure Object Oriented Easy to read !! Inherent reflection & meta-programing use Code blocks Gaining popularity Small community
  • 8.
    TIOBE Programing CommunityIndex – Jan 2010
  • 9.
    Relative Language Popularityover 5, 10, 25 years
  • 10.
  • 11.
    CakePHP Vs RubyOn Rails CakePHP has been inspired by Ruby On Rails. Modeling, Routing is similar IDEAL for PHP programmers who Do not have a choice but to use PHP Do not want to learn a new language. Why not try the real thing?
  • 12.
    CakePHP Vs RubyOn Rails AppModel Associative Arrays $user['User']['first_name'] Relationships belongs_to has_many has_one has_and_belongs_to_many 'on the fly' relations bindModel ActiveRecord Ruby Objects @user.first_name Relationships belongs_to has_many has_one has_many :through => … meta-programing
  • 13.
    CakePHP Vs RubyOn Rails AppController AppController set() method to access data from controller in a view. ?? html AJAX $ajax->link ActionController ActionView Instance Variables in controller 'magically' available in views. responds_to? | format | html, xml, json, js AJAX link_to_remote
  • 14.
    What I foundmissing in CakePHP aka – Rails rocks! ;) Migrations are missing or not not recommended. Even the tutorials do not use migrations but raw SQL. No mention of deployment. Guess its a standard Apache + mod_php setup. Use of associative arrays instead of objects $user['user']['first_name'] instead of @user.first_name
  • 15.
    What I foundmissing in CakePHP aka – Rails rocks ! ;) No support for RESTful routes map.resources :users Provides CRUD for User model /users ( GET | POST ) /users/:id ( GET | DELETE) /users/:id/edit (PUT)
  • 16.
    What I foundmissing in CakePHP aka – Rails rocks ! ;) There is still a lot of code visible. Lot of configuration Lot of coding / views etc. etc. DEMONSTRATION of the Rails way ??
  • 17.
    Demonstration - BlogCreate a web application for blog posts. A post has a Title and some body text. A post may be published optionally. We should be able to create a post. We should be able to edit a post. We should be able to delete a post. We should be able to list all posts. All information should be stored in database.
  • 18.
    Time and EffortEstimate How much TIME would you take for this? How many LINES OF CODE would you write? Modules: Database configuration Database Schema Logic for posts HTML design Testing
  • 19.
    Ruby On RailsI hereby promise that we shall develop the blog application WITHOUT TYPING A SINGLE LINE OF CODE in 1 MINUTE.
  • 20.
    Steps Create arails project Create the “post” scaffold Update the database Start the server Test it out Create a post Edit a post
  • 21.
    Steps Create arails project Create the “post” scaffold Update the database Start the server Test it out Create a post Edit a post
  • 22.
    Steps Create arails project Create the “post” scaffold Update the database Start the server Test it out Create a post Edit a post
  • 23.
    Steps Create arails project Create the “post” scaffold Update the database Start the server Test it out Create a post Edit a post
  • 24.
    Steps Create arails project Create the “post” scaffold Update the database Start the server Test it out Create a post Edit a post
  • 25.
    Satisfied? Are weever satisfied? NOW lets add some fancy stuff to this. Lets add some validation A post cannot be created without a title. NOW we do a little bit of coding !!
  • 26.
    Satisfied NOW?? No? Alright! Now you are becoming a programmer! Lets add some UI styles to make it look better Some more 'coding' here!
  • 27.
    Thank You! -Shoot me? (with questions only please)