This document provides an introduction to Ruby on Rails, including:
- An overview of the Model-View-Controller framework and REST architecture that Rails is built on
- Examples of basic Rails concepts like ActiveRecord and routing
- A "Hello World" example using the Ruby language
- Explanations of key Ruby concepts like blocks and duck typing
Explains how to make use of ruby in java-based work environments. There are some hints at .NET equivalents along the way.
This is part 3 of a trilogy of Star Wars-themed ruby talks given at Protegra's SDEC 2011 in Winnipeg, Canada.
Sprockets is an easy solution to managing large JavaScript codebases by letting you structure it, bundle it with related assets, and consolidate it as one single file, with pre-baked command-line tooling, CGI front and Rails plugin. It's a framework-agnostic open-source solution that makes for great serving performance while helping you structure and manage your codebase better.
Explains how to make use of ruby in java-based work environments. There are some hints at .NET equivalents along the way.
This is part 3 of a trilogy of Star Wars-themed ruby talks given at Protegra's SDEC 2011 in Winnipeg, Canada.
Sprockets is an easy solution to managing large JavaScript codebases by letting you structure it, bundle it with related assets, and consolidate it as one single file, with pre-baked command-line tooling, CGI front and Rails plugin. It's a framework-agnostic open-source solution that makes for great serving performance while helping you structure and manage your codebase better.
Imagine for a while that Rails wouldn't exist. How would we write a MVC app from scratch?
Rack provides a minimal interface for developing web applications in Ruby. In fact it's the solid foundation of all major Ruby powered web frameworks.
During this talk we will dive deep into Rack. We will see the smallest possible Rack Application and learn how it works, by studying Rack internals. We will grow the Application step by step till we implement it in simple MVC style.
Doctrine 2.0 Enterprise Persistence Layer for PHPGuilherme Blanco
One area that was mostly abandoned in applications is the Model layer. Doctrine is a project that brings enterprise support this layer through a powerful ORM implementation.
Allied with new support introduced in PHP 5.3, Doctrine 2.0 brings the concept of ORM in PHP to the next level. It introduces a couple of concepts known from other languages and areas, like Annotations, Object Query Languages and Parsers. This talk will introduce these new concepts as well as explain most of its architecture.
Part of a series of talk to help you write your first Perl 6 program today. So its basic syntax and concepts of its object orientation and a comparison to the widely used P5 OO system Moose which is similar by no accident.
From ReactPHP to Facebook Hack's Async implementation and many more, asynchronous programming has been a 'hot' topic lately. But how well does async programming support work in PHP and what can you actually use it for in your projects ? Let's look at some real-world use cases and how they leverage the power of async to do things you didn't know PHP could do.
HTML5 is all the rage with the cool kids, and although there's a lot of focus on the new language, there's lots of interesting new JavaScript APIs both in the HTML5 spec and separated out. This presentation will take you through demos and code behind the new JavaScript APIs, and explore where these features can be used
Web developers constantly look for the latest and greatest ways to hone their craft, but changes come fast. From jQuery to Angular to Ember to React, CoffeeScript to TypeScript, it seems there is always something new. But ES6 is something different. With ES6 we are seeing the evolution of core JavaScript. It includes syntactic improvements and great new features never before seen in client-side code. Linters and transpilers for ES6 are readily available and easy to use. There is no need to wait; learn how to leverage the power of "the new JavaScript" in your applications, today!
Redis is a NoSQL technology that rides a fine line between database and in-memory cache. Redis also offers "remote data structures", which gives it a significant advantage over other in-memory databases. This session will cover several PHP clients for Redis, and how to use them for caching, data modeling and generally improving application throughput.
Imagine for a while that Rails wouldn't exist. How would we write a MVC app from scratch?
Rack provides a minimal interface for developing web applications in Ruby. In fact it's the solid foundation of all major Ruby powered web frameworks.
During this talk we will dive deep into Rack. We will see the smallest possible Rack Application and learn how it works, by studying Rack internals. We will grow the Application step by step till we implement it in simple MVC style.
Doctrine 2.0 Enterprise Persistence Layer for PHPGuilherme Blanco
One area that was mostly abandoned in applications is the Model layer. Doctrine is a project that brings enterprise support this layer through a powerful ORM implementation.
Allied with new support introduced in PHP 5.3, Doctrine 2.0 brings the concept of ORM in PHP to the next level. It introduces a couple of concepts known from other languages and areas, like Annotations, Object Query Languages and Parsers. This talk will introduce these new concepts as well as explain most of its architecture.
Part of a series of talk to help you write your first Perl 6 program today. So its basic syntax and concepts of its object orientation and a comparison to the widely used P5 OO system Moose which is similar by no accident.
From ReactPHP to Facebook Hack's Async implementation and many more, asynchronous programming has been a 'hot' topic lately. But how well does async programming support work in PHP and what can you actually use it for in your projects ? Let's look at some real-world use cases and how they leverage the power of async to do things you didn't know PHP could do.
HTML5 is all the rage with the cool kids, and although there's a lot of focus on the new language, there's lots of interesting new JavaScript APIs both in the HTML5 spec and separated out. This presentation will take you through demos and code behind the new JavaScript APIs, and explore where these features can be used
Web developers constantly look for the latest and greatest ways to hone their craft, but changes come fast. From jQuery to Angular to Ember to React, CoffeeScript to TypeScript, it seems there is always something new. But ES6 is something different. With ES6 we are seeing the evolution of core JavaScript. It includes syntactic improvements and great new features never before seen in client-side code. Linters and transpilers for ES6 are readily available and easy to use. There is no need to wait; learn how to leverage the power of "the new JavaScript" in your applications, today!
Redis is a NoSQL technology that rides a fine line between database and in-memory cache. Redis also offers "remote data structures", which gives it a significant advantage over other in-memory databases. This session will cover several PHP clients for Redis, and how to use them for caching, data modeling and generally improving application throughput.
PHP 5.3 has many new features that allow very different paradigms of software development, that may be unfamiliar to many PHP developers. If you want to learn more about functional or aspect-oriented programming, or how to organize your PHP libraries according to the new de facto PHP namespacing standard, don't miss this talk.
Full-day tutorial for the dutch php conference 2011 giving a very quick tour around all the various areas of the ZCE syllabus and some tips on the exam styles
6. Introduzione
Ruby on Rails
“Powerful web applications that formerly might
have taken weeks or months
to develop can be produced in a matter of days”
Tim O'Reilly, Founder of O'Reilly Media
11. Introduzione
Ruby on Rails
5.times do
puts "Hello world"
end
12. Introduzione
Ruby on Rails
5.times do def show
puts "Hello world" @post = Post.find(params[:id])
end end
13. Ruby
• Linguaggio interpretato ad oggetti
• Fortemente dinamico
5.times do
• Basato sul concetto di blocco puts "Hello world"
end
• Tipizzazione dinamica
14. Ruby
• Linguaggio interpretato ad oggetti
• Fortemente dinamico
5.times do
• Basato sul concetto di blocco puts "Hello world"
end
• Tipizzazione dinamica
15. Ruby
• Linguaggio interpretato ad oggetti
• Fortemente dinamico
5.times do
• Basato sul concetto di blocco puts "Hello world"
end
• Tipizzazione dinamica
Duck Typing “if it looks like
a duck, and quacks like a
duck, it must be a duck”
16. Hello World
5.times do
puts "Hello world"
end
=> “Hello World”
=> “Hello World”
=> “Hello World”
=> “Hello World”
=> “Hello World”
17. Hello World
5.times do
puts "Hello world"
end
=> “Hello World”
=> “Hello World”
=> “Hello World”
=> “Hello World”
=> “Hello World”
34. Recap
Ruby
if ($users <= 0) {
PHP }
echo "No users"
35. Recap
Ruby puts "No users" if users <= 0
if ($users <= 0) {
PHP }
echo "No users"
36. Introduzione
Ruby on Rails
5.times do def show
puts "Hello world" @post = Post.find(params[:id])
end end
37. Rails
• Web Framework Open-Source
• Paradigma Model View Controller def show
@post = Post.find(params[:id])
• Manutenibilità e riuso del codice end
• Paradigma REST
39. Model View Controller
<?php
// Connect to mysql database. Ignore the mysql_select_db for now.
$db = mysql_connect($hostname,$username,$password)
// Get all the users data.
$result = mysql_query("SELECT * FROM users");
// Display some table..
echo '<table .....';
// Now fetch the the array.
while ($row = mysql_fetch_array($result)) {
// And display the row.
echo 'ID: '.$row{'id'}.' Name: '.$row{'name'}.'</br>';
}
?>
40. Model View Controller
<?php
// Connect to mysql database. Ignore the mysql_select_db for now.
$db = mysql_connect($hostname,$username,$password)
// Get all the users data.
$result = mysql_query("SELECT * FROM users");
// Display some table..
echo '<table .....';
// Now fetch the the array.
while ($row = mysql_fetch_array($result)) {
// And display the row.
echo 'ID: '.$row{'id'}.' Name: '.$row{'name'}.'</br>';
}
?>
41. Model View Controller
<?php
// Connect to mysql database. Ignore the mysql_select_db for now.
$db = mysql_connect($hostname,$username,$password)
// Get all the users data.
$result = mysql_query("SELECT * FROM users");
// Display some table..
echo '<table .....';
// Now fetch the the array.
while ($row = mysql_fetch_array($result)) {
// And display the row.
echo 'ID: '.$row{'id'}.' Name: '.$row{'name'}.'</br>';
}
?>
42. Model View Controller
<?php
// Connect to mysql database. Ignore the mysql_select_db for now.
$db = mysql_connect($hostname,$username,$password)
// Get all the users data.
$result = mysql_query("SELECT * FROM users");
// Display some table..
echo '<table .....';
// Now fetch the the array.
while ($row = mysql_fetch_array($result)) {
// And display the row.
echo 'ID: '.$row{'id'}.' Name: '.$row{'name'}.'</br>';
}
?>
43. Model View Controller
<?php
// Connect to mysql database. Ignore the mysql_select_db for now.
$db = mysql_connect($hostname,$username,$password)
// Get all the users data.
$result = mysql_query("SELECT * FROM users");
// Display some table..
echo '<table .....';
// Now fetch the the array.
while ($row = mysql_fetch_array($result)) {
// And display the row.
echo 'ID: '.$row{'id'}.' Name: '.$row{'name'}.'</br>';
}
?>
44. Model View Controller
<?php
// Connect to mysql database. Ignore the mysql_select_db for now.
$db = mysql_connect($hostname,$username,$password)
// Get all the users data.
$result = mysql_query("SELECT * FROM users");
// Display some table..
echo '<table .....';
// Now fetch the the array.
while ($row = mysql_fetch_array($result)) {
// And display the row.
echo 'ID: '.$row{'id'}.' Name: '.$row{'name'}.'</br>';
}
?>
45. Model View Controller
<?php
// Connect to mysql database. Ignore the mysql_select_db for now.
$db = mysql_connect($hostname,$username,$password)
// Get all the users data.
$result = mysql_query("SELECT * FROM users");
// Display some table..
echo '<table .....';
// Now fetch the the array.
while ($row = mysql_fetch_array($result)) {
// And display the row.
echo 'ID: '.$row{'id'}.' Name: '.$row{'name'}.'</br>';
}
?>
46. Model View Controller
<?php
// Connect to mysql database. Ignore the mysql_select_db for now.
$db = mysql_connect($hostname,$username,$password)
X
// Get all the users data.
$result = mysql_query("SELECT * FROM users");
// Display some table..
echo '<table .....';
// Now fetch the the array.
while ($row = mysql_fetch_array($result)) {
// And display the row.
echo 'ID: '.$row{'id'}.' Name: '.$row{'name'}.'</br>';
}
?>
54. RES T
• Architettura distribuita
• Utilizza protocollo HTTP
• Ogni elemento è detto risorsa http://
• Set di operazioni standard
• Utilizza i verbi HTTP ovvero GET,
POST, PUT, DELETE
58. RES T
Azione
GET http://www.twitter.com/api/ tweets/ index
Risorsa
59. RES T
GET tweets/ index Ritorna tutti i tweet
GET tweets/ 1 Ritorna il tweet id=1
GET tweets/ new Ritorna un nuovo tweet
POST tweets/ create Aggiungi un nuovo tweet
GET tweets/ 1/ edit Ritorna il tweet id=1 da modificare
PUT tweets/ 1/ update Modifica il tweet id=1
DELETE tweets/ 1/ destroy Cancella il tweet id=1