SlideShare une entreprise Scribd logo
1  sur  98
Télécharger pour lire hors ligne
CouchApps: Requiem for
 Accidental Complexity




   Federico Galassi   Giordano Scalzo
We have a problem...
Writing software is
   really hard...
A little bit of history
It wasn’t easy
A little bit better
Something happened
A different way of programming
Two tiers architecture




Business Logic +   Data
  Presentation
Three tiers architecture



Presentation   Business Logic   Data
Tim Berners Lee
invented the world wide web
Three tiers internet style


                 View
                  +        Model
              Controller

Thin client
Evolution of
MVC Web App
Browser is a
 thin client
Talking to a
smart server
It all starts with
an HTTP request


      GET / HTTP/1.1
      Host: example.org
It hits the
Controller
Web server parses it
                 Controller
Dispatch to
front controller
                   Controller
Routing
          Controller
Custom action
                Controller
Gets data
from Model
Query on
model objects
                Model
ORM fits into SQL
                    Model
Hits a RDBMS
               Model
Populates a
   View
Template engine
                  View
HTML back to
 the server
               View
HTML back to
 the client


   HTTP/1.1 200 OK
That’s MVC
         Model




                 View




                    Controller
A little bit old school
We love AJAX speed
Just need an API
          Model




             View              Json View




                  Controller        Api Action
And some
javascript on client
                   Model




                      View              Json View


 Javascript View


                           Controller        Api Action
Nice
one ring to rule ‘em all
No
contraindications ?
Accidental
complexity
Every change
touches the server
Hard to scale


          We must
         add another
        serveeeeerrrr
Last technology cycle
                                  WE WERE HERE
              MVC             peak  of
                             inflated
                           expectation
Visibility




                                         productivity




                           disillusionment              obsolescence
              technology
                trigger

                                  maturity
Last technology cycle
                              peak  of
                             inflated
                           expectation


                                          NOW HERE
Visibility




                                         productivity




                           disillusionment              obsolescence
              technology
                trigger

                                  maturity
Last technology cycle
                              peak  of
                             inflated
                           expectation




                                                          IF YOU’RE
Visibility




                                                        AT THIS CONF
                                         productivity


                                                         YOU MAY BE
                                                        ALREADY HERE
                           disillusionment              obsolescence
              technology
                trigger

                                  maturity
Next technology to save us?
                  ?
 Visibility




              maturity
It’s a cycle
        but we know one thing ...
Visibility




                   maturity
Specialization
     is
    Good
Very opinionated
  document DB
Very good for
some problems
A document DB
{
        "company":  "CleanCode",
        "members":  [
                {  "name":  "Gabriele  Lana",  "role":  "software  craftsman"},
                {  "name":  "Federico  Galassi",  "role":  "software  craftsman"},
                {  "name":  "Giordano  Scalzo",  "role":  "software  craftsman"}
        ]
}
Self contained data

                      INS
                J   O
             NO
Schema-less data


                           DATA
                   YO   UR
          VO   LVE
         E
Incremental
        Reduce: sum(checkouts)
           Map/Reduce
                                                    430

Re-reduce
                              142                                          288




 Reduce            100                     42                    215                     73


            {                      {                      {                      {


  Map           "id": 1,
                "day": 20100123,
                "checkout": 100
                                       "id": 2,
                                       "day": 20100123,
                                       "checkout": 42
                                                              "id": 3,
                                                              "day": 20100123,
                                                              "checkout": 215
                                                                                     "id": 4,
                                                                                     "day": 20100123,
                                                                                     "checkout": 73
            }                      }                      }                      }
Multi-Version
Concurrency Control
Crash-only
                  architecture




lucky by design
A distributed DB
Eventual
consistency
Incremental replication
Automatic conflict
    resolution
Built of the Web
“Django may be built for the Web,
but CouchDB is built of the Web.
I’ve never seen software that so
                                    Jacob Kaplan-Moss
completely embraces the             Co-creator of Django

philosophies behind HTTP.”
Restful API
GET      /                          Returns  MOTD
GET      /_all_dbs                  List  of  databases
POST     /_restart                  Restart  the  server
GET      /_log                      Tail  of  the  server’s  log
GET      /_config                   Entire  server  config
GET      /_config/<section>/<key>   Single  config  value

PUT      /_config/<section>/<key>   Set  a  single  config  value

