SlideShare una empresa de Scribd logo
1 de 81
Descargar para leer sin conexión
large
                           Architecting


                         node.js
                           applications
Monday, October 22, 12
@sergimansilla

Monday, October 22, 12
P ro g ra m
      ☐ C l o u d9 ID E?
      ☐ Grow in g pai n s
      ☐ I n t ro du c i n g Arc hitec t
      ☐ Le ss on s le arn e d


Monday, October 22, 12
Normal developers




Monday, October 22, 12
JavaScript Developer




Monday, October 22, 12
Cloud9 IDE - http://c9.io




Monday, October 22, 12
Real
                         debugging




Monday, October 22, 12
(Smart!)
                         Code completion



Monday, October 22, 12
Static
                         analysis



Monday, October 22, 12
Free
                         Linux

Monday, October 22, 12
                         VM
Bring your own machine
Monday, October 22, 12
Real terminal




Monday, October 22, 12
Collaboration



Monday, October 22, 12
See each other type
              Debug together
              Productivity++
Monday, October 22, 12
Create
                         Deploy                      Run/Debug


                             Share            Test


Monday, October 22, 12
P ro g ra m
      ☑ C l o u d9 ID E?
      ☐ Grow in g pai n s
      ☐ I n t ro du c i n g Arc hitec t
      ☐ Le ss on s le arn e d


Monday, October 22, 12
10,000s
                         LOC
                         of JavaScript
Monday, October 22, 12
dynamic,
                           weakly
                         typed
                           language
Monday, October 22, 12
one
                         single
Monday, October 22, 12
                         thread
Openshift
       Cloud9 datacenter
                                      Remote VM


                         IDE server   Remote VM


                                      Remote VM



Monday, October 22, 12
Pure madness



Monday, October 22, 12
Modularization
Monday, October 22, 12
Black
                         box
                           coding
Monday, October 22, 12
Monday, October 22, 12
Java/.NET      import(s)


            Node.js      require


Monday, October 22, 12
Great for
      re
 requi




                         abstracting

Monday, October 22, 12
                         away
re
 requi



                         Not Great for
                         application
                         modularity
Monday, October 22, 12
re
 requi



                         Relies on FS
                           duplicated modules
                          maps to folder names
                         Hard to configure module

Monday, October 22, 12
Dependency error handling

     coding time           compile time   run time
                                                          !
                                                        OM
                                                - BO
                                          KA

                                          - Server crash
                                          - Unhappy customers
                                          - Developer gets fired




Monday, October 22, 12
How to fix it?

       Static dependency list         Resolve at startup
       Named services                 No FS required
       Easy configuration             Pass an object



Monday, October 22, 12
P ro g ra m
      ☑ C l o u d9 ID E?
      ☑ G row i n g pai n s
      ☐ I n t ro du c i n g Arc hitec t
      ☐ Le ss on s le arn e d


Monday, October 22, 12
Architect




                         github.com/c9/architect

Monday, October 22, 12
Architect

             Everything is a plugin
             Plugins can consume plugins
             An application is just a set of plugins

Monday, October 22, 12
Dependency model

                     require          runtime
                   Architect      compile time

Monday, October 22, 12
Dependency error handling
                               Architect
  coding time             compile time              run time




                                                    - Happy customers
                           - Fails before release   - Developer keeps job



Monday, October 22, 12
Monday, October 22, 12
Declare entity ‘presenter’ with behavior
       Use ‘presenter’ to do a presentation



Monday, October 22, 12
Dependency model


                         Presenter             Presentation




Monday, October 22, 12
Express our model
                             package.json

                           Builds dependency tree

                           without
                           executing code
Monday, October 22, 12
Monday, October 22, 12
What’s next?

      Wrap in Architect plugin code
      Extract the code
      Make two plugins


Monday, October 22, 12
Function
                                signature




                         Call when done
Monday, October 22, 12
Architect plugin code
Module.exports
               Options - we’ll get to that
               Imports - everything you ‘consume’
               Register - invoke when done

Monday, October 22, 12
Monday, October 22, 12
Monday, October 22, 12
Easy to test
                              Mock dependencies



Monday, October 22, 12
Assert ‘dance’ is called 11 times




Monday, October 22, 12
No black magic

                Specify dependency model
      Feed architect a config file
                 Call ‘createApp’

Monday, October 22, 12
Monday, October 22, 12
Monday, October 22, 12
Configuration

                Per-plugin options
                No global options object
                Specify in config file

Monday, October 22, 12
Monday, October 22, 12
Monday, October 22, 12
Options

                         Automatically passed in at startup
      Options are also dependencies
                               Fail if options aren’t present

