SlideShare a Scribd company logo
Web Frameworks
A brief overview
Gianfranco Reppucci
@giefferre

martedì 29 ottobre 13
So, what?

• Cos’è un framework web?
• Quale framework utilizzare?
• Qualche esempio pratico
• Alcune considerazioni

martedì 29 ottobre 13
OK, ma perché parlare di
web framework?
Non tutto quello che viene considerato “web
development” si riduce a “creare siti”

• Web Application
• Social Network Apps & Mashup
• Web services
• ...

martedì 29 ottobre 13
Framework = ?
• I primi siti web erano una collezione di
pagine HTML statiche

• Ogni aggiornamento richiedeva un
cambiamento manuale

<html>
<head>
<title>My wonderful website</title>
</head>
<body>
<h1>Hello World!</h1>
<p>This is my ancient website. Enjoy your time here.</p>
<a href=”page2.html”>Click here to open page 2</a>
</body>
</html>

martedì 29 ottobre 13
Framework = ?
• Per creare pagine web dinamiche sono stati
introdotti i linguaggi di programmazione
“server-side”

<%@ language="vbscript" %>
<html>
...
<body>
	
<h1>Un esempio di codice dinamico</h1>
	
<%
	
For i = 1 to 10 Step 1


response.write("Questo messaggio sarà stampato 10 volte")
	
Next
	
%>
</body>
</html>
martedì 29 ottobre 13
Framework = ?
Col crescere delle esigenze e con l’evolversi dei
design patterns, sono aumentate le possibilità
e le complicazioni

• Database
• Manipolazione immagini
• Elaborazione files
• ...

martedì 29 ottobre 13
Framework = ?
• Un framework è un software che permette di
supportare la fase di sviluppo di siti, web
application o web services.

• Lo scopo di un framework è ridurre

l’overhead di un programmatore nello
scrivere parti di codice comuni (gestione
database, templating, sessioni, ecc)

martedì 29 ottobre 13
Ovvero

Un framework è una collezione di
“strati” di software, ognuno dei
quali esegue compiti diversi

martedì 29 ottobre 13
Caratteristiche

• Database configuration, access, mapping
(Object-Relational Mapping)

• URL mapping
• Templating

martedì 29 ottobre 13
Caratteristiche

• Caching
• Security
• AJAX
• Helpers

martedì 29 ottobre 13
Framework != CMS
• È un errore molto frequente quello di
confondere il concetto di Content
Management System con quello di
Framework.

• Solitamente (ma non sempre!) un CMS è

qualcosa di più specifico e complesso di un
framework

martedì 29 ottobre 13
Framework != CMS
Il CMS è un’applicazione “pronta all’uso” che
solitamente serve per creare facilmente siti e
webapp:

• È un contenitore

(di pagine, articoli, contenuti multimediali, ecc.)

• Il backend è più o meno standard
• Ha un proprio sistema di templating
• Di solito customizzabili solo tramite l’uso di
plugin specifici

martedì 29 ottobre 13
Quale framework
utilizzare?

Dipende da:

• Linguaggio di sviluppo che si vuole adoperare
• Necessità strutturali del progetto

martedì 29 ottobre 13
Python

Clojure

Javascript

Erlang

PHP
C
Asp.NET
Smalltalk

Java

martedì 29 ottobre 13

Ruby
Per ognuno dei linguaggi esistenti
esistono diversi framework

martedì 29 ottobre 13
Python

• Django
• Flask
• TurboGear
• Zope 2

martedì 29 ottobre 13
PHP
• Zend
• CodeIgniter
• Symphony
• Slim
• CakePHP

martedì 29 ottobre 13
Ruby

• Ruby on Rails
• Sinatra
• Ramaze

martedì 29 ottobre 13
Javascript

• node.js
• meteor JS
• SproutCore

martedì 29 ottobre 13
Punti in comune
• Paradigma Model-View-Controller
• Strutturazione “Three-tier”

(client, application, database)

• A volte, sono molto simili
Infatti...