GET      /<db>                      Database  info

PUT      /<db>                      Create  new  database

DELETE   /<db>                      Delete  database

GET      /<db>/<doc>                Latest  revision  of  the  document

PUT      /<db>/<doc>                Insert  a  new  revision  of  the  document



             ... and everything else
Javascript to
     program
//  MAP
function(doc)  {
    if(doc.date  &&  doc.title)  {
        emit(doc.date,  doc.title);
    }
}
JSON to
   exchange data
{
    "_id":"hello-­‐world",
    "_rev":"43FBA4E7AB",

    "title":"Hello  World",
    "body":"Well  hello  and  welcome  to  my  new  blog...",
    "date":"2009/01/15  15:52:20"
}
Applications
    are
 documents
Replication
    as
  deploy
A modern web
application server
CouchApps are
 javascript and html5
  applications served
directly from CouchDB
Problem
                            Model




                               View              Json View


Javascript View


                                    Controller        Api Action
Simple Solution

                  HTTP
Javascript View
Experiment:
5 minutes comet chat
The couchapp tool
Generate the app
Configure the app
Deploy the app
That’s it
That’s it
User can post a message

Add form elements
User can post a message

On click POST message to couch
User can post a message




                          Yes!
User gets a stream of messages

Add messages container
User gets a stream of messages
User gets a stream of messages




                        Yes!
Validation?
Authentication?
Authentication?
Create a user
Authentication?
Add Form Elements
Authentication?
HTTP Basic Auth
Authentication?
If it goes wrong
Authentication?
Check sender is the authenticated user
Authentication?

{ sender: “whitehouse” } // spoofing
Authentication?




           Yes!
BASIC HTTP ?????

No SSL
Yes cookie auth
via _session api
UGLY URLS ?????



  Rewrites and
  Virtual hosts
Easy eh?
But it’s not that ring
Very good for
CRUD/small/simple
      web
federico.galassi@cleancode.it   giordano.scalzo@cleancode.it
twitter.com/federicogalassi     twitter.com/giordanoscalzo
slideshare.net/fgalassi         slideshare.net/giordano

Contenu connexe

Tendances

There's more than web
There's more than webThere's more than web
There's more than web
Matt Evans
 
Beautiful Development ブレイクスルー体験記
Beautiful Development ブレイクスルー体験記Beautiful Development ブレイクスルー体験記
Beautiful Development ブレイクスルー体験記
kentaro watanabe
 
Certified Pseudonym Colligated with Master Secret Key
Certified Pseudonym Colligated with Master Secret KeyCertified Pseudonym Colligated with Master Secret Key
Certified Pseudonym Colligated with Master Secret Key
Vijay Pasupathinathan, PhD
 

Tendances (11)

MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2
 
There's more than web
There's more than webThere's more than web
There's more than web
 
EWD 3 Training Course Part 24: Traversing a Document's Leaf Nodes
EWD 3 Training Course Part 24: Traversing a Document's Leaf NodesEWD 3 Training Course Part 24: Traversing a Document's Leaf Nodes
EWD 3 Training Course Part 24: Traversing a Document's Leaf Nodes
 
JavaTalks: OOD principles
JavaTalks: OOD principlesJavaTalks: OOD principles
JavaTalks: OOD principles
 
Windows Azure Storage
Windows Azure StorageWindows Azure Storage
Windows Azure Storage
 
Beautiful Development ブレイクスルー体験記
Beautiful Development ブレイクスルー体験記Beautiful Development ブレイクスルー体験記
Beautiful Development ブレイクスルー体験記
 
Certified Pseudonym Colligated with Master Secret Key
Certified Pseudonym Colligated with Master Secret KeyCertified Pseudonym Colligated with Master Secret Key
Certified Pseudonym Colligated with Master Secret Key
 
Capacity Planning for Linux Systems
Capacity Planning for Linux SystemsCapacity Planning for Linux Systems
Capacity Planning for Linux Systems
 
JavaScript Objects and OOP Programming with JavaScript
JavaScript Objects and OOP Programming with JavaScriptJavaScript Objects and OOP Programming with JavaScript
JavaScript Objects and OOP Programming with JavaScript
 
Internet of Information and Services (IoIS): A Conceptual Integrative Archite...
Internet of Information and Services (IoIS): A Conceptual Integrative Archite...Internet of Information and Services (IoIS): A Conceptual Integrative Archite...
Internet of Information and Services (IoIS): A Conceptual Integrative Archite...
 