Monday, October 22, 12
Monday, October 22, 12
Monday, October 22, 12
Architect makes you think of your app as
          chunks of functionality
        rather than sets of classes


Monday, October 22, 12
Think ‘chunks of functionality’

           Implicit type constraints
                                Keep implementation private
           Swap features instead of interfaces

Monday, October 22, 12
How does Cloud9 use it?
                Open source version
                Local version (OS + sync)
                Hosted version
                         Normal
                         FTP
                         SSH
Monday, October 22, 12
Monday, October 22, 12
Swap feature per
                               implementation
                         On Open source: talk local filesystem
                         On FTP: talk FTP library
                         On SSH: talk via a SSH bridge

Monday, October 22, 12
Here is something your
                          DI framework can’t do


Monday, October 22, 12
Single node.js process


                                        IDE instance   IDE instance
                                           (FTP)          (SSH)
                       Other code
                     (dashboard etc.)
                                        IDE instance   IDE instance
                                          (Normal)       (Normal)




Monday, October 22, 12
Monday, October 22, 12
Architect can do

             Multiple instances of same plugin
                             Run independently
             But in the same process


Monday, October 22, 12
Monday, October 22, 12
Monday, October 22, 12
HERE’S SOMETHING COOL




Monday, October 22, 12
Centralized eventbus

       Loose coupling between plugins
       No hard dependencies!
       Can also do inter-context communication


Monday, October 22, 12
React on event
                Other plugin




                                                Event
                                                 bus



                                                        Emit event
                                                                     Plugin


Monday, October 22, 12
Monday, October 22, 12
Monday, October 22, 12
And now scale up

       Need something inter-server
       Swap it with i.e. Redis PubSub
       Plugins will never notice
       Modular awesomeness!

Monday, October 22, 12
P ro g ra m
      ☑ C l o u d9 ID E?
      ☑ G row i n g pai n s
      ☑ I n t ro du c i n g Arc hitec t
      ☐ Le sson s learn ed


Monday, October 22, 12
Modularize in feature blocks

                Don’t over engineer
                Don’t create too small blocks
                They aren’t interfaces!

Monday, October 22, 12
Use dependency injection

                Architect (JavaScript)
                StructureMap (.NET)
                Spring (Java)

Monday, October 22, 12
Avoid context switching

                Less code!
                Less errors!
                Less boilerplate!

Monday, October 22, 12
Loose coupling

                         Use an event bus
                         Smaller dependency graph



Monday, October 22, 12
github.com/c9/architect

Monday, October 22, 12
Happy coding!


Monday, October 22, 12
http://c9.io

                                            Sergi Mansilla
                                         @sergimansilla
                                        github.com/sergi
Monday, October 22, 12

Más contenido relacionado

Similar a Architecting large Node.js applications

The Web Designers Toolkit
The Web Designers ToolkitThe Web Designers Toolkit
The Web Designers ToolkitR/GA
 
Inbound Marketing and WordPress
Inbound Marketing and WordPressInbound Marketing and WordPress
Inbound Marketing and WordPressAaron Smith
 
Big app design for Node.js
Big app design for Node.jsBig app design for Node.js
Big app design for Node.jsSergi Mansilla
 
A Morning with MongoDB Barcelona: Introduction
A Morning with MongoDB Barcelona: IntroductionA Morning with MongoDB Barcelona: Introduction
A Morning with MongoDB Barcelona: IntroductionMongoDB
 
Down the Rabbit Hole: Getting Started with the DITA Open Toolkit
Down the Rabbit Hole: Getting Started with the DITA Open Toolkit Down the Rabbit Hole: Getting Started with the DITA Open Toolkit
Down the Rabbit Hole: Getting Started with the DITA Open Toolkit Scriptorium Publishing
 
REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012
REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012
REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012Phil Harvey
 
Building businesspost.ie using Node.js
Building businesspost.ie using Node.jsBuilding businesspost.ie using Node.js
Building businesspost.ie using Node.jsRichard Rodger
 
Angular.js - JS Camp UKraine 2013
Angular.js - JS Camp UKraine 2013Angular.js - JS Camp UKraine 2013
Angular.js - JS Camp UKraine 2013Max Klymyshyn
 
Web development, from git flow to github flow
Web development, from git flow to github flowWeb development, from git flow to github flow
Web development, from git flow to github flowCaesar Chi
 
Node.js, toy or power tool?
Node.js, toy or power tool?Node.js, toy or power tool?
Node.js, toy or power tool?Ovidiu Dimulescu
 