martedì 29 ottobre 13
Un esempio pratico

• PHP: Slim
• Python: Flask
• Javascript: node.js + Express JS

martedì 29 ottobre 13
Installazione: Slim
Da shell:
user@host:projectA$ curl -s https://getcomposer.org/installer | php

Create un file composer.json
{
"require": {
"slim/slim": "2.*"
}
}

Da shell:
user@host:projectA$ php composer.phar install

martedì 29 ottobre 13
Installazione: ExpressJS
Scaricate ed installate node.js
Create un file package.json
{
	
	
	
	
	
	
	
}

"name": "node-express-test",
"description": "NodeJS + ExpressJS test",
"version": "0.0.1",
"private": true,
"dependencies": {
	
"express": "3.x"
}

Da shell:
user@host:projectB$ npm install

martedì 29 ottobre 13
Installazione: Flask

Da shell:
user@host:projectC$ pip install flask

EPIC WIN

martedì 29 ottobre 13
Hello world: Slim
index.php
<?php
require 'vendor/autoload.php';
$app = new SlimSlim();
$app->get('/', function () {
echo "Hello World!";
});
$app->run();
?>

martedì 29 ottobre 13
Hello world: ExpressJS

index.js
var express = require('express');
var app = express();
app.get('/', function(req, res){
res.send('Hello World!');
});
app.listen(8002);

martedì 29 ottobre 13
Hello world: Flask

index.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run(port=8003)

martedì 29 ottobre 13
Development server: PHP

Da shell (PHP >= 5.4):
user@host:projectA$ php -S localhost:8001

Altrimenti bisogna installare un classico stack *AMP

martedì 29 ottobre 13
Development server:
node.js
Da shell:
user@host:projectB$ node index.js

martedì 29 ottobre 13
Development server:
Python
Da shell:
user@host:projectC$ python index.py

martedì 29 ottobre 13
Alcune considerazioni

I costrutti dei vari framework
iniziano a somigliarsi tantissimo

martedì 29 ottobre 13
Alcune considerazioni

Va bene specializzarsi con una
tecnologia, ma è necessario
“cambiare aria” ogni tanto

martedì 29 ottobre 13
Alcune considerazioni

Scegliete il framework rispetto al
progetto che dovete sviluppare

martedì 29 ottobre 13
Riferimenti
• http://en.wikipedia.org/wiki/

Comparison_of_web_application_frameworks

• http://en.wikipedia.org/wiki/Web_application_framework
• http://www.slimframework.com/
• http://nodejs.org/
• http://expressjs.com/
• http://www.pip-installer.org/en/latest/installing.html
• http://flask.pocoo.org/

martedì 29 ottobre 13
Grazie
dell’attenzione
@giefferre
http://gdlabs.it

martedì 29 ottobre 13

More Related Content

PDF
Web frameworks
PDF
Groovy technology ecosystem
PDF
I Temi in WordPress
PPTX
Fe04 angular js-101
PDF
Blazor per uno sviluppatore Web Form
PDF
Creare API pubbliche, come evitare gli errori comuni
PPT
Webdays 2004 Blogfordummies2 Ok
PPTX
.NET Core, ASP.NET Core e Linux per il Mobile
Web frameworks
Groovy technology ecosystem
I Temi in WordPress
Fe04 angular js-101
Blazor per uno sviluppatore Web Form
Creare API pubbliche, come evitare gli errori comuni
Webdays 2004 Blogfordummies2 Ok
.NET Core, ASP.NET Core e Linux per il Mobile

What's hot (20)