Web mapping with vector data. Is it the future ? 2012
Web mapping with vector data. Is it the future ? 2012Web mapping with vector data. Is it the future ? 2012
Web mapping with vector data. Is it the future ? 2012
 

En vedette

Couch Db In 60 Minutes
Couch Db In 60 MinutesCouch Db In 60 Minutes
Couch Db In 60 Minutes
George Ang
 
Couch db@nosql+taiwan
Couch db@nosql+taiwanCouch db@nosql+taiwan
Couch db@nosql+taiwan
Kenzou Yeh
 
Maneuver Warfare and Other Badass Habits of a Lean Product Developer

Maneuver Warfare and Other Badass Habits of a Lean Product Developer
Maneuver Warfare and Other Badass Habits of a Lean Product Developer

Maneuver Warfare and Other Badass Habits of a Lean Product Developer

Marko Taipale
 

En vedette (20)

CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009
 
Mongodb vs couchdb
Mongodb vs couchdb Mongodb vs couchdb
Mongodb vs couchdb
 
An introduction to CouchDB
An introduction to CouchDBAn introduction to CouchDB
An introduction to CouchDB
 
jQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchAppsjQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchApps
 
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDBZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
 
CouchDB at its Core: Global Data Storage and Rich Incremental Indexing at Clo...
CouchDB at its Core: Global Data Storage and Rich Incremental Indexing at Clo...CouchDB at its Core: Global Data Storage and Rich Incremental Indexing at Clo...
CouchDB at its Core: Global Data Storage and Rich Incremental Indexing at Clo...
 
Migrating to CouchDB
Migrating to CouchDBMigrating to CouchDB
Migrating to CouchDB
 
CouchDB-Lucene
CouchDB-LuceneCouchDB-Lucene
CouchDB-Lucene
 
Apache CouchDB
Apache CouchDBApache CouchDB
Apache CouchDB
 
Couch Db In 60 Minutes
Couch Db In 60 MinutesCouch Db In 60 Minutes
Couch Db In 60 Minutes
 
Couch db
Couch dbCouch db
Couch db
 
CouchDB at New York PHP
CouchDB at New York PHPCouchDB at New York PHP
CouchDB at New York PHP
 
Couch db@nosql+taiwan
Couch db@nosql+taiwanCouch db@nosql+taiwan
Couch db@nosql+taiwan
 
CouchDB – A Database for the Web
CouchDB – A Database for the WebCouchDB – A Database for the Web
CouchDB – A Database for the Web
 
Couch db
Couch dbCouch db
Couch db
 
CouchDB
CouchDBCouchDB
CouchDB
 
NoSQL Shootout: RavenDB vs MongoDB
NoSQL Shootout: RavenDB vs MongoDBNoSQL Shootout: RavenDB vs MongoDB
NoSQL Shootout: RavenDB vs MongoDB
 
Real World CouchDB
Real World CouchDBReal World CouchDB
Real World CouchDB
 
FIFA Teams & Their Hotel Demands
FIFA Teams & Their Hotel DemandsFIFA Teams & Their Hotel Demands
FIFA Teams & Their Hotel Demands
 
Maneuver Warfare and Other Badass Habits of a Lean Product Developer

Maneuver Warfare and Other Badass Habits of a Lean Product Developer
Maneuver Warfare and Other Badass Habits of a Lean Product Developer

Maneuver Warfare and Other Badass Habits of a Lean Product Developer

 

Similaire à CouchApps: Requiem for Accidental Complexity

Accessing ColdFusion Services From Flex Applications
Accessing ColdFusion Services From Flex ApplicationsAccessing ColdFusion Services From Flex Applications
Accessing ColdFusion Services From Flex Applications
Matt Gifford
 

Similaire à CouchApps: Requiem for Accidental Complexity (20)

Docker In Bank Unrated
Docker In Bank UnratedDocker In Bank Unrated
Docker In Bank Unrated
 
Node azure
Node azureNode azure
Node azure
 
JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)
 
Improving velocity through abstraction
Improving velocity through abstractionImproving velocity through abstraction
Improving velocity through abstraction
 
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationReal World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS Application
 
