Top Banner
Test Your Might A Framework Showdown Monday, October 19, 2009
26

Test Your Might - Framework Combat

Jan 15, 2015

Download

Technology

Brent Shaffer

An Introduction to both Symfony and Ruby on Rails frameworks and a comparison of their respective PHP and Ruby languages.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Test Your Might - Framework Combat

Test Your MightA Framework Showdown

Monday, October 19, 2009

Page 2: Test Your Might - Framework Combat

Symfony Virtuoso

Brent ShafferRails Ninja

Travis [email protected]/travisroberts

[email protected]/bshaffer

Monday, October 19, 2009

Page 3: Test Your Might - Framework Combat

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

Page 4: Test Your Might - Framework Combat

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

Page 5: Test Your Might - Framework Combat

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

Page 6: Test Your Might - Framework Combat

Why Ruby is Awesome

Monday, October 19, 2009

Page 7: Test Your Might - Framework Combat

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

Page 8: Test Your Might - Framework Combat

Why Ruby is Awesome

Great for scripting

maintenance tasks

convenience scripts

Monday, October 19, 2009

Page 9: Test Your Might - Framework Combat

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

Page 10: Test Your Might - Framework Combat

Why PHP is Awesome

Interpretive Language

Great for scripting

Evolving

Very Active Community

Monday, October 19, 2009

Page 11: Test Your Might - Framework Combat

Why PHP is Awesome

!

Data found here in PDF format.

Monday, October 19, 2009

Page 12: Test Your Might - Framework Combat

Why PHP is Awesome

!

Data found here in PDF format.

Monday, October 19, 2009

Page 13: Test Your Might - Framework Combat

Why PHP is AwesomeBuilt-in Functions

C Extensions

PECL

Anonymous Functions / Namespacing

Monday, October 19, 2009

Page 14: Test Your Might - Framework Combat

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

Page 15: Test Your Might - Framework Combat

Why PHP is AwesomeCoincidence??

Monday, October 19, 2009

Page 16: Test Your Might - Framework Combat

Why Rails is Awesome

It uses Ruby!

MVC FTW

Rails community is awesome

Monday, October 19, 2009

Page 17: Test Your Might - Framework Combat

Why Rails is Awesome

RubyGems

bundled code libraries

rmagick, haml, capistrano, etc.

Plugins

authlogic, exception notifier, etc.

Monday, October 19, 2009

Page 18: Test Your Might - Framework Combat

Why Rails is Awesome

Convention over Configuration

it makes logical assumptions

db table names, file names, etc.

Monday, October 19, 2009

Page 19: Test Your Might - Framework Combat

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

Page 20: Test Your Might - Framework Combat

Why Rails is Awesome

Query caching - it’s automagic

Monday, October 19, 2009

Page 21: Test Your Might - Framework Combat

Why Rails is Awesome

Easy deployment with Capistrano

Testing - lots of choices

cucumber/rspec, shoulda, test::unit

Open-source

Monday, October 19, 2009

Page 22: Test Your Might - Framework Combat

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

Page 23: Test Your Might - Framework Combat

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

Page 24: Test Your Might - Framework Combat

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

Page 25: Test Your Might - Framework Combat

Cascading Configurations

Project > Application > Module

Write your own handlers

Philosophy - Less Magic

Young Community

Quickly Evolving

Why Symfony is Awesome

Monday, October 19, 2009

Page 26: Test Your Might - Framework Combat

Monday, October 19, 2009