test your might - framework combat
DESCRIPTION
An Introduction to both Symfony and Ruby on Rails frameworks and a comparison of their respective PHP and Ruby languages.TRANSCRIPT
Test Your MightA Framework Showdown
Monday, October 19, 2009
Symfony Virtuoso
Brent ShafferRails Ninja
Travis [email protected]/travisroberts
[email protected]/bshaffer
Monday, October 19, 2009
Why Ruby is Awesome
It’s intuitive
guesses are usually correct
Very readable and concise
Chain methods (try that in PHP!)
"Hello, world!".reverse.upcase.split.first=> "!DLROW"
Monday, October 19, 2009
Why Ruby is Awesome
Everything is an object! (pure OOP)
"Hello, world!".reverse=> "!dlrow ,olleH"
12.5.floor=> 12
["e", "b", "d", "c", "a"].sort=> ["a", "b", "c", "d", "e"]
Monday, October 19, 2009
Why Ruby is Awesome
Awesome Syntax
Method punctuation (is_admin?, delete!)
Curly braces not required
Optional parenthesis for method calls
Instance variables are nothing special
Implicit method returns
NO SEMICOLONS!!!!
Monday, October 19, 2009
Why Ruby is Awesome
Monday, October 19, 2009
Why Ruby is Awesome
Blocks5.times do |x| puts x * 2end
["1", "2", "3", "4"].each do |x| p x.to_iend
10.downto(1) do |x| puts "Number: #{x}"end
Monday, October 19, 2009
Why Ruby is Awesome
Great for scripting
maintenance tasks
convenience scripts
Monday, October 19, 2009
Why PHP is Awesome
PHP jobs vastly outnumber Ruby jobs
Ubiquity
One-fifth of all open source code being written today is written in PHP.
PHP is installed on over 20 million websites and 1 million web servers
Monday, October 19, 2009
Why PHP is Awesome
Interpretive Language
Great for scripting
Evolving
Very Active Community
Monday, October 19, 2009
Why PHP is Awesome
!
Data found here in PDF format.
Monday, October 19, 2009
Why PHP is Awesome
!
Data found here in PDF format.
Monday, October 19, 2009
Why PHP is AwesomeBuilt-in Functions
C Extensions
PECL
Anonymous Functions / Namespacing
Monday, October 19, 2009
PHP SyntaxGet Over Yourself
$var = new MyClass();
$days = range(1, 31);
$class->each(function($i){ echo $i; });
$hash = array('this' => 'one', 'is' => 'associative');
$arr = array('this', 'is', 'an', 'array');
function is_best_language($lang) { return strtoupper($lang) == 'PHP'; }
var = MyClass.new
days = (1..31).to_a
myclass.each { |i| puts i }
hash = {'this' => 'one', 'is' => 'associative'}
arr = ['this', 'is', 'an', 'array']
def best_language?(lang) lang.downcase == 'ruby' end
PHP Ruby
Monday, October 19, 2009
Why PHP is AwesomeCoincidence??
Monday, October 19, 2009
Why Rails is Awesome
It uses Ruby!
MVC FTW
Rails community is awesome
Monday, October 19, 2009
Why Rails is Awesome
RubyGems
bundled code libraries
rmagick, haml, capistrano, etc.
Plugins
authlogic, exception notifier, etc.
Monday, October 19, 2009
Why Rails is Awesome
Convention over Configuration
it makes logical assumptions
db table names, file names, etc.
Monday, October 19, 2009
Why Rails is Awesome
ActiveRecord ORM# get specified recordsUser.allUser.first
# get all users whose first name is "John"User.all(:conditions => ["name LIKE ?", "John"])
# get all users and their related profile record (eager load)User.all(:include => :profile)
Monday, October 19, 2009
Why Rails is Awesome
Query caching - it’s automagic
Monday, October 19, 2009
Why Rails is Awesome
Easy deployment with Capistrano
Testing - lots of choices
cucumber/rspec, shoulda, test::unit
Open-source
Monday, October 19, 2009
PHP Web Framework using the MVC Design Pattern
Doctrine ORM - based on Hibernate
Incorporates concepts from Mojavi (MVC implementation), Rails (routing) and many other open source projects
Why Symfony is Awesome
Monday, October 19, 2009
Why Symfony is AwesomeDoctrine ORM
// Magic Methods$results = Doctrine::getTable('User')->findAll();
// Hydration Methods$results = Doctrine::getTable('User') ->createQuery() ->where('count > ?', 2) ->execute(Doctrine::HYDRATE_ARRAY);
// Doctrine 2.0$results = User::findAll();
Symfony Components
Monday, October 19, 2009
Why Symfony is Awesome
Form Framework
Widgets and Validators
As complex or simple as you want
Easily handles difficult form logic
Optionally independent of models
Monday, October 19, 2009
Cascading Configurations
Project > Application > Module
Write your own handlers
Philosophy - Less Magic
Young Community
Quickly Evolving
Why Symfony is Awesome
Monday, October 19, 2009
Monday, October 19, 2009