From concept to cloud: A look at modern software development Chris Richardson Author of POJOs in Action Founder of the original CloudFoundry.com [email protected]@crichardson plainoldobjects.com From concept to cloud: A look at modern software development Chris Richardson Author of POJOs in Action, Founder of the original CloudFoundry.com [email protected], @crichardson plainoldobjects.com
114
Embed
From concept to cloud a look at modern software development
La computadora HAL 9000 es uno de los personajes centrales de "2001 Odisea del Espacio". Considerando que esta historia fue escrita en 1968, podemos decir que la tecnología ha tenido un tremendo avance desde entonces. Y nuestra habilidad para crear software también ha mejorado un poco. Pero todavía estamos muy lejos de poder construir algo como HAL 9000. En esta conferencia echaremos un vistazo a las principales tendencias en desarrollo de software hacia los próximos años.
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
From concept to cloud: A look at modern software
developmentChris Richardson
Author of POJOs in ActionFounder of the original CloudFoundry.com
(defun factorial (n) (if (<= n 1) 1 (* n (factorial (- n 1)))))
1960 - Algol 60
http://en.wikipedia.org/wiki/Algol_60
1940
1950
1960
1970
1980
1990
2000
2010 Many languages
including Java are derived from Algol
procedure Absmax(a) Size:(n, m) Result:(y) Subscripts:(i, k); value n, m; array a; integer n, m, i, k; real y;begin integer p, q; y := 0; i := k := 1; for p:=1 step 1 until n do for q:=1 step 1 until m do if abs(a[p, q]) > y then begin y := abs(a[p, q]); i := p; k := q endend Absmax
• Developers responsible for testing, operations, ...
• Continuous deployment: update production many times a day
• Chaos monkeys - constantly verify that the system can tolerate failurehttp://highscalability.com/blog/2012/5/7/startups-are-creating-a-new-system-of-the-world-for-it.html
1940
1950
1960
1970
1980
1990
2000
2010
William Gibson
“The future is already here – it's just not evenly distributed.”
Ideas take a long time to diffuse through the software
• Example: Salesforce – SMS-based voting for 19,000 conference attendees
Expose your APIs and
build an ecosystem
Where are we going?
Going beyond today’s pop culture
But love is blind and lovers cannot seeThe pretty follies that themselves commit;For if they could, Cupid himself would blush To see me thus transformed to a boy.
Sometimes we can use request-level parallelism and let the container worry about it
BUT not always...
But concurrent programming is difficult
The problem=
Mutable state that’s shared between multiple
threads (using locks)
Not thread safepublic class InventoryTracker { private int inStock; private int sold = 0; public InventoryTracker(int initialInventory) { this.inStock = initialInventory; } public int getInStock() { return inStock; } public int sell(int units) { inStock -= units; sold += units; return inStock; }}
Thread safepublic class InventoryTracker { private int inStock; private int sold = 0; public InventoryTracker(int initialInventory) { this.inStock = initialInventory; } public synchronized int getInStock() { return inStock; } public synchronized int sell(int units) { inStock -= units; sold += units; return inStock; }}
• Single threaded runtime ⇒ no concurrency
• Runs an event loop that waits for i/o events
• i/o event ⇒ callback function
• Updates state
• Publishes events ⇒ triggers more callbacks)
• Initiates i/o, registering callbacks
• Returns
NodeJS - Event driven
Mutable state that’s shared between multiple threads
http.createServer(function (req, res) { var quantity = parseInt(url.parse(req.url, true).query.quantity); inStock -= quantity; sold += quantity; var message = "inStock=" + inStock + ", sold=" + sold; res.end(message);}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
HTTP request handler
http://127.0.0.1:1337?quantity=1
• Actor = object that asynchronously exchanges immutable messages with other actors
• Actor processes one message at a time
• Sends messages
• Updates its private mutable state
• Creates new actors
• No shared state
Scala Actors
Mutable state that’s shared between multiple threads
Scala examplecase class Sell(quantity: Int)case class Sale(inStock : Int, sold : Int)
class InventoryTracker(initialInventory : Int) extends Actor { var inStock = initialInventory var sold = 0 def receive = { case Sell(quantity) => inStock -= quantity sold += quantity sender ! Sale(inStock, sold) }}
Update state
Message types
Send reply
case class Order(quantity: Int)
class StoreFront(inventoryTracker: ActorRef) extends Actor { var numberOfOrders = 0