Html5 new sword for interactive app
Html5 new sword for interactive appHtml5 new sword for interactive app
Html5 new sword for interactive appYohan Totting
 
Cloud Foundry Bootcamp
Cloud Foundry BootcampCloud Foundry Bootcamp
Cloud Foundry BootcampAlvaro Videla
 
Cloud Foundry, the Open Platform as a Service - Oscon - July 2012
Cloud Foundry, the Open Platform as a Service - Oscon - July 2012Cloud Foundry, the Open Platform as a Service - Oscon - July 2012
Cloud Foundry, the Open Platform as a Service - Oscon - July 2012Patrick Chanezon
 
A Morning with MongoDB Barcelona: Use Cases and Roadmap
A Morning with MongoDB Barcelona: Use Cases and RoadmapA Morning with MongoDB Barcelona: Use Cases and Roadmap
A Morning with MongoDB Barcelona: Use Cases and RoadmapMongoDB
 
Introduction to Docker and Linux Containers @ Cloud Computing Rhein Main
Introduction to Docker and Linux Containers @ Cloud Computing Rhein MainIntroduction to Docker and Linux Containers @ Cloud Computing Rhein Main
Introduction to Docker and Linux Containers @ Cloud Computing Rhein MainPuja Abbassi
 

Similar a Architecting large Node.js applications (20)

The Web Designers Toolkit
The Web Designers ToolkitThe Web Designers Toolkit
The Web Designers Toolkit
 
Aegir
AegirAegir
Aegir
 
Inbound Marketing and WordPress
Inbound Marketing and WordPressInbound Marketing and WordPress
Inbound Marketing and WordPress
 
Big app design for Node.js
Big app design for Node.jsBig app design for Node.js
Big app design for Node.js
 
A Morning with MongoDB Barcelona: Introduction
A Morning with MongoDB Barcelona: IntroductionA Morning with MongoDB Barcelona: Introduction
A Morning with MongoDB Barcelona: Introduction
 
Down the Rabbit Hole: Getting Started with the DITA Open Toolkit
Down the Rabbit Hole: Getting Started with the DITA Open Toolkit Down the Rabbit Hole: Getting Started with the DITA Open Toolkit
Down the Rabbit Hole: Getting Started with the DITA Open Toolkit
 
REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012
REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012
REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012
 
Building businesspost.ie using Node.js
Building businesspost.ie using Node.jsBuilding businesspost.ie using Node.js
Building businesspost.ie using Node.js
 
Angular.js - JS Camp UKraine 2013
Angular.js - JS Camp UKraine 2013Angular.js - JS Camp UKraine 2013
Angular.js - JS Camp UKraine 2013
 
Web development, from git flow to github flow
Web development, from git flow to github flowWeb development, from git flow to github flow
Web development, from git flow to github flow
 
Agile V2
Agile V2Agile V2
Agile V2
 
Node.js, toy or power tool?
Node.js, toy or power tool?Node.js, toy or power tool?
Node.js, toy or power tool?
 
Html5 new sword for interactive app
Html5 new sword for interactive appHtml5 new sword for interactive app
Html5 new sword for interactive app
 
Cloud Foundry Bootcamp
Cloud Foundry BootcampCloud Foundry Bootcamp
Cloud Foundry Bootcamp
 
Cloud foundry and openstackcloud
Cloud foundry and openstackcloudCloud foundry and openstackcloud
Cloud foundry and openstackcloud
 
Cloud Foundry, the Open Platform as a Service - Oscon - July 2012
Cloud Foundry, the Open Platform as a Service - Oscon - July 2012Cloud Foundry, the Open Platform as a Service - Oscon - July 2012
Cloud Foundry, the Open Platform as a Service - Oscon - July 2012
 
The Design of Everyday Things
The Design of Everyday ThingsThe Design of Everyday Things
The Design of Everyday Things
 
Cloudera Desktop
Cloudera DesktopCloudera Desktop
Cloudera Desktop
 
A Morning with MongoDB Barcelona: Use Cases and Roadmap
A Morning with MongoDB Barcelona: Use Cases and RoadmapA Morning with MongoDB Barcelona: Use Cases and Roadmap
A Morning with MongoDB Barcelona: Use Cases and Roadmap
 
Introduction to Docker and Linux Containers @ Cloud Computing Rhein Main
Introduction to Docker and Linux Containers @ Cloud Computing Rhein MainIntroduction to Docker and Linux Containers @ Cloud Computing Rhein Main
Introduction to Docker and Linux Containers @ Cloud Computing Rhein Main
 

Último

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 

Último (20)

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 

Architecting large Node.js applications