Rails Vs CakePHP

12,969 views
12,814 views

Published on

A brief debate on PHP Vs Ruby and CakePHP Vs Ruby On Rails.

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
  • An old comparison, extremely biased, very inaccurate. Although, no one can argue that ruby is indeed a superior language compared to php in many ways. But the features presented to compare both frameworks in this slides arre equally implemented. You would only have the syntax or language preference as a discriminator.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
12,969
On SlideShare
0
From Embeds
0
Number of Embeds
151
Actions
Shares
0
Downloads
85
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Rails Vs CakePHP

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

×