PPTX
Node js dev day napoli 2016
PPT
Sviluppo Web Agile con Castle Monorail
PPTX
Creare API pubbliche, come evitare gli errori comuni
PDF
Sviluppare Plugin per WordPress
PPTX
Cosa c'è di nuovo in asp.net core 2 0
PDF
SMAU 2017. WordPress Toolkit: la gestione semplificata via Plesk
PDF
Web performance & Http2
PPTX
Creare siti web con Orchard
PDF
Node js: che cos'è e a che cosa serve?
PDF
Introduzione a node: cenni storici ecc
PPTX
Wordpress Template hierarchy
PDF
Ottimizzare WordPress su Windows/IIS
PDF
10 consigli in 10 minuti per un plugin di successo - WordCamp Torino 2018
PPT
Generazione Dinamica di Codice in .NET
PDF
Sviluppo Web con React e Delphi - Seminario Delphi Day 2016, Piacenza
PDF
Web 2.0 sviluppare e ottimizzare oggi
PPTX
Slide typescript - xe dotnet - Codemotion Rome 2015
PPTX
Introduzione ad ASP.NET Core
PDF
REST API fantastiche e dove trovarle
Node js dev day napoli 2016
Sviluppo Web Agile con Castle Monorail
Creare API pubbliche, come evitare gli errori comuni
Sviluppare Plugin per WordPress
Cosa c'è di nuovo in asp.net core 2 0
SMAU 2017. WordPress Toolkit: la gestione semplificata via Plesk
Web performance & Http2
Creare siti web con Orchard
Node js: che cos'è e a che cosa serve?
Introduzione a node: cenni storici ecc
Wordpress Template hierarchy
Ottimizzare WordPress su Windows/IIS
10 consigli in 10 minuti per un plugin di successo - WordCamp Torino 2018
Generazione Dinamica di Codice in .NET
Sviluppo Web con React e Delphi - Seminario Delphi Day 2016, Piacenza
Web 2.0 sviluppare e ottimizzare oggi
Slide typescript - xe dotnet - Codemotion Rome 2015
Introduzione ad ASP.NET Core
REST API fantastiche e dove trovarle
Ad

Similar to Web frameworks (20)

PDF
Node.js - Server Side Javascript
PPTX
ASP.NET Core Services e Linux per il Mobile - Pietro Libro - Codemotion Rome...
PPTX
DbUp - A real case of database migration
PPTX
8 - Web app e CMS - 17/18
PPTX
8 - Web App e CMS - 16/17
TXT
Link. php [santi caltabiano]
PPTX
7 - Web application e CMS
PPT
CruiseControl.net in un progetto reale
PPTX
Single Page Applications
PDF
Javascript - 1 | WebMaster & WebDesigner
PPTX
Slide typescript - net campus
PPTX
TYPESCRIPT, ANGULAR E BOOTSTRAP ASSIEME PER APPLICAZIONI REAL WORLD
PPTX
Sviluppare Azure Web Apps
PDF
Antica presentazione AJAX
PPTX
Le applicazioni web e i CMS (18/19)
PDF
Back to the Future: Migrare da WebForm ad ASP.NET Core gradualmente
PDF
Introduzione alla localizzazione web
PPTX
Real world Visual Studio Code
PPTX
2014.04.04 Sviluppare applicazioni web (completamente) on line con Visual Stu...
PDF
Javascript - 1 | WebMaster & WebDesigner
Node.js - Server Side Javascript
ASP.NET Core Services e Linux per il Mobile - Pietro Libro - Codemotion Rome...
DbUp - A real case of database migration
8 - Web app e CMS - 17/18
8 - Web App e CMS - 16/17
Link. php [santi caltabiano]
7 - Web application e CMS
CruiseControl.net in un progetto reale
Single Page Applications
Javascript - 1 | WebMaster & WebDesigner
Slide typescript - net campus
TYPESCRIPT, ANGULAR E BOOTSTRAP ASSIEME PER APPLICAZIONI REAL WORLD
Sviluppare Azure Web Apps
Antica presentazione AJAX
Le applicazioni web e i CMS (18/19)
Back to the Future: Migrare da WebForm ad ASP.NET Core gradualmente
Introduzione alla localizzazione web
Real world Visual Studio Code
2014.04.04 Sviluppare applicazioni web (completamente) on line con Visual Stu...
Javascript - 1 | WebMaster & WebDesigner
Ad

Web frameworks