“Los lenguajes de la web”;
Roberto Luis Bisbé - @rlbisbe
¿Qué hay en la web?
Frontend HTML
CSS
Javascript
Flash
Silverlight
Applets…
Backend PHP
Java EE
.NET
Python
Ruby
Scala
Clojure…
Datos *SQL
Oracle
XML
JSON
¿De qué vamos a hablar?
Lenguajes de programación menos “serios”
Formatos de marcado
Formatos de datos
PROGRAMACIÓN
Características comunes
Dinámicos
Orientados a objetos
Licencias Open Source
Comunidad
Javascript
Nada que ver con Java
Frameworks (jQuery, Prototype, Mootools)
Implementación en los navegadores web
Usado por: – Todo el mundo…
Client-side javascript: Manejo del DOM
function notEmpty(){ var myTextField = document.getElementById('myText'); if(myTextField.value === "") alert(“Introduzca un valor en el campo”) }
<input type='text' id='myText' /> <input type=’button’ onclick=’notEmpty()’ value=Click’/>
Server-side Javascript:
var http = require('http'); http.createServer(function (request, response) { response.writeHead(
200, {'Content-‐Type': 'text/plain'} );
response.end('Hello World\n'); }).listen(8000); console.log('Server running at http://localhost:8000/');
demo
Multiparadigma
Soporte para bibliotecas científicas
Usado por: – Instagram
– SageMath
#!/usr/bin/env python import sys import os def main(): i = open('in.txt') o = open('out.php','w') o.write("<?php $data = array(\n") counter = 1 for line in i: data = line.split("\n") o.write( str(counter) + '=> "' + data[0] + '",\n') counter +=1; o.write(");\n?>") if __name__ == '__main__': main()
Alta abstracción y legibilidad Multiples frameworks (Rails, Sinatra) Sistema de paquetes (gemas)
Usado por: – GitHub
class Anfitrion def initialize(nombre = "Mundo") @nombre = nombre end def decir_hola puts "Hola #{@nombre}" end def decir_adios puts "Adiós #{@nombre}, vuelve pronto." end end
demo
Programación funcional Rendimiento++ Compatible con bibliotecas java y C# • Quien lo usa? – Twitter – foursquare
def qsort: List[Int] => List[Int] = { case Nil => Nil case pivot :: tail => val (smaller, rest) = tail.partition(_ < pivot) qsort(smaller) ::: pivot :: qsort(rest) }
Alternativa en Java import java.io.*; import java.util.*; public class QuickSort { public static void swap (int A[], int x, int y) { int temp = A[x]; A[x] = A[y]; A[y] = temp; } public static int partition(int A[], int f, int l) { int pivot = A[f];
while (f < l) { while (A[f] < pivot) f++; while (A[l] > pivot) l-‐-‐; swap (A, f, l); } return f; } public static void Quicksort(int A[], int f, int l) { if (f >= l) return; int pivot_index = partition(A, f, l); Quicksort(A, f, pivot_index); Quicksort(A, pivot_index+1, l); }
MARCADO
!!! %head %title BoBlog %link{"rel" => "stylesheet", "href" => "main.css", "type" => "text/css"} %body #header %h1 BoBlog %h2 Blog de Bob #content -‐ @entries.each do |entry| .entry %h3.title= entry.title %p.date= entry.posted.strftime("%A %d de %B de %Y") %p.body= entry.body #footer %p
Razor
<ul> @for (var i = 0; i < 5; i++) { <li>@i</li> } </ul> @{ var name = “Gilberto Salazar”; <div> Nombre: @name </div> }
DATOS
JSON {"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ] } }}
demo
Alternativa en XML
<menu id="file" value="File"> <popup> <menuitem value="New" onclick="CreateNewDoc()" /> <menuitem value="Open" onclick="OpenDoc()" /> <menuitem value="Close" onclick="CloseDoc()" /> </popup> </menu>
Recursos de aprendizaje
• Javascript – http://www.codecademy.com/courses – http://nodejs.org/
• Python
– http://docs.python.org/tutorial/
• Ruby – http://www.ruby-lang.org/es/documentation/quickstart/
• Scala – http://www.scala-lang.org/docu/files/ScalaByExample.pdf
Gracias
http://rlbisbe.net
Top Related