Gitlab, GitOps & ArgoCD
Gitlab, GitOps & ArgoCDGitlab, GitOps & ArgoCD
Gitlab, GitOps & ArgoCD
 
Accessing ColdFusion Services From Flex Applications
Accessing ColdFusion Services From Flex ApplicationsAccessing ColdFusion Services From Flex Applications
Accessing ColdFusion Services From Flex Applications
 
10 things ever architect should know about the Windows Azure Platform - ericnel
10 things ever architect should know about the Windows Azure Platform -  ericnel10 things ever architect should know about the Windows Azure Platform -  ericnel
10 things ever architect should know about the Windows Azure Platform - ericnel
 
Docker and Cloud - Enables for DevOps - by ACA-IT
Docker and Cloud - Enables for DevOps - by ACA-ITDocker and Cloud - Enables for DevOps - by ACA-IT
Docker and Cloud - Enables for DevOps - by ACA-IT
 
'DOCKER' & CLOUD: ENABLERS For DEVOPS
'DOCKER' & CLOUD:  ENABLERS For DEVOPS'DOCKER' & CLOUD:  ENABLERS For DEVOPS
'DOCKER' & CLOUD: ENABLERS For DEVOPS
 
RESTful apps and services with ASP.NET MVC
RESTful apps and services with ASP.NET MVCRESTful apps and services with ASP.NET MVC
RESTful apps and services with ASP.NET MVC
 
Esri Dev Summit 2009 Rest and Mvc Final
Esri Dev Summit 2009 Rest and Mvc FinalEsri Dev Summit 2009 Rest and Mvc Final
Esri Dev Summit 2009 Rest and Mvc Final
 
Modular Web Applications With Netzke
Modular Web Applications With NetzkeModular Web Applications With Netzke
Modular Web Applications With Netzke
 
Huge web apps web expo 2013
Huge web apps web expo 2013Huge web apps web expo 2013
Huge web apps web expo 2013
 
Windows Azure For Architects
Windows Azure For ArchitectsWindows Azure For Architects
Windows Azure For Architects
 
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
 
Putting the DOT in .NET - Dev/Ops/Test
Putting the DOT in .NET - Dev/Ops/TestPutting the DOT in .NET - Dev/Ops/Test
Putting the DOT in .NET - Dev/Ops/Test
 
MongoDB for Java Developers with Spring Data
MongoDB for Java Developers with Spring DataMongoDB for Java Developers with Spring Data
MongoDB for Java Developers with Spring Data
 
The Enterprise Dilemma: Native vs. Web
The Enterprise Dilemma: Native vs. WebThe Enterprise Dilemma: Native vs. Web
The Enterprise Dilemma: Native vs. Web
 
Introducing spring
Introducing springIntroducing spring
Introducing spring
 

Plus de Federico Galassi

Plus de Federico Galassi (10)

Vim, the Way of the Keyboard
Vim, the Way of the KeyboardVim, the Way of the Keyboard
Vim, the Way of the Keyboard
 
The Strange World of Javascript and all its little Asynchronous Beasts
The Strange World of Javascript and all its little Asynchronous BeastsThe Strange World of Javascript and all its little Asynchronous Beasts
The Strange World of Javascript and all its little Asynchronous Beasts
 
Javascript the New Parts v2
Javascript the New Parts v2Javascript the New Parts v2
Javascript the New Parts v2
 
Please Don't Touch the Slow Parts V3
Please Don't Touch the Slow Parts V3Please Don't Touch the Slow Parts V3
Please Don't Touch the Slow Parts V3
 
Javascript the New Parts
Javascript the New PartsJavascript the New Parts
Javascript the New Parts
 
Event Driven Javascript
Event Driven JavascriptEvent Driven Javascript
Event Driven Javascript
 
Please Don't Touch the Slow Parts V2
Please Don't Touch the Slow Parts V2Please Don't Touch the Slow Parts V2
Please Don't Touch the Slow Parts V2
 
Please Don't Touch the Slow Parts
Please Don't Touch the Slow PartsPlease Don't Touch the Slow Parts
Please Don't Touch the Slow Parts
 
Javascript The Good Parts v2
Javascript The Good Parts v2Javascript The Good Parts v2
Javascript The Good Parts v2
 
Javascript The Good Parts
Javascript The Good PartsJavascript The Good Parts
Javascript The Good Parts
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Dernier (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 

CouchApps: Requiem for Accidental Complexity